diff --git a/nifi-commons/nifi-processor-utilities/src/main/java/org/apache/nifi/processor/util/bin/BinFiles.java b/nifi-commons/nifi-processor-utilities/src/main/java/org/apache/nifi/processor/util/bin/BinFiles.java index 62e5655a23..7c9034278b 100644 --- a/nifi-commons/nifi-processor-utilities/src/main/java/org/apache/nifi/processor/util/bin/BinFiles.java +++ b/nifi-commons/nifi-processor-utilities/src/main/java/org/apache/nifi/processor/util/bin/BinFiles.java @@ -230,6 +230,14 @@ public abstract class BinFiles extends AbstractSessionFactoryProcessor { } session.rollback(); return 1; + } catch (final Exception e) { + logger.error("Failed to process bundle of {} files due to {}; rolling back sessions", new Object[] {binCopy.size(), e}); + + for (final FlowFileSessionWrapper wrapper : binCopy) { + wrapper.getSession().rollback(); + } + session.rollback(); + return 1; } // we first commit the bundle's session before the originals' sessions because if we are restarted or crash