You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Hazem Kunhamarakam Mammu (Jira)" <ax...@ws.apache.org> on 2019/12/09 04:57:00 UTC

[jira] [Resolved] (AXIS-2935) java.io.IOException: Stream closed when setting client handlers in Call object

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

Hazem Kunhamarakam Mammu resolved AXIS-2935.
--------------------------------------------
    Resolution: Fixed

> java.io.IOException: Stream closed when setting client handlers in Call object
> ------------------------------------------------------------------------------
>
>                 Key: AXIS-2935
>                 URL: https://issues.apache.org/jira/browse/AXIS-2935
>             Project: Axis
>          Issue Type: Bug
>          Components: Basic Architecture
>    Affects Versions: 1.4.1
>         Environment: openjdk version "1.8.0_212"
> OpenJDK Runtime Environment (Zulu 8.38.0.13-CA-win64) (build 1.8.0_212-b04)
> OpenJDK 64-Bit Server VM (Zulu 8.38.0.13-CA-win64) (build 25.212-b04, mixed mode)
>            Reporter: Hazem Kunhamarakam Mammu
>            Priority: Major
>              Labels: patch
>             Fix For: 1.4.1
>
>         Attachments: axis_patch.txt
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> The following exception is thrown when setting client handlers in a Call object simultaneously from multiple threads. All these call objects are created from a single Service object.
> {code:java}
> org.apache.axis.ConfigurationException: java.io.IOException: Stream closedorg.apache.axis.ConfigurationException: java.io.IOException: Stream closed
> java.io.IOException: Stream closed at
>  java.util.zip.InflaterInputStream.ensureOpen(InflaterInputStream.java:67) at 
>  java.util.zip.InflaterInputStream.read(InflaterInputStream.java:121) at
>  java.io.FilterInputStream.read(FilterInputStream.java:83) at 
> org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.readAndBuffer(Unknown Source) at 
> org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) at 
> org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source) at 
> org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at
>  org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at
>  org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at
>  org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at
>  org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at
>  org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:369) at
>  org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:388) at org.apache.axis.configuration.FileProvider.configureEngine(FileProvider.java:179) at
>  org.apache.axis.AxisEngine.init(AxisEngine.java:172) at
>  org.apache.axis.AxisEngine.<init>(AxisEngine.java:156) at
>  org.apache.axis.client.AxisClient.<init>(AxisClient.java:52) at
>  org.apache.axis.client.Service.getAxisClient(Service.java:104) at
>  org.apache.axis.client.Call.setSOAPService(Call.java:2910) at
>  org.apache.axis.client.Call.setClientHandlers(Call.java:2924) at 
> com.fisc.common.axis.TempFileProviderTest.lambda$0(TempFileProviderTest.java:28) at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at 
> java.util.concurrent.FutureTask.run(FutureTask.java:266) at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at
>  java.lang.Thread.run(Thread.java:748)
> {code}
> How to recreate?
> {code:java}
>     public static void main( String[] args) throws ServiceException
>     {
>         ExecutorService executorService = Executors.newCachedThreadPool();
>         Service service = new Service();
>         service.setMaintainSession( true);
>         for (int i = 0; i < 50; i++)
>         {
>             executorService.submit( () -> {
>                 Call call;
>                 try
>                 {
>                     call = (Call) service.createCall();
>                     call.setClientHandlers( new SomeClientRequestHandler(),
>                             new AnotherClientResponseHandler());
>                 }
>                 catch (ServiceException e)
>                 {
>                     throw new RuntimeException( e);
>                 }
>             });        }
>     }
> {code}
> Reason:
> org.apache.axis.configuration.FileProvider.configureEngine(AxisEngine) uses getInputStream() and setInputStream() methods to load the client config wsdd. These getter and setter methods read or modify the 'myInputStream' class member variable and is not thread-safe
>  
> Fix:
> Use a local InputStream method local variable to load the client config file. The stream is loaded and consumed in this method, so a local variable is appropriate here. Please find attached the unified diff file with the proposed fix.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org