Clozure / ccl

Clozure Common Lisp
http://ccl.clozure.com
Apache License 2.0
841 stars 105 forks source link

ccl fails at startup in the command line randomly and always with slime #431

Open bshetty opened 1 year ago

bshetty commented 1 year ago

This is on windows 10 and ccl-1.12.1-windowsx86 and the symptoms are the same everytime.

When i start slime in emacs with M-x slime it freezes saying "Connecting to Swank on port 1667.." if I Press C-g the inferior lisp window shows

? SetThreadContext
? for help
[18316] Clozure CL kernel debugger: 

The only option is to now enter K and get out.

If I start wx86cl64.exd on command line and use M-x slime-connect i get this error right away

Connecting to Swank on port 4005..
open-network-stream: make client process failed: Connection refused, :name, SLIME Lisp, :buffer, nil, :host, localhost, :service, 4005, :nowait, nil, :tls-parameters, nil, :coding, nil

starting wx86cl64.exe on cmd line works mostly. Here I have to edit file in emacs and load it on lisp session to run anything. All the fancy features of slime is gone ...

This is the strace from cygwin:

$ strace wx86cl64.exe
--- Process 736 created
--- Process 736 loaded C:\Windows\System32\ntdll.dll at 00007fff1cd60000
--- Process 736 loaded C:\Windows\System32\kernel32.dll at 00007fff1c5a0000
--- Process 736 loaded C:\Windows\System32\KernelBase.dll at 00007fff19210000
--- Process 736 loaded C:\Windows\System32\advapi32.dll at 00007fff1cc80000
--- Process 736 loaded C:\Windows\System32\msvcrt.dll at 00007fff1bef0000
--- Process 736 thread 16412 created
--- Process 736 loaded C:\Windows\System32\sechost.dll at 00007fff1a6c0000
--- Process 736 loaded C:\Windows\System32\rpcrt4.dll at 00007fff1a5a0000
--- Process 736 thread 16792 created
--- Process 736 loaded C:\Windows\System32\psapi.dll at 00007fff1a250000
--- Process 736 loaded C:\Windows\System32\shell32.dll at 00007fff1a720000
--- Process 736 loaded C:\Windows\System32\cfgmgr32.dll at 00007fff198f0000
--- Process 736 loaded C:\Windows\System32\ucrtbase.dll at 00007fff199e0000
--- Process 736 loaded C:\Windows\System32\SHCore.dll at 00007fff1c7c0000
--- Process 736 loaded C:\Windows\System32\combase.dll at 00007fff1a260000
--- Process 736 loaded C:\Windows\System32\bcryptprimitives.dll at 00007fff19960000
--- Process 736 thread 11312 created
--- Process 736 loaded C:\Windows\System32\windows.storage.dll at 00007fff19ae0000
--- Process 736 loaded C:\Windows\System32\shlwapi.dll at 00007fff1c980000
--- Process 736 loaded C:\Windows\System32\gdi32.dll at 00007fff1a570000
--- Process 736 loaded C:\Windows\System32\gdi32full.dll at 00007fff196b0000
--- Process 736 loaded C:\Windows\System32\msvcp_win.dll at 00007fff19850000
--- Process 736 loaded C:\Windows\System32\user32.dll at 00007fff1ca40000
--- Process 736 loaded C:\Windows\System32\win32u.dll at 00007fff19940000
--- Process 736 loaded C:\Windows\System32\kernel.appcore.dll at 00007fff190f0000
--- Process 736 loaded C:\Windows\System32\powrprof.dll at 00007fff19110000
--- Process 736 loaded C:\Windows\System32\profapi.dll at 00007fff190b0000
--- Process 736 loaded C:\Windows\System32\ws2_32.dll at 00007fff1cc10000
--- Process 736 loaded C:\Windows\System32\cryptbase.dll at 00007fff18b20000
--- Process 736 loaded C:\Windows\System32\imm32.dll at 00007fff1cbe0000
--- Process 736 loaded C:\Windows\System32\umppc16207.dll at 00000000026f0000
--- Process 736 unloaded DLL at 00000000026f0000
--- Process 736 loaded C:\Windows\System32\umppc16207.dll at 00000000026f0000
--- Process 736 unloaded DLL at 00000000001d0000
--- Process 736, exception c0000005 at 0000000100c28185
--- Process 736 thread 15236 created
--- Process 736, exception c0000005 at 0000000100232174
--- Process 736 loaded C:\Windows\System32\mswsock.dll at 00007fff18940000
--- Process 736, exception c0000005 at 000000000002469a
--- Process 736, exception c0000005 at 0000000100904d26
--- Process 736, exception c0000005 at 0000000100807e93
--- Process 736, exception c0000005 at 000000010018fdab
--- Process 736, exception c0000005 at 00000001006fd6e7
--- Process 736, exception c0000005 at 000000010017cd17
--- Process 736, exception c0000005 at 0000000000025d2c
--- Process 736, exception c0000005 at 0000000000025d2c
--- Process 736, exception c0000005 at 000000000002469a
--- Process 736, exception c0000005 at 00000001006de58b
--- Process 736, exception c0000005 at 000000000002469a
--- Process 736, exception c0000005 at 00000001004819e5
--- Process 736, exception c0000005 at 000000000002469a
--- Process 736, exception c0000005 at 00000001004819e5
--- Process 736, exception c0000005 at 0000000100901dab
--- Process 736, exception c0000005 at 000000010054b6fc
--- Process 736, exception c0000005 at 00000001001db0d4
--- Process 736, exception c0000005 at 00000001006de58b
--- Process 736, exception c0000005 at 00000001006de58b
--- Process 736, exception c0000005 at 0000000100904d26
--- Process 736, exception c0000005 at 000000000002469a
--- Process 736, exception c0000005 at 00000001007d6ff8
--- Process 736, exception c0000005 at 0000000100902056
--- Process 736, exception c0000005 at 0000000100697b6c
--- Process 736, exception c0000005 at 00000001007a85a7
--- Process 736, exception c0000005 at 0000000100904a18
--- Process 736, exception c0000005 at 0000000000025d2c
--- Process 736, exception c0000005 at 000000010047a102
--- Process 736, exception c0000005 at 0000000100554603
--- Process 736, exception c0000005 at 000000010047a669
--- Process 736, exception c0000005 at 00000001006f62ad
--- Process 736, exception c0000005 at 000000010089ed9d
--- Process 736, exception c0000005 at 0000000100904d26
--- Process 736, exception c0000005 at 00000000000251ba
--- Process 736, exception c0000005 at 0000000100804b32
--- Process 736, exception c0000005 at 00000001006de58b
--- Process 736, exception c0000005 at 00000001006de58b
--- Process 736, exception c0000005 at 0000000100901dab
--- Process 736, exception c0000005 at 00000001007d6ff8
--- Process 736, exception c0000005 at 000000010067fd0f
--- Process 736, exception c0000005 at 000000000002515a
--- Process 736, exception c0000005 at 0000000100904d26
--- Process 736, exception c0000005 at 0000000000025d2c
--- Process 736, exception c0000005 at 00000001006fd6e7
--- Process 736, exception c0000005 at 0000000100904d26
--- Process 736, exception c0000005 at 0000000100890a2f
--- Process 736, exception c0000005 at 0000000100904d26
--- Process 736, exception c0000005 at 00000001007ee3f8
--- Process 736, exception c0000005 at 000000000002469a
--- Process 736, exception c0000005 at 000000010078b691
--- Process 736, exception c0000005 at 0000000100904d26
--- Process 736, exception c0000005 at 00000001006fc11f
--- Process 736, exception c0000005 at 00000001006fd6e7
--- Process 736, exception c0000005 at 00000001006fd6e7
--- Process 736, exception c0000005 at 00000001006fd6e7
--- Process 736, exception c0000005 at 0000000100904d26
--- Process 736, exception c0000005 at 0000000000025d2c
--- Process 736, exception c0000005 at 000000010066c74d
--- Process 736, exception c0000005 at 0000000100674411
--- Process 736, exception c0000005 at 000000000002469a
--- Process 736, exception c0000005 at 00000001004819e5
--- Process 736, exception c0000005 at 00000001006de58b
--- Process 736, exception c0000005 at 00000001006f62ad
--- Process 736, exception c0000005 at 000000010069503b
--- Process 736, exception c0000005 at 0000000000025d2c
--- Process 736, exception c0000005 at 0000000000025d2c
--- Process 736, exception c0000005 at 0000000000025d2c
--- Process 736, exception c0000005 at 0000000000025d2c
--- Process 736, exception c0000005 at 0000000000025d2c
--- Process 736, exception c0000005 at 000000010067fd0f
--- Process 736, exception c0000005 at 00000001006fd6e7
--- Process 736, exception c0000005 at 0000000000025d2c
--- Process 736, exception c0000005 at 000000000002469a
--- Process 736, exception c0000005 at 00000001006fd6e7
--- Process 736, exception c0000005 at 00000001007cc113
--- Process 736, exception c0000005 at 000000010088c224
--- Process 736, exception c0000005 at 0000000100d498bb
--- Process 736, exception c0000005 at 000000010066e6aa
--- Process 736, exception c0000005 at 0000000000025d2c
--- Process 736, exception c0000005 at 000000010048e1b2
--- Process 736, exception c0000005 at 000000010069503b
--- Process 736, exception c0000005 at 000000010047a102
--- Process 736, exception c0000005 at 000000010066e6aa
--- Process 736, exception c0000005 at 0000000100901dab
--- Process 736, exception c0000005 at 00000001007de0b2
--- Process 736, exception c0000005 at 000000000002515a
--- Process 736, exception c0000005 at 00000001006fd6e7
--- Process 736, exception c0000005 at 0000000100901dab
--- Process 736, exception c0000005 at 000000000002469a
--- Process 736, exception c0000005 at 000000010088c224
--- Process 736, exception c0000005 at 00000000000251ba
--- Process 736, exception c0000005 at 00000001006de58b
--- Process 736, exception c0000005 at 0000000100904d26
--- Process 736, exception c0000005 at 00000001006950c3
--- Process 736, exception c0000005 at 0000000100904d26
--- Process 736, exception c0000005 at 00000001004819e5
--- Process 736, exception c0000005 at 000000010089ed9d
--- Process 736, exception c0000005 at 0000000100901dab
--- Process 736, exception c0000005 at 000SetThreadContext
? for help
[736] Clozure CL kernel debugger:
bscottm commented 1 year ago

Exception c0000005 is a memory access violation, which is hard to pin down without a debugger showing a stack trace. If you're using Cygwin, try running gdb wx86cl64.exe to pin down where the access violation occurs.

bshetty commented 1 year ago

The clozure kernel debugger does not give the X option in this case so debugging with gdb is not possible.

bshetty commented 1 year ago

the call to Bug is triggered at the function resume_tcr(TCR *tcr) in thread_manager.cas below:

if (context) {
      if (tcr->valence == TCR_STATE_LISP) {
          rc = SetThreadContext(hthread,context);
          if (! rc) {
             Bug(NULL,"SetThreadContext");
             return false;
         }
      }

This code is not run everytime resume_tcr is invoked. However as far I have observed it bugs out every time this runs. Commenting out the check lets ccl continue. However I think there is a need for this check as per Andys comment. I do not face the need.