[Openmcl-devel] GC and TCP streams, connection errors during writing pending output while GC-finalizing a TCP stream

Rainer Joswig joswig at lisp.de
Mon Jul 8 04:27:46 PDT 2013


Here is a backtrace:

on #<BASIC-TCP-STREAM ISO-8859-1 (SOCKET/12) #x55DCB2BE>, within "s.org/^M                                                                                                 
^M                                                                                                                                                                         
" :                                                                                                                                                                        
Connection reset by peer (error #104) during write
   [Condition of type SOCKET-ERROR]

Restarts:
 0: [ABORT] #<RESTART ABORT #xBEF071B6>
 1: [ABORT-BREAK] #<RESTART ABORT-BREAK #xBEF071DE>

Backtrace:
  0: (SOCKET-ERROR #<BASIC-TCP-STREAM ISO-8859-1 (SOCKET/12) #x55DCB2BE> "write" 104 NIL)
  1: (CCL::FD-STREAM-FORCE-OUTPUT #<BASIC-TCP-STREAM ISO-8859-1 (SOCKET/12) #x55DCB2BE> #S(CCL::IOBLOCK :STREAM #<BASIC-TCP-STREAM ISO-8859-1 (SOCKET/12) #x55DCB2BE> :UNT$
  2: (#<CCL::STANDARD-KERNEL-METHOD STREAM-FORCE-OUTPUT (CCL::BASIC-OUTPUT-STREAM)> #<BASIC-TCP-STREAM ISO-8859-1 (SOCKET/12) #x55DCB2BE>)
  3: (CCL::FD-STREAM-CLOSE #<BASIC-TCP-STREAM ISO-8859-1 (SOCKET/12) #x55DCB2BE> #S(CCL::IOBLOCK :STREAM #<BASIC-TCP-STREAM ISO-8859-1 (SOCKET/12) #x55DCB2BE> :UNTYI-CHAR$
  4: (CCL::%%IOBLOCK-CLOSE #S(CCL::IOBLOCK :STREAM #<BASIC-TCP-STREAM ISO-8859-1 (SOCKET/12) #x55DCB2BE> :UNTYI-CHAR NIL :INBUF ...))
  5: (CCL::%%BEFORE-AND-AFTER-COMBINED-METHOD-DCODE (NIL #<CCL::STANDARD-KERNEL-METHOD CLOSE :AFTER (CCL::BASIC-STREAM)> . -306802723))
  6: (NIL #<Unknown Arguments>)
  7: (CCL::%%STANDARD-COMBINED-METHOD-DCODE ((#<CCL::STANDARD-KERNEL-METHOD CLOSE :BEFORE (CCL::BASIC-OUTPUT-STREAM)>) (#<CCL::STANDARD-KERNEL-METHOD CLOSE :AFTER (CCL::B$
  8: (NIL #<Unknown Arguments>)
  9: (NIL #<Unknown Arguments>)
 10: (NIL #<Unknown Arguments>)
 11: (CCL::%%CHECK-KEYWORDS #(1 #(:ABORT) #<Combined-Method CLOSE #x54463656>) -306802715)
 12: (NIL #<Unknown Arguments>)
 13: (DRAIN-TERMINATION-QUEUE)
 14: ((:INTERNAL CCL::ADD-GC-HOOK))
 15: (CCL::HOUSEKEEPING)
 16: (CCL::HOUSEKEEPING-LOOP)
 17: (NIL #<Unknown Arguments>)
 18: ((:INTERNAL (TOPLEVEL-FUNCTION (CCL::LISP-DEVELOPMENT-SYSTEM T))))
 19: (NIL #<Unknown Arguments>)



Am 08.07.2013 um 10:35 schrieb Rainer Joswig <joswig at lisp.de>:

> Hi,
> 
> I observed the following:
> 
> I sometimes see an error during finalizing a TCP stream (built-in) object. Using the latest CCL on Linux ARM.
> 
> * the stream is still open
> 
> * the stream is garbage
> 
> * CCL's clean-up process wants to close the stream
> 
> * because of closing the stream it sees that there is still buffered output which hasn't been written
> 
> * it tries to write the remaining output
> 
> * during writing the output, the connection gets lost and an error occurs
> 
> (I can post a backtrace if I see that again).
> 
> I guess it would be useful to make sure that streams which are garbage are already closed by the application code. That could be difficult, if a thread/Lisp-process which created and uses the stream just gets killed.
> 
> But I have no feeling whether the GC should try to write pending stream contents during finalization, while closing the stream. Is that useful or even expected? As a Lisp developer how would I be able to deal with such an error (handle it somehow?). 
> 
> Best regards,
> 
> Rainer Joswig
> 
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel




More information about the Openmcl-devel mailing list