[cl-plus-ssl-devel] read-char-no-hang hangs

David Lichteblau david at lichteblau.com
Wed Feb 10 11:39:35 UTC 2010


Hi,

Quoting gzip4 (gzip4ever at gmail.com):
> Some people at freenode found out that function read-char-no-hang
> blocks on SB-SYS:WAIT-UNTIL-FD-USABLE.
> Here is a backtrace: http://paste.lisp.org/display/94690
> 
> I wrote simple test case to reproduce this issue, it can be found at:
> http://paste.lisp.org/display/94692#2

without having done tests, I think the problem is that that
stream-listen calls read stream-read-byte, which in turn always calls
ensure-ssl-funcall.  Finally, ensure-ssl-funcall loops waiting for input
to arrive using input-wait.

What should be done IMO is that ensure-ssl-funcall should either get an
argument "nonblockingp" (or a second function nonblocking-ssl-funcall
should be made) which handles the ssl-error-want-read and
ssl-error-want-write by returning NIL instead of waiting.

Then we could have a function read-byte-no-hang which would be like
stream-read-byte, except that would call nonblocking-ssl-funcall instead
of ensure-ssl-funcall.

Finally, stream-listen would call read-byte-no-hang instead of the
blocking version.

Not certain what to do with the old binding for *blockp*.  It's only
there for the Lisp BIO, which is pretty buggy anyway.


Unfortunately I don't currently have the time/need to work on this, but
it's very good to have a test case so that the problem gets recorded
permanently.


d.




More information about the cl-plus-ssl-devel mailing list