Ticket #160 (closed enhancement: fixed)

Opened 2 years ago

Last modified 6 months ago

Blocking indefinitely in _libssh2_wait_socket

Reported by: dietmar11 Owned by: bagder
Priority: normal Milestone:
Component: API Version: 1.2.4
Keywords: Cc:
Blocked By: Blocks:

Description

I would suggest a default timeout in the call to select
in file session.c, line 526, as already indicated by the comment:

    /* Note that this COULD be made to use a timeout that perhaps could be
       customizable by the app or something... */
    rc = select(session->socket_fd + 1, readfd, writefd, NULL, NULL);

as it is possible, that using this function will block api calls
indefinitely, which renders them useless in practical implementations.
(I am using libssh2 on about 150 Windows XP SP2 machines and encountered this issue several times within a few weeks).

Change History

comment:1 Changed 2 years ago by bagder

  • Component changed from misc to API
  • Milestone set to 1.2.5

Jan Van Boghout posted a patch that introduces such a timeout:

http://www.libssh2.org/mail/libssh2-devel-archive-2010-02/0073.shtml

It is being worked on to get it merged into the sources.

comment:2 Changed 2 years ago by stuge

A timeout shouldn't be needed in the first place, but I think that adding one is fine in the short term. Separately from Jan's patch we've also been discussing how to improve libssh2 to never risk blocking. See #161.

comment:3 Changed 2 years ago by bagder

  • Owner set to bagder
  • Status changed from new to assigned

I disagree. A timeout might always be wanted no matter what, as we can't assume that the server-side will always play nice.

comment:4 Changed 2 years ago by josefsson.org

This relates to some keepalive changes I'm working on. I'd appreciate if we didn't push the proposed patch without further discussion. I believe a better approach here is to let libssh2 not only have a configurable timeout, but for libssh2 to send keepalive messages after the timeout, to make sure the other end is still alive.

/Simon

comment:5 Changed 2 years ago by dottedmag.net

  • Milestone changed from 1.2.5 to 1.2.6

Moving milestone to 1.2.6, as 1.2.5 is already released.

comment:6 Changed 2 years ago by bagder

  • Milestone 1.2.6 deleted

As this is currently not really worked on and there's a release pending, I've removed the specific milestone from this issue.

This said, I *do* want to see this addressed...

comment:7 Changed 18 months ago by josusky

See also #199 which reports endless poll() (which is alternative to select() in _libssh2_wait_socket())

comment:8 Changed 8 months ago by bagder

  • Milestone set to 1.3.0
  • Resolution set to fixed
  • Status changed from assigned to closed

comment:9 Changed 6 months ago by bagder

  • Milestone 1.3.0 deleted

Milestone 1.3.0 deleted

Note: See TracTickets for help on using tickets.