Skip to content
Tcl Source Code Artifact [643ad19a61]
Login

Artifact [643ad19a61]

Artifact 643ad19a61fa7c87021bec75ace7b2d7ce65163f:

Ticket change [643ad19a61] - Ticket [1726873fffffffff|1726873fff] <i>Intermittent crash in threaded Tcl</i> status still Open with 4 other changes by afredd on 2007-05-29 23:11:19.
D 2007-05-29T23:11:19
J icomment Logged\sIn:\sYES\s\nuser_id=1386588\nOriginator:\sNO\n\n\nInteresting\sproblem.\sJust\sskimmed\sthro'\stclthread.c\sand\nnoticed\sthat\sRememberSyncObject()\sdoes\snot\scheck\sthe\slist\sfor\nfree\sslots\sbefore\salloc'ing\sa\snew\slist\sie.\sit\scan\sgrow\sunnecesarily\nand\sunbounded.\sAlthough\syou'd\shave\shit\sa\smalloc\sfailure\nlong\sbefore\sthe\s"recPtr->max\s+=\s8"\swrapped...\s:-\\\nAnyway\sthis\spatch\sat\sthe\stop\sof\sthat\sfunction\smight\shelp:\n\n+\s\s\s\s/*\sCheck\sfor\sa\sfree\sNULL\sslot\sin\sthe\slist\s(if\sit\shas\sbeen\sallocated)\s*/\n+\s\s\s\sif\s(recPtr->list\s!=\sNULL)\s{\n+\s\s\s\s\s\s\sfor\s(i\s=\s0;\si\s<\srecPtr->num;\s++i)\s{\n+\s\s\s\s\s\s\s\s\s\s\sif\s(recPtr->list[i]\s==\sNULL)\s{\n+\s\s\s\s\s\s\s\s\s\s\s\s\s\s\srecPtr->list[i]\s=\sobjPtr;\n+\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sreturn;\n+\s\s\s\s\s\s\s\s\s\s\s}\n+\s\s\s\s\s\s\s}\n+\s\s\s\s}\n+\n\n\nAlso\sif\syou\sthink\sthat\sthere\smay\sbe\sa\smemory\scorruption,\nyou\scould\stry\ssomething\slike\s(untested):\n\n\stypedef\sstruct\s{\n+\s\s\s\sint\sguard1;\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s/*\smemory\scorruption\sguard\s*/\n\s\s\s\s\sint\snum;\s\s\s\s\s\s\s\s\s\s\s/*\sNumber\sof\sobjects\sremembered\s*/\n+\s\s\s\sint\sguard2;\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s/*\smemory\scorruption\sguard\s*/\n\s\s\s\s\sint\smax;\s\s\s\s\s\s\s\s\s\s\s/*\sMax\ssize\sof\sthe\sarray\s*/\n+\s\s\s\sint\sguard3;\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s/*\smemory\scorruption\sguard\s*/\n\s\s\s\s\schar\s**list;\s\s\s\s\s\s\s/*\sList\sof\spointers\s*/\n+\s\s\s\sint\sguard4;\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s/*\smemory\scorruption\sguard\s*/\n\s}\sSyncObjRecord;\n\n-static\sSyncObjRecord\skeyRecord\s=\s{0,\s0,\sNULL};\n-static\sSyncObjRecord\smutexRecord\s=\s{0,\s0,\sNULL};\n-static\sSyncObjRecord\scondRecord\s=\s{0,\s0,\sNULL};\n+#define\sGX\s0xbbbbbbbb\s/*\sthe\svalue\sin\sthe\sguard\sfields\s*/\n+\n+static\sSyncObjRecord\skeyRecord\s\s\s=\s{GX,\s0,\sGX,\s0,\sGX,\sNULL,\sGX};\n+static\sSyncObjRecord\smutexRecord\s=\s{GX,\s0,\sGX,\s0,\sGX,\sNULL,\sGX};\n+static\sSyncObjRecord\scondRecord\s\s=\s{GX,\s0,\sGX,\s0,\sGX,\sNULL,\sGX};\n\nIf\sthe\sguard\svalues\shave\schanged\swhen\sthe\scrash\soccurs\syou\nknow\ssomething's\sscrawled\sover\smemory.\n\nGood\sluck!\n\n
J login afredd
J mimetype text/plain
J username afredd
K 1726873fffffffffffffffffffffffffffffffff
U afredd
Z 863052416039d951af496b5f29630872