[
https://issues.apache.org/jira/browse/VFS-849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17767092#comment-17767092
]
Thorsten Beise edited comment on VFS-849 at 9/20/23 11:27 AM:
--------------------------------------------------------------
The reason why I not able to reproduce the deadlock situation ( and
https://issues.apache.org/jira/browse/VFS-843) in tests is:
The HTTP-Response from the testcases' webdav server is different then those
form production/manual tests with docker. This leads to the http4
implementation utilizing different HttpEntity classes based on the type of
response.
For example
*WEBDAV from unit test:*
{code:java}
HttpResponseProxy{HTTP/1.1 207 Multi-Status [Date: Wed, 20 Sep 2023 10:09:38
GMT, Accept-Encoding: deflate, gzip, Content-Type: text/xml;charset=utf-8,
Server: Jetty(9.4.51.v20230217)]
org.apache.http.client.entity.DecompressingEntity@28b7646}{code}
Results in HttpEntity class of:
{code:java}
org.apache.http.client.entity.DecompressingEntity{code}
*WEBDAV from production:*
{code:java}
HttpResponseProxy{HTTP/1.1 207 Multi-Status [Date: Wed, 20 Sep 2023 10:24:34
GMT, Server: Apache/2.4.37 (Unix), Content-Length: 276, Keep-Alive: timeout=5,
max=100, Connection: Keep-Alive, Content-Type: text/xml; charset="utf-8"]
ResponseEntityProxy{[Content-Type: text/xml; charset="utf-8",Content-Length:
276,Chunked: false]}}{code}
Results in HttpEntity class of:
{code:java}
org.apache.http.impl.execchain.ResponseEntityProxy{code}
*Conclusion:*
The _org.apache.http.impl.execchain.ResponseEntityProxy_ needs to be fully
consumed before it releases the connection resources.
was (Author: beisetho):
The reason why I not able to reproduce the deadlock situation ( and
https://issues.apache.org/jira/browse/VFS-843) in tests is:
The HTTP-Response from the testcases' webdav server is different then those
form production/manual tests with docker. This leads to the http4
implementation utilizing different HttpEntity classes based on the type of
response.
For example
*WEBDAV from unit test:*
{code:java}
HttpResponseProxy{HTTP/1.1 207 Multi-Status [Date: Wed, 20 Sep 2023 10:09:38
GMT, Accept-Encoding: deflate, gzip, Content-Type: text/xml;charset=utf-8,
Server: Jetty(9.4.51.v20230217)]
org.apache.http.client.entity.DecompressingEntity@28b7646}{code}
Results in HttpEntity class of:
{code:java}
org.apache.http.client.entity.DecompressingEntity{code}
*WEBDAV frpm production:*
{code:java}
HttpResponseProxy{HTTP/1.1 207 Multi-Status [Date: Wed, 20 Sep 2023 10:24:34
GMT, Server: Apache/2.4.37 (Unix), Content-Length: 276, Keep-Alive: timeout=5,
max=100, Connection: Keep-Alive, Content-Type: text/xml; charset="utf-8"]
ResponseEntityProxy{[Content-Type: text/xml; charset="utf-8",Content-Length:
276,Chunked: false]}}{code}
Results in HttpEntity class of:
{code:java}
org.apache.http.impl.execchain.ResponseEntityProxy{code}
*Conclusion:*
The _org.apache.http.impl.execchain.ResponseEntityProxy_ needs to be fully
consumed before it releases the connection resources.
> HttpConnection resources not properly cleaned up in webdav request
> ------------------------------------------------------------------
>
> Key: VFS-849
> URL: https://issues.apache.org/jira/browse/VFS-849
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.10.0
> Reporter: Thorsten Beise
> Priority: Blocker
>
> In the 2 cases where we decide to throw an exception from
> {code:java}
> Webdav4FileObject.executeRequest(final HttpUriRequest request){code}
> the outer try-with-resource statements cannot cleanup the connection resource
> properly, because no request is returned and instead an exception is thrown.
> After some webdav operations the connections are not returned to the
> underlying connection pool which results in a deadlock situation.
> The following exception is forced via Thread.interrupt(...) from another
> monitoring thread.
> {code:java}
> org.apache.commons.vfs2.FileSystemException: Could not create file
> "webdav4s://localhost/webdav/myFile8".
> at
> org.apache.commons.vfs2.provider.AbstractFileObject.createFile(AbstractFileObject.java:335)
> at org.apache.commons.vfs2.FileObject$createFile.call(Unknown Source)
> at
> de.bwinvest.esb.jbi.bc.file.test.Webdav4sConnectionTest$_testWebdav4sConnection_closure1.doCall(Webdav4sConnectionTest.groovy:94)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> at
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101)
> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
> at
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:263)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
> at
> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:37)
> at
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
> at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
> at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
> at
> de.bwinvest.esb.jbi.bc.file.component.util.VFSFileSystemManagerFactory.process(VFSFileSystemManagerFactory.groovy:48)
> at
> de.bwinvest.esb.jbi.bc.file.component.util.VFSFileSystemManagerFactory$process.call(Unknown
> Source)
> at
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
> at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
> at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:135)
> at
> de.bwinvest.esb.jbi.bc.file.test.Webdav4sConnectionTest.testWebdav4sConnection(Webdav4sConnectionTest.groovy:77)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> at
> org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
> at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
> at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
> at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
> at
> org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
> at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
> at org.testng.TestRunner.privateRun(TestRunner.java:767)
> at org.testng.TestRunner.run(TestRunner.java:617)
> at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
> at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
> at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
> at org.testng.SuiteRunner.run(SuiteRunner.java:240)
> at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
> at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
> at org.testng.TestNG.runSuitesSequentially(TestNG.java:1198)
> at org.testng.TestNG.runSuitesLocally(TestNG.java:1123)
> at org.testng.TestNG.run(TestNG.java:1031)
> at
> org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:155)
> at
> org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass(TestNGDirectoryTestSuite.java:102)
> at
> org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:91)
> at
> org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:137)
> at
> org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
> at
> org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
> at
> org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
> at
> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
> Caused by: org.apache.commons.vfs2.FileSystemException: Could not determine
> the type of file "webdav4s://localhost/webdav".
> at
> org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:1390)
> at
> org.apache.commons.vfs2.provider.AbstractFileObject.createFolder(AbstractFileObject.java:349)
> at
> org.apache.commons.vfs2.provider.AbstractFileObject.getOutputStream(AbstractFileObject.java:1277)
> at
> org.apache.commons.vfs2.provider.DefaultFileContent.buildOutputStream(DefaultFileContent.java:293)
> at
> org.apache.commons.vfs2.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:583)
> at
> org.apache.commons.vfs2.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:571)
> at
> org.apache.commons.vfs2.provider.AbstractFileObject.createFile(AbstractFileObject.java:326)
> ... 49 more
> Caused by: org.apache.commons.vfs2.FileSystemException: Unknown message with
> code "Request aborted".
> at
> org.apache.commons.vfs2.provider.webdav4.Webdav4FileObject.executeRequest(Webdav4FileObject.java:501)
> at
> org.apache.commons.vfs2.provider.webdav4.Webdav4FileObject.getProperties(Webdav4FileObject.java:526)
> at
> org.apache.commons.vfs2.provider.webdav4.Webdav4FileObject.getProperties(Webdav4FileObject.java:518)
> at
> org.apache.commons.vfs2.provider.webdav4.Webdav4FileObject.getProperty(Webdav4FileObject.java:552)
> at
> org.apache.commons.vfs2.provider.webdav4.Webdav4FileObject.getProperty(Webdav4FileObject.java:557)
> at
> org.apache.commons.vfs2.provider.webdav4.Webdav4FileObject.isDirectory(Webdav4FileObject.java:590)
> at
> org.apache.commons.vfs2.provider.webdav4.Webdav4FileObject.doGetType(Webdav4FileObject.java:364)
> at
> org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:1384)
> ... 55 more
> Caused by: org.apache.http.impl.execchain.RequestAbortedException: Request
> aborted
> at
> org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:193)
> at
> org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
> at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
> at
> org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
> at
> org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
> at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
> at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
> at
> org.apache.commons.vfs2.provider.http4.Http4FileObject.executeHttpUriRequest(Http4FileObject.java:191)
> at
> org.apache.commons.vfs2.provider.webdav4.Webdav4FileObject.executeRequest(Webdav4FileObject.java:487)
> ... 62 more
> Caused by: java.lang.InterruptedException
> at
> java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2076)
> at
> org.apache.http.pool.AbstractConnPool.getPoolEntryBlocking(AbstractConnPool.java:391)
> at
> org.apache.http.pool.AbstractConnPool.access$300(AbstractConnPool.java:70)
> at org.apache.http.pool.AbstractConnPool$2.get(AbstractConnPool.java:253)
> at org.apache.http.pool.AbstractConnPool$2.get(AbstractConnPool.java:198)
> at
> org.apache.http.impl.conn.PoolingHttpClientConnectionManager.leaseConnection(PoolingHttpClientConnectionManager.java:306)
> at
> org.apache.http.impl.conn.PoolingHttpClientConnectionManager$1.get(PoolingHttpClientConnectionManager.java:282)
> at
> org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:190)
> ... 70 more{code}
> I can not reproduce this behaviour with the webdav server which is part of
> the testcases.
> Fix is underway.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)