[gambit-list] non blocking IO bug ?

Adrien Pierard pierarda at iro.umontreal.ca
Mon Aug 6 14:09:44 EDT 2007


Hi !

I'm having some trouble with simple sockets operations, and I'm not sure
whether this is a bug, or whether I definitely misunderstood the
documentation.

Here is a sample code:

;; Create a server
(define node-socket
  (open-tcp-server 
    (list port-number: 8284  
          eol-encoding: 'cr-lf)))

;; Set it non blocking
(input-port-timeout-set! node-socket 0)

;; read once. Should return EOF because no one tried to connect to the
;; server
(define c
  (read node-socket))   

;; returns #t
(eof-object? c)

;; Drink a coffee and read again.
;; It should return eof again for no one is connected
(define d 
  (read node-socket))

*** ERROR IN ##thread-deadlock-action! -- Deadlock detected

Hum... Deadlock ?
Should I do something specific after "failing" to read the socket to let
some other expression to read it again ?
Or is it a bug^Wundocumented feature in the non-blocking ports routines ?

This happens as well on beta 22 as on beta 17.


Does it happen at yours too on a mac/windows ?
Do you use non blocking IO a different manner, and that works ?


Regards,

Adrien

-- 
"I am not a Church numeral; I am a free variable!"
(The Scheme Underground)
For every complex problem, there is a solution that is simple, neat, and wrong.



More information about the Gambit-list mailing list