Subject: [libssh2] #256: many writes, congested link -> LIBSSH2_ERROR_BAD_USE, stuck

[libssh2] #256: many writes, congested link -> LIBSSH2_ERROR_BAD_USE, stuck

From: libssh2 Trac <trac_at_libssh2.stuge.se>
Date: Thu, 31 Jan 2013 14:37:43 -0000

#256: many writes, congested link -> LIBSSH2_ERROR_BAD_USE, stuck
--------------------+--------------------
 Reporter: ncm | Owner:
     Type: defect | Status: new
 Priority: normal | Milestone: 1.4.3
Component: misc | Version: 1.4.2
 Keywords: | Blocked By:
   Blocks: |
--------------------+--------------------
 I am using libssh2 in an application that reads and writes many
 small blocks (<200 bytes) on a connection that blocks frequently.
 Occasionally a write returns LIBSSH2_ERROR_BAD_USE (-39). Once
 this occurs, no subsequent write succeeds.

 It turns out this happens when a window-adjust packet send() call
 (e.g. during {{{libssh2_channel_read()}}}) returns a short write,
 leaving {{{p->odata}}} pointing to the channel-adjust buffer.
 Sending another window-adjust would unstick it, but
 no code path provoked by normal code evokes that.

 It could happen with keepalive packets too, although I have
 not seen it yet.

 The patch attached may be the right way to fix it.

-- 
Ticket URL: <https://trac.libssh2.org/ticket/256>
libssh2 <https://trac.libssh2.org/>
C library for writing portable SSH2 clients
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2013-01-31