Overview
| Artifact ID: | fe4f51628341cd7837384045af6f54e93e21c172 |
|---|---|
| Ticket: | 1726873fffffffffffffffffffffffffffffffff
Intermittent crash in threaded Tcl |
| User & Date: | twylite on 2007-05-28 12:34:06 |
Changes
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
We have a multithreaded Tcl application running under Windows. One thread is a TCP server that dispatches calls to a pool of processing threads via thread::send -async(and they reply via thread::send) We have experienced an intermittent crash bug that occurs in ForgetSyncObject in generic/tclThread.c, causing an access violation exception. We a problem with the same symptoms on various occasions, and managed to get a debugger involved twice (on different systems, one under 2000 Pro and the other 2003 Server) to confirm that is was the same bug. By "intermittent" we mean that we can process up to 100 million transactions (that's at least 200m thread::send calls) before seeing the problem ;( On the up side we're not seeing any resource leaks ;) static void ForgetSyncObject( char *objPtr, /* Pointer to sync object */ SyncObjRecord *recPtr) /* Record of sync objects */ { int i; for (i=0 ; i<recPtr->num ; i++) { if (objPtr == recPtr->list[i]) { recPtr->list[i] = NULL; return; } } } With the debugger we see i go massively out of range. In on case by about 17,000; in another by around 100,000. Looking at code that modifies recPtr->num tells me that there should be no condition under which this can possibly happen (unless 32-bit operations are not atomic on x86, and last time I checked they were). That only guess we have at the moment is that parts of the stack (including i) are getting trashed by activity somewhere in another thread. We have only observed this bug in a multithreaded scenario. But if we set the value of i to (recPtr->num - 1) through the debugger and let the program run, everything is still fine (so the return value on the stack isn't damaged). Every time we've seen this there has been a call to ForgetSyncObj from Tcl_ConditionFinalize, which was called from ThreadSend (in threadCmd.c in the Thread extension). To make matters worse we don't know how to reproduce the problem, but we have seen it under both debug/unchecked and release builds of 8.5a6 (built under MSVC6). We need to try and track down this bug, and have resources to commit to doing so, but right now we're at a loss on how to proceed. Any suggestions on possible cause and/or how we may be able to force a reproduction may help. - foundin changed to: "None"
- is_private changed to: "0"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "twylite"
- subsystem changed to: "49. Threading"
- title changed to: "Intermittent crash in threaded Tcl"
- type changed to: "Bug"