Skip to content
Tcl Source Code Artifact [3b0aef318b]
Login

Artifact [3b0aef318b]

Artifact 3b0aef318bcc0cbdef7bba76df9cc5eb872447c8:

Ticket change [3b0aef318b] - New ticket [218866ffffffffff|218866ffff] <i>Crashing when deleting the global literal table</i>. by nobody on 2000-10-26 01:06:56.
D 2000-10-26T01:06:56
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s2459\sBug\nVersion:\s8.1.1\nSubmitDate:\s'1999-07-28'\nLastModified:\s'1999-10-21'\nSeverity:\sCRIT\nStatus:\sReleased\nSubmitter:\stechsupp\nChangedBy:\shobbs\nRelatedBugIDs:\s2515\nOS:\sWindows\sNT\nOSVersion:\sNT4\sService\sPack\s3/4/5\nMachine:\sX86\nFixedDate:\s'1999-10-21'\nFixedInVersion:\s8.2.2\nClosedDate:\s'2000-10-25'\n\n\nName:\n\nDavid\sWhitehouse\n\n\n\nExtensions:\n\nnone\n\n\n\nCustomShell:\n\nnone\n\n\n\nReproducibleScript:\n\nThis\sisn't\sshort,\sbut\sthis\sis\squite\sdifficult\sto\sexplain.\sSee\ssection\s7)\n\n\s\s\s\sDescribe\sthe\sundesirable\sbehaviour.\n\n\n\nObservedBehavior:\n\nUndesirable\sbehaviour:\sIt\score-dumps.\n\n\s\s\s\s\n\n\s\s\s\s\n\n\s\s\s\sEntropic\shave\sa\stool\swhich\sautomatically\sgenerates\sTcl\sfrom\sa\n\n\s\s\s\smulti-level\snetwork.\sIt\sis\sbasically\sa\sgraphical\smulti-level\sswitch\n\n\s\s\s\sstatement\sgenerator.\n\n\s\s\s\s\n\n\s\s\s\s\n\n\s\s\s\sWe\sare\shaving\sproblems\swith\ssome\sof\sthis\sgenerated\scode.\sBelow\sis\sa\n\n\s\s\s\ssegment\sof\sTcl\scode\swhich\sis\scausing\sthe\sTcl\sinterpreter\strouble.\s(It\sis\n\n\s\s\s\snot\sthe\scomplete\sset\sof\scode\ssimply\sa\sfragment\s-\sThe\scode\swe\sare\susing\n\n\s\s\s\sis\scurrently\sabout\s390K\sin\ssize,\swith\slots\sof\saugmented\sfunctions\sto\sthe\n\n\s\s\s\sinterpreter)\n\n\s\s\s\s\n\n\s\s\s\s\n\n\s\s\s\snamespace\seval\sx\s{\n\n\s\s\s\s\n\n\s\s\s\s\sproc\sState9\s{ident\sstate_number\stokenname\scount}\s{\n\n\s\s\s\supvar\s$tokenname\stoken\n\n\s\s\s\s\s\seval\s{\sset\stoken(TKNDataSource)\s""\n\n\s\s\s\s\s\s\sif\s{[isTableOnStack\s$token(TKNTableName)]==1}\s{\n\n\s\s\s\s\s\s\sset\stoken(CATEGORY)\sSUCCESS\n\n\s\s\s\s\s\s\sset\stoken(TKNDataSource)\sSTACK\n\n\s\s\s\s\s\s\s}\s\n\n\s\s\s\s\s\s}\n\n\s\s\s\s\s}\s\n\n\s\s\s\s}\n\n\s\s\s\s\n\n\s\s\s\s\n\n\s\s\s\sIt\sseems\sthat\sthe\sstring\sinside\sthe\seval,\sthe\sstring\s\s"\sset\n\n\s\s\s\stoken(TKNDa....\setc.\sSTACK\s}\s}"\sis\sstored\sin\sthe\sglobal\sstring\sliteral\n\n\s\s\s\shash\stable.\n\n\s\s\s\s\n\n\s\s\s\sThis\sstring\sis\showever\smodified\swhen\sexecuting\sthe\scommand\n\n\s\s\s\s\n\n\s\s\s\s[isTableOnStack\s$token(TKNTableName)]==1\n\n\s\s\s\s\n\n\s\s\s\sin\sthe\sfunction\s\n\n\s\s\s\s\n\n\s\s\s\sTclCompileExprWords(....)\sline\s1374\sof\stclCompile.c\n\n\s\s\s\s\n\n\s\s\s\sso\sthat\sthe\send\scharacter\sis\s\\0\snot\s'}'.\n\n\s\s\s\s\n\n\s\s\s\sHowever,\sthis\sfunction\scall\s(in\sodd\scases)\scan\scause\sthe\sglobal\sliteral\n\n\s\s\s\stable\sto\sbe\srebuilt.\sObviously\sthe\stable\sstored\sin\sthe\sobject\sis\n\n\s\s\s\sterminated\sbefore\sthe\s\s"}\s{\sset\stoken\s(CATEGORY)\sSUCCESS....\s}\s}"\n\n\s\s\s\ssection.\n\n\s\s\s\s\n\n\s\s\s\sThis\scauses\sthe\shash\sindex\sto\sbe\scalculated\scorrectly\sfor\sthe\scurrent\n\n\s\s\s\sstring,\sbut\snot\swhen\sthe\ssaved\schar\sis\sreturned\sto\sthe\sstring.\sSo\sthe\n\n\s\s\s\sindex\sis\sthen\sincorrect.\n\n\s\s\s\s\n\n\s\s\s\sThis\scauses\sno\sreal\sproblems,\suntil\sthe\sinterp\sis\sdeleted\safter\n\n\s\s\s\sexecution\sof\sthe\sscript.\s\n\n\s\s\s\s\n\n\s\s\s\sThe\sproblems\soccur\sin\sthe\sfollowing\sstack-trace\n\n\s\s\s\s\n\n\s\s\s\sIn...\n\n\s\s\s\s\n\n\s\s\s\sTcl_DeleteInterp(...)\s-\sline\s901\sfile:\stclBasic.c\n\n\s\s\s\sTcl_EventuallyFree(...)\s-\sline\s313\sfile:\stclPreserve.c\n\n\s\s\s\sDeleteInterpProc(...)\s-\sline\s1075\sfile:\stclBasic.c\n\n\s\s\s\s\n\n\s\s\s\s\n\n\s\s\s\sInside\sthe\sfunction\sTclDeleteLiteralTable(...)\swhich\sattempts\sto\ssimply\n\n\s\s\s\slinearly\saccess\sthe\shash\stable\sarray\sand\sfree\sall\sthe\selements\sby\n\n\s\s\s\sgetting\sthe\s'entryPtr'\sfrom\sthe\shashtable,\sfinding\seach\sof\sthe\s'object\n\n\s\s\s\spointers'\sin\sthe\slink\slist\sassociated\swith\sit,\sand\sattempting\sto\sfree\n\n\s\s\s\sthe\s'object\spointers'\sby\scalling\sthe\sfunction\sTclReleaseLiteral(interp,\n\n\s\s\s\s'object\spointer');\sat\sline\s123\sin\sfile\stclLiteral.c.\n\n\s\s\s\s\n\n\s\s\s\s\n\n\s\s\s\sSo\sinside\sTclReleaseLiteral\swe\sinitially\scall\n\n\s\s\s\s\n\n\s\s\s\sTcl_GetStringFromObj(...)\sline\s682\sfile:\stclLiteral.c\s-\swhich\sreturns\n\n\s\s\s\sthe\sactual\sbytes\sstored\sin\sthe\sobject.\sThese\sbytes\swill\sactually\sbe\sthe\n\n\s\s\s\sFULL\sstring\smentioned\sabove,\sand\snot\sthe\struncated\sstring\sfrom\sbefore\n\n\s\s\s\s(since\swe\sare\sat\sthe\send\sof\sexecution\sand\sattempting\sto\scleanup).\sTo\n\n\s\s\s\sfind\sthe\s'entry\spointer'\sin\sthe\shash\stable\sthe\sindex\sis\sfound.\sThis\swill\n\n\s\s\s\sreturn\sa\sdifferent\sindex\sfrom\sthe\srebuilding\sof\sthe\shash\stable.\n\n\s\s\s\s\n\n\s\s\s\sNow\sline\s691\sfile:\stclLiteral.c\shas\sa\sfor\sloop.\sImagine\sthe\ssituation\n\n\s\s\s\sthat\sthe\sindex\sjust\sreturned\sdoesn't\shave\sany\scurrent\smembers\sat\sthis\n\n\s\s\s\spoint\sin\sthe\shash\stable.\s(it\sdoesn't\smatter\sif\sit\shas\smembers,\sbut\n\n\s\s\s\seasier\sif\swe\sdisregared)\n\n\s\s\s\s\n\n\s\s\s\sThis\swill\scause\sthe\sfor\sloop\sto\simmediately\sfail\s(entryPtr\s!=\sNULL)\sand\n\n\s\s\s\swill\scause\sthe\sobjPtr\sreference\sto\sbe\sdecremented\s"Tcl_DecRefCount"\sline\n\n\s\s\s\s753\sfile:\stclLiteral.c.\sThis\sfunction\swill\snow\sreturn.\n\n\s\s\s\s\n\n\s\s\s\sHowever,\sthe\s'entryPtr'\sreference\shas\snot\sbeen\sdecremented,\sand\shence\n\n\s\s\s\sstill\sexists.\sSo\sthe\s'object\spointer'\swill\scontinue\sto\sbe\sdecremented\n\n\s\s\s\sinside\sthe\sTclReleaseLiteral\suntil\sit\sis\sactually\sdeleted.\n\n\s\s\s\s\n\n\s\s\s\sThis\sis\sthe\sproblem\spoint.\sThe\sentryPtr's\slink\slist\sstill\shas\sa\n\n\s\s\s\sreference\sto\sthis\sobject\spointer,\sbut\sis\snow\spointing\sto\ssome\sinvalid\n\n\s\s\s\spiece\sof\smemory,\swhich\shas\sjust\sbeen\sdeleted\sby\sthe\sTcl_DecRefCount\n\n\s\s\s\sfunction\scall.\n\n\s\s\s\s\n\n\s\s\s\sThis\stime\showever,\sit\swill\sattempt\sto\sfind\sthe\sbytes\sassociated\swith\n\n\s\s\s\sthis\smemory\s("aaaaaaaaaa..."\sin\sTcl\sdebug\smode).\sThis\swill\sthen\scrash\n\n\s\s\s\swhen\sHashString(..)\sis\scalled.\s(probably\sdue\sto\soverflow\ssince\n\n\s\s\s\snon-terminated\sstring)\n\n\s\s\s\s\n\n\s\s\s\s\n\n\s\s\s\s\n\n\s\s\s\sSummary:\n\n\s\s\s\s\n\n\s\s\s\sTcl_CompileExprWords(...)\stemporarily\salters\sa\sglobal\sliteral.\n\n\s\s\s\sline\s1374\sfile:\stclCompile.c\n\n\s\s\s\s\n\n\s\s\s\sIt\sis\spossible\sto\scause\sa\srebuild\sof\sthe\shash\stable\sbefore\sthe\n\n\s\s\s\salteration\sis\sput\sback,\scausing\sthe\shash\stable\sto\sbe\sincorrect\supon\n\n\s\s\s\sreturning\sfrom\sthe\sabove\sfunction\n\n\s\s\s\s\n\n\s\s\s\s\n\n\s\s\s\sThe\sdeletion\sof\sthe\shash-table\srequires\sthat\sthe\sobject\spointers\sin\sthe\n\n\s\s\s\shash\stable,\scan\scorrectly\spoint\sback\sto\sthe\scorrect\sindex\sin\sthe\n\n\s\s\s\shash-table.\sThis\sis\scomprimised\sby\sthe\sabove\scode.\n\n\s\s\s\s\n\n\s\s\s\s\n\n\s\s\s\s\n\n\s\s\s\sQuick\sFix?\n\n\s\s\s\s\n\n\s\s\s\sAs\sI\smentioned\spreviously,\swe\sare\sautomatically\sgenerating\slots\sof\scode.\n\n\s\s\s\sI\srealise\sthat\swe\scould\sjust\smake\ssure\sthat\sthis\ssimply\sdoes\snot\shappen\n\n\s\s\s\sfor\sall\sof\sour\sTcl,\sbut\sthis\scould\sprove\sdifficult\sfor\severy\spiece\sof\n\n\s\s\s\scode\sgenerated.\s\n\n\s\s\s\s\n\n\s\s\s\sAnother\salteration\scould\sbe\sthe\screation\sof\sa\snew\sstring\sliteral\sin\sthe\n\n\s\s\s\sTcl_CompileExprWords(...)\sfunction.\sI\sam\snot\saware\show\smuch\sof\san\n\n\s\s\s\soverhead\sthat\swould\splace\son\sthe\sinterpreter.\n\n\s\s\s\s\n\n\s\s\s\s\n\n\s\s\s\s\n\n\s\s\s\sI\shave\squickly\slooked\sat\sthe\ssource\scode\sfor\sTcl\s8.2,\sand\sthis\sseems\sto\n\n\s\s\s\suse\sexactly\sthe\ssame\scode\sas\sTcl\s8.1.1\n\n\s\s\s\s\n\n\s\s\s\s\n\n\s\s\s\sHave\syou\sgot\sany\ssuggestions?\n\n\n\nDesiredBehavior:\n\nI\sexpect\sit\snot\sto\score\sdump\s:)\n\n\n\n\n\nFixed\sproblem\sin\stclCompile.c\swith\snull\ssmashing\s(10/20/1999).\s\n--\s10/21/1999\shobbs
J foundin final:\s8.1.1
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 10.\sObjects
J title Crashing\swhen\sdeleting\sthe\sglobal\sliteral\stable
J type Bug
K 218866ffffffffffffffffffffffffffffffffff
U nobody
Z 3e982d705dff99120e92fe4c88917ba5