View Ticket
Not logged in
2016-04-08
13:33 Closed ticket [2538f373ff]: crash in Tcl_OpenTcpServer() on Windows plus 5 other changes artifact: 4f7937eaad user: jan.nijtmans
13:32 Ticket [2538f373ff]: 4 changes artifact: 732e1b832a user: jan.nijtmans
13:30
Fix [2538f373ffc78d6dba9c3d973c147a84fdd9bbd8|2538f373ffc78d6d]: crash in Tcl_OpenTcpServer() on Win... check-in: 697c1c9931 user: jan.nijtmans tags: trunk
13:27
Fix [2538f373ffc78d6dba9c3d973c147a84fdd9bbd8|2538f373ffc78d6d]: crash in Tcl_OpenTcpServer() on Win... check-in: e40eb76900 user: jan.nijtmans tags: core-8-6-branch
2016-04-07
21:43 Ticket [2538f373ff] crash in Tcl_OpenTcpServer() on Windows status still Open with 5 other changes artifact: a11e260519 user: oehhar
2016-04-06
23:36 New ticket [2538f373ff]. artifact: 23f645487c user: griffin

Ticket UUID: 2538f373ffc78d6dba9c3d973c147a84fdd9bbd8
Title: crash in Tcl_OpenTcpServer() on Windows
Type: Bug Version: 8.6.5
Submitter: griffin Created on: 2016-04-06 23:36:35
Subsystem: 37. File System Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Severe
Status: Closed Last Modified: 2016-04-08 13:33:42
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2016-04-08 13:33:42
Description:
Windows only:
If Tcl_OpenTcpServer() is the very first Socket call, then the thread data is not set correctly resulting in a crash.  Found in an embedded application.  Not reproducible via tclsh.

tclWinSock.c:
  2064      ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey);
  2065  
  2066      if (TclpHasSockets(interp) != TCL_OK) {
  2067  	return NULL;
  2068      }

The order above, KeyGet followed by HasSocket, is backwards.

that's a week of my life I'll never get back :)
User Comments: jan.nijtmans added on 2016-04-08 13:32:57:
Fixed in core-8-6-branch and trunk (didn't find this in core-8-5-branch). Thanks! Good catch!

oehhar added on 2016-04-07 21:43:55:

Thank you Brian. I will look into that next week when I am back in the office.

- Harald