[ 
https://issues.apache.org/jira/browse/AXIOM-517?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17739303#comment-17739303
 ] 

Andreas Veithen commented on AXIOM-517:
---------------------------------------

{{DetachableInputStream}} is designed so that the underlying stream can be 
safely closed *after* {{detach}} is called. If the underlying stream is closed 
before {{detach}} is called, then there is no way for {{DetachableInputStream}} 
to get the data that would otherwise have been returned by the underlying 
stream. So from Axiom's point of view, this is working as intended.

> Random AXIOM stream errors: Attempted read on closed stream
> -----------------------------------------------------------
>
>                 Key: AXIOM-517
>                 URL: https://issues.apache.org/jira/browse/AXIOM-517
>             Project: Axiom
>          Issue Type: Bug
>          Components: API
>    Affects Versions: 1.4.0
>            Reporter: Mohan Sri
>            Priority: Major
>              Labels: 1.4.0, AXIOM, AXIS2_1.8.2
>         Attachments: TestDetachableInputStream.java
>
>
> While using AXIS 1.8.2 with the dependency of AXIOM 1.4.0, we see random 
> stream errors in Prod when under heavy load. This error terminates the AXIS 
> request with a fatal error. Here is the trace:
> 2023-03-28 17:20:55,732 (pool-4-thread-5) ERROR  [Stub.497]: Error invoking 
> query_info: java.io.IOException: {*}Attempted read on closed stream{*}.
> org.apache.axiom.om.OMException: java.io.IOException: Attempted read on 
> closed stream.
>         at 
> org.apache.axiom.om.impl.common.factory.meta.DetachableInputStream.detach({*}DetachableInputStream.java:75{*})
>  ~[axiom-1.4.0.jar:1.4.0]
>         at 
> org.apache.axiom.om.impl.common.builder.OMXMLParserWrapperImpl.detach(OMXMLParserWrapperImpl.java:92)
>  ~[axiom-1.4.0.jar:1.4.0]
>         at 
> org.apache.axis2.kernel.TransportUtils.detachInputStream(TransportUtils.java:578)
>  ~[axis2-kernel-1.8.2.jar:1.8.2]
> The issue appears to be that when DetachableInputStream is created, it is 
> passed the inputstream it doesn't own. So an external thread could 
> potentially close the stream before detach is called on this instance. 
> Attached is a driver the generates a stack trace similar to the one we are 
> seeing in production. Please run the driver to see the error and then modify 
> the driver to have:
> TEST_TYPE testType = DETACH_THEN_CLOSE;
> Recompile and run again to see the issue doesn't happen with this sequence of 
> detach and close.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ws.apache.org
For additional commands, e-mail: dev-h...@ws.apache.org

Reply via email to