[ 
https://issues.apache.org/jira/browse/NIFI-15709?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pierre Villard resolved NIFI-15709.
-----------------------------------
    Fix Version/s: 2.9.0
         Assignee: Daniel Chaffelson
       Resolution: Fixed

> ConsumeJMS RecordWriter fails with IllegalStateException when schema 
> retrieval fails
> ------------------------------------------------------------------------------------
>
>                 Key: NIFI-15709
>                 URL: https://issues.apache.org/jira/browse/NIFI-15709
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: 2.7.2
>            Reporter: Daniel Chaffelson
>            Assignee: Daniel Chaffelson
>            Priority: Minor
>             Fix For: 2.9.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> When using ConsumeJMS with Record Reader/Writer and any Output Strategy, if 
> {{writerFactory.getSchema()}} throws an exception during record processing, 
> the processor fails with:
>  
> {{java.lang.IllegalStateException: StandardFlowFileRecord[uuid=...] already 
> in use for an active callback or an OutputStream created by 
> ProcessSession.write(FlowFile) has not been closed}}
> {*}Root Cause{*}:
> In {{{}RecordWriter.java{}}}, line 130 opens an OutputStream on the FlowFile 
> via {{{}session.write(flowFile){}}}. If the subsequent 
> {{writerFactory.getSchema()}} call (line 134) throws an exception, the error 
> handling path (lines 136-139) calls {{continue}} without closing the 
> OutputStream. When {{recordCount == 0}} at line 182-183, 
> {{session.remove(flowFile)}} is called while the OutputStream is still open, 
> triggering the IllegalStateException.
> {*}Steps to Reproduce{*}:
>  # Configure ConsumeJMS with:
>  ** Record Reader: JsonTreeReader (Schema Access Strategy: Infer Schema)
>  ** Record Writer: JsonRecordSetWriter
>  ** Output Strategy: Use Wrapper (or Use Appender)
>  # Consume a JMS message where schema inference succeeds for RecordReader but 
> fails for RecordSetWriterFactory.getSchema()
>  # Processor throws IllegalStateException
> {*}Fix{*}:
> Close {{rawOut}} in the catch block before the {{continue}} statement.
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to