borodust / claw

Common Lisp autowrapping facility for C and C++ libraries
MIT License
34 stars 6 forks source link

Installation via Quicklisp for SBCL causes `SB-KERNEL::CONTROL-STACK-EXHAUSTED` #6

Open alecStewart1 opened 2 years ago

alecStewart1 commented 2 years ago

Hello, I was attempting to install your other package, bodge-nuklear and I ran into this interesting issue.

INFO: Control stack guard page unprotected
[1/3] System 'bodge-nuklear' found. Loading the system..Control stack guard page temporarily disabled: proceed with caution
Unhandled SB-KERNEL::CONTROL-STACK-EXHAUSTED in thread #<SB-THREAD:THREAD "main thread" RUNNING
                                                          {1001548173}>:
  Control stack exhausted (no more space for function call frames).
This is probably due to heavily nested or infinitely recursive function
calls, or a tail call that SBCL cannot or has not optimized away.

PROCEED WITH CAUTION.

Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {1001548173}>
0: (SB-DEBUG::DEBUGGER-DISABLED-HOOK #<SB-KERNEL::CONTROL-STACK-EXHAUSTED {10056A6253}> #<unused argument> :QUIT T)
1: (SB-DEBUG::RUN-HOOK SB-EXT:*INVOKE-DEBUGGER-HOOK* #<SB-KERNEL::CONTROL-STACK-EXHAUSTED {10056A6253}>)
2: (INVOKE-DEBUGGER #<SB-KERNEL::CONTROL-STACK-EXHAUSTED {10056A6253}>)
3: (ERROR SB-KERNEL::CONTROL-STACK-EXHAUSTED)
4: (SB-KERNEL::CONTROL-STACK-EXHAUSTED-ERROR)
5: ("foreign function: call_into_lisp")
6: ("foreign function: post_signal_tramp")
7: ("foreign function: #x7FCAA500D161")
8: (SB-UNIX:UNIX-REALPATH "/home/my_user/.roswell/lisp/quicklisp/dists/quicklisp/software/cffi_0.24.1/cffi.asd")
9: (SB-IMPL::%QUERY-FILE-SYSTEM #P"/home/my_user/.roswell/lisp/quicklisp/dists/quicklisp/software/cffi_0.24.1/cffi.asd" :TRUENAME NIL)
10: (SB-IMPL::QUERY-FILE-SYSTEM #P"/home/my_user/.roswell/lisp/quicklisp/dists/quicklisp/software/cffi_0.24.1/cffi.asd" :TRUENAME NIL)
11: (PROBE-FILE #P"/home/my_user/.roswell/lisp/quicklisp/dists/quicklisp/software/cffi_0.24.1/cffi.asd")
12: (UIOP/FILESYSTEM:PROBE-FILE* #P"/home/my_user/.roswell/lisp/quicklisp/dists/quicklisp/software/cffi_0.24.1/cffi.asd" :TRUENAME T)
13: (UIOP/FILESYSTEM:TRUENAMIZE #P"/home/my_user/.roswell/lisp/quicklisp/dists/quicklisp/software/cffi_0.24.1/cffi.asd")
14: (ASDF/SESSION:NORMALIZE-NAMESTRING #P"/home/my_user/.roswell/lisp/quicklisp/dists/quicklisp/software/cffi_0.24.1/cffi.asd")
15: (ASDF/SESSION:GET-FILE-STAMP #P"/home/my_user/.roswell/lisp/quicklisp/dists/quicklisp/software/cffi_0.24.1/cffi.asd")
16: ((:METHOD ASDF/ACTION:COMPUTE-ACTION-STAMP (T ASDF/OPERATION:OPERATION ASDF/COMPONENT:COMPONENT)) #<ASDF/PLAN:SEQUENTIAL-PLAN {10056A5CF3}> #<ASDF/FIND-SYSTEM:DEFINE-OP > #<ASDF/SYSTEM:SYSTEM "cffi"> :JUST-DONE NIL) [fast-method]
17: (ASDF/FIND-SYSTEM::DEFINITION-DEPENDENCIES-UP-TO-DATE-P #<ASDF/SYSTEM:SYSTEM "cffi">)
18: ((LAMBDA NIL :IN ASDF/SYSTEM:FIND-SYSTEM))
19: (ASDF/SESSION:CONSULT-ASDF-CACHE (ASDF/SYSTEM:FIND-SYSTEM "cffi") #<FUNCTION (LAMBDA NIL :IN ASDF/SYSTEM:FIND-SYSTEM) {100569D64B}>)
20: (ASDF/SESSION:CALL-WITH-ASDF-SESSION #<FUNCTION (LAMBDA NIL :IN ASDF/SYSTEM:FIND-SYSTEM) {100569D64B}> :OVERRIDE NIL :KEY (ASDF/SYSTEM:FIND-SYSTEM "cffi") :OVERRIDE-CACHE NIL :OVERRIDE-FORCING NIL)
21: ((LABELS QUICKLISP-CLIENT::RECURSE :IN QUICKLISP-CLIENT::COMPUTE-LOAD-STRATEGY) "cffi")
22: ((LABELS QUICKLISP-CLIENT::RECURSE :IN QUICKLISP-CLIENT::COMPUTE-LOAD-STRATEGY) "claw")
23: ((LABELS QUICKLISP-CLIENT::RECURSE :IN QUICKLISP-CLIENT::COMPUTE-LOAD-STRATEGY) "claw-utils")
24: ((LABELS QUICKLISP-CLIENT::RECURSE :IN QUICKLISP-CLIENT::COMPUTE-LOAD-STRATEGY) "claw/util")
25: ((LABELS QUICKLISP-CLIENT::RECURSE :IN QUICKLISP-CLIENT::COMPUTE-LOAD-STRATEGY) "claw/wrapper")

It seems there's something in relation to claw. Or maybe CFFI.

I'm using SBCL, version 2.1.9.

alecStewart1 commented 2 years ago

Maybe this is a bit more helpful.

INFO: Control stack guard page unprotected
[1/3] System 'bodge-nuklear' found. Loading the system..Control stack guard page temporarily disabled: proceed with caution
Unhandled SB-KERNEL::CONTROL-STACK-EXHAUSTED in thread #<SB-THREAD:THREAD "main thread" RUNNING
                                                          {1001548183}>:
  Control stack exhausted (no more space for function call frames).
This is probably due to heavily nested or infinitely recursive function
calls, or a tail call that SBCL cannot or has not optimized away.

PROCEED WITH CAUTION.

Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {1001548183}>
0: (SB-DEBUG::DEBUGGER-DISABLED-HOOK #<SB-KERNEL::CONTROL-STACK-EXHAUSTED {10042DAD73}> #<unused argument> :QUIT T)
1: (SB-DEBUG::RUN-HOOK SB-EXT:*INVOKE-DEBUGGER-HOOK* #<SB-KERNEL::CONTROL-STACK-EXHAUSTED {10042DAD73}>)
2: (INVOKE-DEBUGGER #<SB-KERNEL::CONTROL-STACK-EXHAUSTED {10042DAD73}>)
3: (ERROR SB-KERNEL::CONTROL-STACK-EXHAUSTED)
4: (SB-KERNEL::CONTROL-STACK-EXHAUSTED-ERROR)
5: ("foreign function: call_into_lisp")
6: ("foreign function: post_signal_tramp")
7: ("foreign function: #x7F502875043D")

Er...maybe. I don't think it'd be sane to try and function the foreign function #x7F502875043D.

borodust commented 2 years ago

Can you load CFFI only? Does it errors out in the same way?

(asdf:load-system :cffi)
alecStewart1 commented 2 years ago

I can in fact. The bit you gave returns T.

apemangr commented 2 years ago

Just as a comment, I was able to install it correctly. On Windows 10, SBCL 2.1.9

alecStewart1 commented 2 years ago

Still having issues. I'm using sbcl with roswell, would it have something to do with that? I image not, but I'm just spitballing at this point.

Still getting

INFO: Control stack guard page reprotected
INFO: Control stack guard page unprotected
Control stack guard page temporarily disabled: proceed with caution

debugger invoked on a SB-KERNEL::CONTROL-STACK-EXHAUSTED in thread
#<THREAD "main thread" RUNNING {1001BB0183}>:
  Control stack exhausted (no more space for function call frames).
This is probably due to heavily nested or infinitely recursive function
calls, or a tail call that SBCL cannot or has not optimized away.

PROCEED WITH CAUTION.
borodust commented 2 years ago

I really can't guess what is wrong here. Just in case, can you load bodge-nuklear from bare SBCL? Like, start SBCL from terminal directly and try quickloading from there. Also, what does (ql:where-is-system :bodge-nuklear) report? Does (ql:update-all-dists) help?

alecStewart1 commented 1 year ago

Apologies for just getting back to this. I'll check sometime later this week if I have any issues on newer versions of SBCL.

Mr-Dispatch commented 1 year ago

Having this problem for some time (year or two; Win10 / SBCL x64 2.2.x - 2.3.x via Roswell). Did not went away even after (unrelated) full Roswell(etc.) wipe and reinstall.

EDIT: But quickloading :nuklear-blob went fine. Should I try to trace some package or something to see on what it loops ?

borodust commented 1 year ago

Yup, please, check if it works w/o roswell being involved. I don't use roswell and I don't explicitly maintain compatibility with it. But if you will be able to pinpoint the issue, depending on what it is, I might incorporate required fixes.

Mr-Dispatch commented 1 year ago

Ok, installing fresh quicklisp under SBCL 2.3.6 (compiled - but not executed - through Roswell), the following almost works:

* (ql-dist:install-dist "http://bodge.borodust.org/dist/org.borodust.bodge.txt")
...
* (ql:quickload '(nuklear-blob bodge-nuklear))
...
* (nuklear.example:run)
#<NUKLEAR.EXAMPLE::NUKLEAR-APP {1007FF00D3}>
* Assertion failed: atlas->font_num, file nuklear/nuklear.h, line 13741

What can I do to help debug Roswell -- my precioussss, glum :)

borodust commented 1 year ago

@Mr-Dispatch This new issue you've got is unrelated to claw or roswell. This is an assertion failing inside Nuklear native code. Nuklear is notoriously hard to debug - I suggest trying some other library. Maybe Shinmera's Alloy.

As for roswell, I'm no help here, unfortunately. No idea what's up with it.

Mr-Dispatch commented 1 year ago

DUH it's unrelated, just wanted to share (thought maybe the *-blob package is outdated).

As for figuring out what's wrong under roswell, could you give me some clues as to how to try to debug it ? I thought maybe tracing quicklisp or some other package might give some insight. Sysinternals tools provide something like STRACE, but that's even more verbose and low-level a.f. (not much of a CL guru, I'm afraid :-/ )

EDIT: I'm creating Roswell issue for this, they should know best.