@neykov suggested in https://github.com/bostko/winrm4j/pull/1 to use new context for every session.
However with new context for each command in concurrent test io.cloudsoft.winrm4j.winrm.WinRmToolExecLiveTest#testExecConcurrently throws the exception bellow when I use AbstractWinRmToolLiveTest.MAX_EXECUTOR_THREADS = 50 and in testExecConcurrentlyNUM_RUNS = 3
Such change will affect significantly Apache Brooklyn 's ability to use concurrent Windows Blueprints.
INFO: Current session counter: 144
V 15, 2017 4:08:09 PM org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean buildServiceFromWSDL
INFO: Creating Service {http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd}WinRmService from WSDL: jar:file:/~/.m2/repository/io/cloudsoft/windows/winrm4j-client/0.6.0-SNAPSHOT/winrm4j-client-0.6.0-SNAPSHOT.jar!/wsdl/WinRmService.wsdl
V 15, 2017 4:08:09 PM io.cloudsoft.winrm4j.winrm.AbstractWinRmToolLiveTest assertFailed
INFO: Executed in 5secs 121ms (asserting failed): statusCode=1; out=; err=The system cannot execute the specified program.
; cmd=C:\myscript-dholehse.exe
V 15, 2017 4:08:09 PM io.cloudsoft.winrm4j.winrm.WinRmToolExecLiveTest$2 call
INFO: Executed testExecCorruptExe in 11secs 193ms, in thread Thread[pool-1-thread-23,5,main]; total 76 methods done
V 15, 2017 4:08:09 PM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
WARNING: Interceptor for {http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd}WinRmService#{http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd}Create has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139)
at com.sun.proxy.$Proxy50.create(Unknown Source)
at io.cloudsoft.winrm4j.client.WinRmClient$4.call(WinRmClient.java:779)
at io.cloudsoft.winrm4j.client.WinRmClient$4.call(WinRmClient.java:774)
at io.cloudsoft.winrm4j.client.WinRmClient.winrmCallRetryConnFailure(WinRmClient.java:871)
at io.cloudsoft.winrm4j.client.WinRmClient.doCreateService_3_InitializeClientAndService(WinRmClient.java:774)
at io.cloudsoft.winrm4j.client.WinRmClient.doCreateServiceWithBean(WinRmClient.java:612)
at io.cloudsoft.winrm4j.client.WinRmClient.createService(WinRmClient.java:518)
at io.cloudsoft.winrm4j.client.WinRmClient.getService(WinRmClient.java:502)
at io.cloudsoft.winrm4j.client.WinRmClient.command(WinRmClient.java:316)
at io.cloudsoft.winrm4j.winrm.WinRmTool.executeCommand(WinRmTool.java:243)
at io.cloudsoft.winrm4j.winrm.WinRmTool.executePs(WinRmTool.java:269)
at io.cloudsoft.winrm4j.winrm.AbstractWinRmToolLiveTest$4.call(AbstractWinRmToolLiveTest.java:195)
at io.cloudsoft.winrm4j.winrm.AbstractWinRmToolLiveTest$4.call(AbstractWinRmToolLiveTest.java:192)
at io.cloudsoft.winrm4j.winrm.AbstractWinRmToolLiveTest.callWithRetries(AbstractWinRmToolLiveTest.java:220)
at io.cloudsoft.winrm4j.winrm.AbstractWinRmToolLiveTest.executePs(AbstractWinRmToolLiveTest.java:192)
at io.cloudsoft.winrm4j.winrm.AbstractWinRmToolLiveTest.assertExecPsFails(AbstractWinRmToolLiveTest.java:110)
at io.cloudsoft.winrm4j.winrm.WinRmToolExecLiveTest.testExecFailingPsScript(WinRmToolExecLiveTest.java:379)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.cloudsoft.winrm4j.winrm.WinRmToolExecLiveTest$2.call(WinRmToolExecLiveTest.java:475)
at io.cloudsoft.winrm4j.winrm.WinRmToolExecLiveTest$2.call(WinRmToolExecLiveTest.java:470)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.http.nio.reactor.IOReactorException: Failure opening selector
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.<init>(AbstractMultiworkerIOReactor.java:146)
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.<init>(DefaultConnectingIOReactor.java:81)
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.<init>(DefaultConnectingIOReactor.java:96)
at org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduitFactory.setupNIOClient(AsyncHTTPConduitFactory.java:334)
at org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduitFactory.createClient(AsyncHTTPConduitFactory.java:391)
at org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit.getHttpAsyncClient(AsyncHTTPConduit.java:119)
at org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit$AsyncWrappedOutputStream.connect(AsyncHTTPConduit.java:563)
at org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit$AsyncWrappedOutputStream.setupWrappedStream(AsyncHTTPConduit.java:428)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1328)
at org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit$AsyncWrappedOutputStream.close(AsyncHTTPConduit.java:412)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:653)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
... 34 more
Caused by: java.io.IOException: Too many open files
at sun.nio.ch.IOUtil.makePipe(Native Method)
at sun.nio.ch.EPollSelectorImpl.<init>(EPollSelectorImpl.java:65)
at sun.nio.ch.EPollSelectorProvider.openSelector(EPollSelectorProvider.java:36)
at java.nio.channels.Selector.open(Selector.java:227)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.<init>(AbstractMultiworkerIOReactor.java:144)
... 46 more
V 15, 2017 4:08:09 PM io.cloudsoft.winrm4j.winrm.AbstractWinRmToolLiveTest assertSucceeded
INFO: Executed in 5secs 994ms (asserting success): statusCode=0; out=myline
@neykov suggested in https://github.com/bostko/winrm4j/pull/1 to use new context for every session. However with new context for each command in concurrent test
io.cloudsoft.winrm4j.winrm.WinRmToolExecLiveTest#testExecConcurrently
throws the exception bellow when I useAbstractWinRmToolLiveTest.MAX_EXECUTOR_THREADS = 50
and intestExecConcurrently
NUM_RUNS = 3
Such change will affect significantly Apache Brooklyn 's ability to use concurrent Windows Blueprints.