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>
Hello Douglas,
Thank you very much for the quick reply.
Based on the CLHS clhs.lisp. se/Body/ m_w_in_ f.htm (with-input- from-string)
http://
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 case-failure expected-type: (member #\, #\}) datum: #\C>
#<sb-kernel:
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: :OUTPUT- UGLY-OBJECT :OUTPUT- OBJECT) :CALL-LOGICAL- BLOCK-PRINTER) STREAM0" :IN SB-PRETTY: :CALL-LOGICAL- BLOCK-PRINTER) :CALL-LOGICAL- BLOCK-PRINTER :OUTPUT- PRETTY- OBJECT :OUTPUT- OBJECT) :S-INTERPRETER :INTERPRET- DIRECTIVE- LIST :INTERPRET- FORMAT- LOGICAL- BLOCK) :CALL-LOGICAL- BLOCK-PRINTER) STREAM0" :IN SB-PRETTY: :CALL-LOGICAL- BLOCK-PRINTER) :CALL-LOGICAL- BLOCK-PRINTER :INTERPRET- FORMAT- LOGICAL- BLOCK :<-INTERPRETER :INTERPRET- DIRECTIVE- LIST :FAST-METHOD PRINT-OBJECT :AROUND (SB-INT: :REFERENCE- CONDITION T)) :OUTPUT- OBJECT) :A-INTERPRETER :INTERPRET- DIRECTIVE- LIST :WITH-MUTEX- THUNK :IN HUNCHENTOOT: :ACCEPTOR- LOG-MESSAGE) INTERRUPTS- BODY-1" :IN SB-THREAD: :CALL-WITH- MUTEX) :CALL-WITH- MUTEX :FAST-METHOD HUNCHENTOOT: :ACCEPTOR- LOG-MESSAGE (HUNCHENTOOT: :ACCEPTOR T T)) :REPORT- ERROR-TO- CLIENT :IN HUNCHENTOOT: :PROCESS- REQUEST) :FAST-METHOD HUNCHENTOOT: :PROCESS- REQUEST (T)) :DO-WITH- ACCEPTOR- REQUEST- COUNT-INCREMENT ED :FAST-METHOD HUNCHENTOOT: :PROCESS- CONNECTION (HUNCHENTOOT: :ACCEPTOR T)) :FAST-METHOD HUNCHENTOOT: :PROCESS- CONNECTION :AROUND (HUNCHENTOOT: :ACCEPTOR T)) :FAST-METHOD HUNCHENTOOT: :HANDLE- INCOMING- CONNECTION% (HUNCHENTOOT: :ONE-THREAD- PER-CONNECTION- TASKMASTER T)) THREADS: :BINDING- DEFAULT- SPECIALS) INTERRUPTS- BODY-132" :IN SB-THREAD::RUN) INTERRUPTS- BODY-125" :IN SB-THREAD::RUN)
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:
1: fp=0x7f765fdad310 pc=0x52a24b03 (LABELS SB-IMPL::HANDLE-IT :IN SB-KERNEL:
2: fp=0x7f765fdad338 pc=0x52b1d1a4 (FLET "PPRINT-BLOCK" :IN PPRINT-FILL)
3: fp=0x7f765fdad3f0 pc=0x52a1b2c0 (LABELS #:BODY-NAME-3 :IN SB-PRETTY:
4: fp=0x7f765fdad4b8 pc=0x52a1adae (FLET "WITH-PRETTY-
5: fp=0x7f765fdad570 pc=0x52a1ab8e SB-PRETTY:
6: fp=0x7f765fdad598 pc=0x52b1d0f2 PPRINT-FILL
7: fp=0x7f765fdad600 pc=0x52c8d919 SB-PRETTY:
8: fp=0x7f765fdad658 pc=0x52a24b03 (LABELS SB-IMPL::HANDLE-IT :IN SB-KERNEL:
9: fp=0x7f765fdad678 pc=0x52a20f18 PRIN1
10: fp=0x7f765fdad6e0 pc=0x5336a6e0 SB-FORMAT:
11: fp=0x7f765fdad710 pc=0x52af7c77 SB-FORMAT:
12: fp=0x7f765fdad7a8 pc=0x52ead27d (FLET "PPRINT-BLOCK" :IN SB-FORMAT:
13: fp=0x7f765fdad860 pc=0x52a1b2c0 (LABELS #:BODY-NAME-3 :IN SB-PRETTY:
14: fp=0x7f765fdad928 pc=0x52a1adae (FLET "WITH-PRETTY-
15: fp=0x7f765fdad9e0 pc=0x52a1ac3c SB-PRETTY:
16: fp=0x7f765fdadaa8 pc=0x52ead07e SB-FORMAT:
17: fp=0x7f765fdadb40 pc=0x533763ea SB-FORMAT:
18: fp=0x7f765fdadb70 pc=0x52af7c77 SB-FORMAT:
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:
23: fp=0x7f765fdadd50 pc=0x52a24b03 (LABELS SB-IMPL::HANDLE-IT :IN SB-KERNEL:
24: fp=0x7f765fdadd70 pc=0x52a0c152 PRINC
25: fp=0x7f765fdaddd8 pc=0x53369d30 SB-FORMAT:
26: fp=0x7f765fdade08 pc=0x52af7c77 SB-FORMAT:
27: fp=0x7f765fdade70 pc=0x52b67865 SB-FORMAT::%FORMAT
28: fp=0x7f765fdae060 pc=0x53e34c3d (FLET SB-THREAD:
29: fp=0x7f765fdae120 pc=0x53066796 (FLET "WITHOUT-
30: fp=0x7f765fdae1c0 pc=0x5306649f SB-THREAD:
31: fp=0x7f765fdae378 pc=0x53e34639 (SB-PCL:
32: fp=0x7f765fdae4b0 pc=0x53e17376 (LABELS HUNCHENTOOT:
33: fp=0x7f765fdae620 pc=0x53e16ff1 (SB-PCL:
34: fp=0x7f765fdae698 pc=0x53e2f1b1 HUNCHENTOOT:
35: fp=0x7f765fdae760 pc=0x53e3022c (SB-PCL:
36: fp=0x7f765fdae878 pc=0x53e2eb76 (SB-PCL:
37: fp=0x7f765fdae8e0 pc=0x53e2b187 (SB-PCL:
38: fp=0x7f765fdae960 pc=0x534cde98 (LAMBDA () :IN BORDEAUX-
39: fp=0x7f765fdaea50 pc=0x52bc1b75 (FLET SB-UNIX::BODY :IN SB-THREAD::RUN)
40: fp=0x7f765fdaeb40 pc=0x52bc2426 (FLET "WITHOUT-
41: fp=0x7f765fdaec98 pc=0x52bc1714 (FLET SB-UNIX::BODY :IN SB-THREAD::RUN)
42: fp=0x7f765fdaed88 pc=0x52bc1f2a (FLET "WITHOUT-
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