Chaffelson opened a new pull request, #10997:
URL: https://github.com/apache/nifi/pull/10997

   ## Summary
   
   Fixes a bug in `RecordWriter` where an unclosed `OutputStream` causes 
`IllegalStateException` when processing JMS messages with Record Reader/Writer.
   
   ## Problem
   
   When `writerFactory.getSchema()` throws an exception (line 134), the 
`OutputStream` opened by `session.write(flowFile)` (line 130) is not closed 
before the `continue` statement. This leaves the FlowFile in an invalid state. 
When `recordCount == 0`, `session.remove(flowFile)` fails with:
   
   ```
   java.lang.IllegalStateException: StandardFlowFileRecord[...] already in use 
for an active callback or an OutputStream created by 
ProcessSession.write(FlowFile) has not been closed
   ```
   
   ## Fix
   
   Close `rawOut` in the catch block before continuing to the next message.
   
   ## Testing
   
   - Existing unit tests pass
   - Manual verification with ConsumeJMS + JsonTreeReader + JsonRecordSetWriter 
+ "Use Wrapper" output strategy
   
   ## JIRA
   
   https://issues.apache.org/jira/browse/NIFI-15709


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to