Re: "TLS exhausted"; need help interpreting output from DUMP-THREAD
Douglas Katzman via Sbcl-help <[email protected]> Thu, 13 Mar 2025 17:40:46 -0400
| Newsgroups | gmane.lisp.steel-bank.general |
|---|---|
| Message-ID | <CAOrNaswcyH+F+51NdnBP9BduSrOeO66GJ7mTu0b4opTsM1v42A@mail.gmail.com> |
I don't think dump-thread is the right tool for this.
Basically it's running out of thread-local slots for special variables that
have been specially and thread-locally LET-bound.
SBCL has a hard limit on that number, and the default is only 4k.
Furthermore it has an unfortunate aspect of permanently consuming a
thread-local slot for any symbol that has ever been thread-locally bound
even if the symbol became garbage.
What you want to know is how many symbols were ever thread-locally bound
and are actively in use, and how many symbols became garbage and wasted a
slot. Unfortunately there is no way to find the symbols that became
garbage, because by definition they became garbage, but it is possible (in
theory) to reverse-engineer how many slots got wasted. I can try to create
a function that will at least inform the user of how many slots were
theoretically reclaimable. It will be a far different and more difficult
exercise to actually do the reclamation.
If the above doesn't make sense yet, try the following example which
crashes after 7FF8 in the default config:
(defun foo ()
(loop for i from 0
do
(let ((symbol (intern (format nil "*SYM~D*" i))))
(progv (list symbol) (list 'whocares)
(format t "~S has TLS index ~x~%" symbol (sb-kernel:symbol-tls-index
symbol))))))
(foo)
...
*SYM3677* has TLS index 7FF0
*SYM3678* has TLS index 7FF8
Thread local storage exhausted.
fatal error encountered in SBCL pid 2824965 tid 2824965:
%PRIMITIVE HALT called; the party is over.
On Thu, Mar 13, 2025 at 5:25 PM Robert Dodier <[email protected]>
wrote:
> Hi, I am debugging a problem which manifests as "Thread local storage
> exhausted." I'm trying to figure out what led to that.
>
> Though this is only a band-aid and not a solution, the arbitrary TLS limit
can be raised at startup time: *./run-sbcl.sh --tls-limit 32768*
(foo)
...
*SYM32350* has TLS index 3FFF8
Thread local storage exhausted.
fatal error encountered in SBCL pid 2825619 tid 2825619:
%PRIMITIVE HALT called; the party is over.
_______________________________________________
Sbcl-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sbcl-help