You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Feiyi Xiang (JIRA)" <ji...@apache.org> on 2016/07/27 20:29:20 UTC

[jira] [Created] (VFS-619) Issue creating HttpClient timeout

Feiyi Xiang created VFS-619:
-------------------------------

             Summary: Issue creating HttpClient timeout
                 Key: VFS-619
                 URL: https://issues.apache.org/jira/browse/VFS-619
             Project: Commons VFS
          Issue Type: Bug
            Reporter: Feiyi Xiang


Hi,

Recently we met an issue that the thread got stuck during the http connection using HttpClient. And It showed that the connection timeout was set to 0, which was not what we set. 
let me briefly show here how we are using VFS2:
Create a FileSystemOptions with timeout set:

final FileSystemOptions fso = new FileSystemOptions();
final HttpFileSystemConfigBuilder httpBuilder = HttpFileSystemConfigBuilder.getInstance();
httpBuilder.setConnectionTimeout(fso, connectionTimeout);
httpBuilder.setSoTimeout(fso, soTimeout);

Create a FileObject using FileSystemManager:

vfs2FileManager.resolveFile(fileLocation, fso);

Finally get the input stream using DefaultFileContent:

final InputStream instr = fileObject.getInputStream();

We noticed that in executeMethod() of HttpMethodDirector, line 153, it is setting the connection timeout using client's params. However,
in HttpClientFactory, it's setting fileSystemOptions in connectionMgrParams, and the HttpClient's params would not have this value.
So we added following 2 lines to make it work:
In package org.apache.commons.vfs2.provider.http, HttpClientFactory, added line 148 and 149:
client.getParams().setConnectionManagerTimeout(connectionMgrParams.getConnectionTimeout());
client.getParams().setSoTimeout(connectionMgrParams.getSoTimeout());
Please let me know your thought about this and if there is a patch needed, or is there something we are missing or doing wrong ?

Thanks!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)