Comment 4 for bug 2009331

Revision history for this message
JTK (jetmonk) wrote :

Hello Douglas,

Thank you very much for the quick reply.

Based on the CLHS
http://clhs.lisp.se/Body/m_w_in_f.htm (with-input-from-string)
I agree with your assessment. I'm passing the stream 'in' out of its dynamic extent in the toy example I got off the web.

Now I'm trying to figure out why my web server code is failing. I don't think that the error object that is being printed should have dynamic extent. I do have a with-input-from-stream, but the stream should not be escaping from the w-i-f-s form, unless it gets put into the
#<sb-kernel:case-failure expected-type: (member #\, #\}) datum: #\C>
that is generated, which should not be the case.

Here's what I now suspect. In the backtrace below, report-error-to-client in hunchentoot webserver can take a backtrace argument to print, and the backtrace might contain a reference to a dynamic-extent output stream because by default hunchentoot:*log-lisp-backtraces-p*=T. Is that plausible? This seems a bit unlikely because hitting dynamic extent vars would seem to represent a hazard built into backtrace.

But it does look like it died in logging when a backtrace was to be printed.

Thanks for taking the time to comment on this. This has been a big help.

[2023-02-17 21:27:53 [error]] There is no applicable method for the generic function
                                #<standard-generic-function yason:encode (12)>
                              when called with arguments
                                (#<sb-kernel:case-failure expected-type:
                                                          (member #\, #\})
                                                          datum: #\C>

CORRUPTION WARNING in SBCL pid 2663 tid 4263:
Memory fault at 0x7f8b (pc=0x52c89037 [code 0x52c88e80+0x1B7 ID 0x40a5], fp=0x7f765fdad2b8, sp=0x7f765fdad2a8) tid 4263
The integrity of this image is possibly compromised.
Exiting.
   0: fp=0x7f765fdad2b8 pc=0x52c89037 SB-KERNEL::OUTPUT-UGLY-OBJECT
   1: fp=0x7f765fdad310 pc=0x52a24b03 (LABELS SB-IMPL::HANDLE-IT :IN SB-KERNEL::OUTPUT-OBJECT)
   2: fp=0x7f765fdad338 pc=0x52b1d1a4 (FLET "PPRINT-BLOCK" :IN PPRINT-FILL)
   3: fp=0x7f765fdad3f0 pc=0x52a1b2c0 (LABELS #:BODY-NAME-3 :IN SB-PRETTY::CALL-LOGICAL-BLOCK-PRINTER)
   4: fp=0x7f765fdad4b8 pc=0x52a1adae (FLET "WITH-PRETTY-STREAM0" :IN SB-PRETTY::CALL-LOGICAL-BLOCK-PRINTER)
   5: fp=0x7f765fdad570 pc=0x52a1ab8e SB-PRETTY::CALL-LOGICAL-BLOCK-PRINTER
   6: fp=0x7f765fdad598 pc=0x52b1d0f2 PPRINT-FILL
   7: fp=0x7f765fdad600 pc=0x52c8d919 SB-PRETTY::OUTPUT-PRETTY-OBJECT
   8: fp=0x7f765fdad658 pc=0x52a24b03 (LABELS SB-IMPL::HANDLE-IT :IN SB-KERNEL::OUTPUT-OBJECT)
   9: fp=0x7f765fdad678 pc=0x52a20f18 PRIN1
  10: fp=0x7f765fdad6e0 pc=0x5336a6e0 SB-FORMAT::S-INTERPRETER
  11: fp=0x7f765fdad710 pc=0x52af7c77 SB-FORMAT::INTERPRET-DIRECTIVE-LIST
  12: fp=0x7f765fdad7a8 pc=0x52ead27d (FLET "PPRINT-BLOCK" :IN SB-FORMAT::INTERPRET-FORMAT-LOGICAL-BLOCK)
  13: fp=0x7f765fdad860 pc=0x52a1b2c0 (LABELS #:BODY-NAME-3 :IN SB-PRETTY::CALL-LOGICAL-BLOCK-PRINTER)
  14: fp=0x7f765fdad928 pc=0x52a1adae (FLET "WITH-PRETTY-STREAM0" :IN SB-PRETTY::CALL-LOGICAL-BLOCK-PRINTER)
  15: fp=0x7f765fdad9e0 pc=0x52a1ac3c SB-PRETTY::CALL-LOGICAL-BLOCK-PRINTER
  16: fp=0x7f765fdadaa8 pc=0x52ead07e SB-FORMAT::INTERPRET-FORMAT-LOGICAL-BLOCK
  17: fp=0x7f765fdadb40 pc=0x533763ea SB-FORMAT::<-INTERPRETER
  18: fp=0x7f765fdadb70 pc=0x52af7c77 SB-FORMAT::INTERPRET-DIRECTIVE-LIST
  19: fp=0x7f765fdadbd8 pc=0x52b67865 SB-FORMAT::%FORMAT
  20: fp=0x7f765fdadc20 pc=0x52a0b5b6 FORMAT
  21: fp=0x7f765fdadcd0 pc=0x52a0b48a FORMAT
  22: fp=0x7f765fdadcf8 pc=0x53428217 (SB-PCL::FAST-METHOD PRINT-OBJECT :AROUND (SB-INT::REFERENCE-CONDITION T))
  23: fp=0x7f765fdadd50 pc=0x52a24b03 (LABELS SB-IMPL::HANDLE-IT :IN SB-KERNEL::OUTPUT-OBJECT)
  24: fp=0x7f765fdadd70 pc=0x52a0c152 PRINC
  25: fp=0x7f765fdaddd8 pc=0x53369d30 SB-FORMAT::A-INTERPRETER
  26: fp=0x7f765fdade08 pc=0x52af7c77 SB-FORMAT::INTERPRET-DIRECTIVE-LIST
  27: fp=0x7f765fdade70 pc=0x52b67865 SB-FORMAT::%FORMAT
  28: fp=0x7f765fdae060 pc=0x53e34c3d (FLET SB-THREAD::WITH-MUTEX-THUNK :IN HUNCHENTOOT::ACCEPTOR-LOG-MESSAGE)
  29: fp=0x7f765fdae120 pc=0x53066796 (FLET "WITHOUT-INTERRUPTS-BODY-1" :IN SB-THREAD::CALL-WITH-MUTEX)
  30: fp=0x7f765fdae1c0 pc=0x5306649f SB-THREAD::CALL-WITH-MUTEX
  31: fp=0x7f765fdae378 pc=0x53e34639 (SB-PCL::FAST-METHOD HUNCHENTOOT::ACCEPTOR-LOG-MESSAGE (HUNCHENTOOT::ACCEPTOR T T))
  32: fp=0x7f765fdae4b0 pc=0x53e17376 (LABELS HUNCHENTOOT::REPORT-ERROR-TO-CLIENT :IN HUNCHENTOOT::PROCESS-REQUEST)
  33: fp=0x7f765fdae620 pc=0x53e16ff1 (SB-PCL::FAST-METHOD HUNCHENTOOT::PROCESS-REQUEST (T))
  34: fp=0x7f765fdae698 pc=0x53e2f1b1 HUNCHENTOOT::DO-WITH-ACCEPTOR-REQUEST-COUNT-INCREMENTED
  35: fp=0x7f765fdae760 pc=0x53e3022c (SB-PCL::FAST-METHOD HUNCHENTOOT::PROCESS-CONNECTION (HUNCHENTOOT::ACCEPTOR T))
  36: fp=0x7f765fdae878 pc=0x53e2eb76 (SB-PCL::FAST-METHOD HUNCHENTOOT::PROCESS-CONNECTION :AROUND (HUNCHENTOOT::ACCEPTOR T))
  37: fp=0x7f765fdae8e0 pc=0x53e2b187 (SB-PCL::FAST-METHOD HUNCHENTOOT::HANDLE-INCOMING-CONNECTION% (HUNCHENTOOT::ONE-THREAD-PER-CONNECTION-TASKMASTER T))
  38: fp=0x7f765fdae960 pc=0x534cde98 (LAMBDA () :IN BORDEAUX-THREADS::BINDING-DEFAULT-SPECIALS)
  39: fp=0x7f765fdaea50 pc=0x52bc1b75 (FLET SB-UNIX::BODY :IN SB-THREAD::RUN)
  40: fp=0x7f765fdaeb40 pc=0x52bc2426 (FLET "WITHOUT-INTERRUPTS-BODY-132" :IN SB-THREAD::RUN)
  41: fp=0x7f765fdaec98 pc=0x52bc1714 (FLET SB-UNIX::BODY :IN SB-THREAD::RUN)
  42: fp=0x7f765fdaed88 pc=0x52bc1f2a (FLET "WITHOUT-INTERRUPTS-BODY-125" :IN SB-THREAD::RUN)
  43: fp=0x7f765fdaee78 pc=0x52bc14d1 SB-THREAD::RUN
  44: fp=0x7f765fdaeeb0 pc=0x447c31 Foreign function call_into_lisp_
  45: fp=0x7f765fdaeed0 pc=0x41062a Foreign function funcall1