Menu

#7 Timeouts not propogated to connect statements

open
nobody
None
7
2010-12-16
2010-12-14
No

The default timeout passed to the ExpectJ constructor is not propagated to connect statements. If a firewall is silently discarding packets, connects take over 3.5 minutes to fail.

Here's an example of what would need to change, using a hard-coded timeout of 10 seconds (10000ms):

public void start() throws IOException {
m_socket = new Socket();
m_socket.connect(new InetSocketAddress(m_remoteHost, m_remotePort), 10000);
m_fromSocket = m_socket.getInputStream();
m_toSocket = m_socket.getOutputStream();
}

For SshSpawn, the connect method of Jsch sessions also takes a timeout value in milliseconds.

Thanks!

Discussion

  • Dmitrii Holodov

    Dmitrii Holodov - 2010-12-16

    The code in the original bug report above was the start() method of TelnetSpawn. In SshSpawn, the only line that would need to be changed is the one where I've passed 10,000ms below. There's multiple ways the default timeout could be propagated into those start() methods. If an official maintainer likes one way in particular and tells me, I could provide a patch without the hard-coded values.

    m_session = new JSch().getSession(m_username, m_remoteHost, m_remotePort) ;
    m_session.setPassword(m_password) ;
    m_session.setConfig("StrictHostKeyChecking", "no");
    m_session.connect(10000) ;

     
  • Dmitrii Holodov

    Dmitrii Holodov - 2010-12-16
    • priority: 5 --> 7
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.