Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Not A Bug
-
1.4.0
-
None
-
Important
Description
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.