Artifacts Associated With Ticket 31fc36fe47558452
Ticket change [b0eac711a5] (rid 219660) by apnadkarni on 2023-10-21 05:49:29:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-markdown"
- comment initialized to:
With the thread package installed, http.test crashes with a NULL pointer exception. Call stack below - tsdPtr is NULL for whatever reason. Tested on core-8-branch [12946b5cac] and head of thread-2-8-branch [6088b58218]. I presume that is the correct thread branch for 8.7, as opposed to the thread trunk. Windows only. ``` tcl87.dll!Tcl_OpenTcpServerEx(Tcl_Interp * interp, const char * service, const char * myHost, unsigned int flags, int backlog, void(*)(void *, Tcl_Channel_ *, char *, int) acceptProc, void * acceptProcData) Line 2230 at d:\src\tcltk\core-8-branch\tcl\win\tclWinSock.c(2230) tcl87.dll!Tcl_SocketObjCmd(void * dummy1465, Tcl_Interp * interp, int objc, Tcl_Obj * const * objv) Line 1654 at d:\src\tcltk\core-8-branch\tcl\generic\tclIOCmd.c(1654) tcl87.dll!Dispatch(void * * data, Tcl_Interp * interp, int dummy4918) Line 4957 at d:\src\tcltk\core-8-branch\tcl\generic\tclBasic.c(4957) tcl87.dll!TclNRRunCallbacks(Tcl_Interp * interp, int result, NRE_callback * rootPtr) Line 4996 at d:\src\tcltk\core-8-branch\tcl\generic\tclBasic.c(4996) tcl87.dll!Tcl_EvalObjv(Tcl_Interp * interp, int objc, Tcl_Obj * const * objv, int flags) Line 4716 at d:\src\tcltk\core-8-branch\tcl\generic\tclBasic.c(4716) tcl87.dll!TclEvalEx(Tcl_Interp * interp, const char * script, int numBytes, int flags, int line, int * clNextOuter, const char * outerScript) Line 5873 at d:\src\tcltk\core-8-branch\tcl\generic\tclBasic.c(5873) tcl87.dll!Tcl_EvalEx(Tcl_Interp * interp, const char * script, int numBytes, int flags) Line 5537 at d:\src\tcltk\core-8-branch\tcl\generic\tclBasic.c(5537) thread289.dll!ThreadSendEval(Tcl_Interp * interp, void * clientData) Line 1697 at d:\src\tcltk\thread\generic\threadCmd.c(1697) thread289.dll!ThreadEventProc(Tcl_Event * evPtr, int mask) Line 3218 at d:\src\tcltk\thread\generic\threadCmd.c(3218) tcl87.dll!Tcl_ServiceEvent(int flags) Line 710 at d:\src\tcltk\core-8-branch\tcl\generic\tclNotify.c(710) tcl87.dll!Tcl_DoOneEvent(int flags) Line 1007 at d:\src\tcltk\core-8-branch\tcl\generic\tclNotify.c(1007) thread289.dll!ThreadWait(Tcl_Interp * interp) Line 2963 at d:\src\tcltk\thread\generic\threadCmd.c(2963) thread289.dll!ThreadWaitObjCmd(void * dummy, Tcl_Interp * interp, int objc, Tcl_Obj * const * objv) Line 1231 at d:\src\tcltk\thread\generic\threadCmd.c(1231) tcl87.dll!Dispatch(void * * data, Tcl_Interp * interp, int dummy4918) Line 4957 at d:\src\tcltk\core-8-branch\tcl\generic\tclBasic.c(4957) ```
- foundin initialized to: "8.7"
- is_private initialized to: "0"
- login: "apnadkarni"
- priority initialized to: "5 Medium"
- private_contact initialized to: "9546e9877f1a8899e25a89082561ee694e7fb402"
- resolution initialized to: "None"
- severity initialized to: "Severe"
- status initialized to: "Open"
- submitter initialized to: "apnadkarni"
- subsystem initialized to: "- New Builtin Commands"
- title initialized to:
http.test crash on Windows with thread package installed
- type initialized to: "Bug"
Ticket change [5eaf24d078] (rid 219665) by apnadkarni on 2023-10-21 10:58:47:
- icomment:
Tcl 8.6 does not exhibit the issue (both with thread 2.8.9), quite possibly because the http test suite is very limited compared to 8.7. As for Tcl 9, the thread (3.0) package is not loadable so could not test (added to my things-to-look-at stack). In any case, with 8.7/2.8.9 the test suite crashes right away which should help with debugging. Unix builds in all configurations work without any issue so almost definitely a Windows issue only.
- login: "apnadkarni"
- mimetype: "text/plain"
- icomment:
Ticket change [cfe7b06186] (rid 219666) by apnadkarni on 2023-10-21 11:24:24:
- icomment:
So it turns out this has nothing to do with http except that it triggered the bug. The following suffices to crash ``` % socket -server accept 12345 sock000001334182C510 % package require Thread 2.8.9 % set tid [thread::create] tid0000000000004FF8 % thread::send $tid "socket -server accept 12345" couldn't open socket: address already in use % thread::send $tid "socket -server accept 12346" ...crash... ``` Requires sockets in both threads.
- login: "apnadkarni"
- mimetype: "text/plain"
- priority changed to: "7 High"
- title changed to:
Crash opening server sockets in more than one thread on Windows
- icomment:
Ticket change [aa0518a46d] (rid 219678) by apnadkarni on 2023-10-21 14:59:46:
- closedate changed to: "2460239.12484308"
- closer changed to: "apnadkarni"
- icomment:
Fixed for 8.7 and 9.0. 8.6 does not have this issue (socket initialization was refactored somewhere along the way introducing this bug).
- login: "apnadkarni"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"