.
D 2000-10-26T00:44:36
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s1653\sBug\nVersion:\s8.1b2\nSubmitDate:\s'1999-03-29'\nLastModified:\s'1999-10-21'\nSeverity:\sCRIT\nStatus:\sClosed\nSubmitter:\spat\nChangedBy:\shobbs\nRelatedBugIDs:\s607\nOS:\sAIX\nFixedDate:\s'2000-10-25'\nFixedInVersion:\sNA\nClosedDate:\s'1999-10-21'\n\n\nName:\s\sColin\sMacleod\nemail:\s\[email protected]\nSupport:\s\sNone\nSeverity:\s\s1\nOperatingSystem:\s\sAIX\nOperatingSystemVersion:\s\s4.3.2,\srunning\son\sa\s2-processor\sRS/6000\nExtensions:\s\snone\shere\nCustomShell:\s\snone\sin\sthis\scase\nSynopsis:\s\sThreaded\sTcl\scalls\snon-thread-safe\slibrary\sfunctions\n\nReproducibleScript:\n\s\s\s\sEven\swhen\sbuilt\swith\s--enable-threads,\sTcl\scalls\snon-thread-safe\slibrary\n\s\s\s\sfunctions.\s\sAs\san\sexample\sI\stake\sthe\sgetpwnam\sroutine,\sbut\sthis\sis\snot\n\s\s\s\sthe\sonly\sone\sconcerned.\n\s\s\s\s\n\s\s\s\sEg.\sI\sbuilt\stcl8.1b2\son\sAIX4.3.2\swith\s--enable-threads\sand\salso\n\s\s\s\scompiled\stcltest\sto\sbe\sable\sto\stest\sthread-related\sfunctionality.\n\s\s\s\sI\screated\sthe\sfollowing\sscript,\ssaved\sin\sfile\s"z"\s:\n\s\s\s\s\n\s\s\s\s####################################################################\n\s\s\s\s#\sfirst\sa\sprocedure\swhich\srepeatedly\sfind\sa\suser's\shome\sdirectory\n\s\s\s\s#\sand\scomplains\sif\sit\schanges.\s\sI\sput\sthis\sdefinition\sin\sa\svariable\n\s\s\s\s#\sto\sbe\sable\sto\spass\sit\sto\sanother\sthread\seasily.\n\s\s\s\s\n\s\s\s\sset\sdefproc\s{\n\s\s\s\sproc\scheckuser\suser\s{\n\s\s\s\s\s\sset\sh0\s[glob\s~$user]\n\s\s\s\s\s\stime\s{\n\s\s\s\s\s\s\s\sset\sh\s[glob\s~$user]\n\s\s\s\s\s\s\s\sif\s{\s[string\scompare\s$h\s$h0]\s}\s{\n\s\s\s\s\s\s\s\s\s\serror\s"$h\s!=\s$h0"\n\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s}\s100\n\s\s\s\s\s\sputs\s"thread\s[testthread\sid]\sfinished\s($h\s$h0)"\n\s\s\s\s}\n\s\s\s\s}\n\s\s\s\s\n\s\s\s\s#\sNow\screate\ssome\sthreads,\seach\sof\swhich\srepeatedly\schecks\sthe\shome\n\s\s\s\s#\sdirectory\sof\sone\suser.\s\sThe\slist\sof\susers\sis\sonly\svalid\sfor\sour\n\s\s\s\s#\ssystem,\sof\scourse.\s\sTo\srepeat\sthis\stest\selsewhere,\ssubstitute\n\s\s\s\s#\sa\slist\sof\susers\sfor\sthe\ssystem\sused.\n\s\s\s\s\n\s\s\s\sforeach\suser\s{\n\s\s\s\s\s\sabal\s\s\s\s\s\s\s\s\sdbik\s\s\s\s\s\s\s\s\simnadm\s\s\s\s\s\s\smmeg\s\s\s\s\s\s\s\s\sote\s\s\s\s\s\s\s\s\s\sroot\n\s\s\s\s\s\saded\s\s\s\s\s\s\s\s\sddim\s\s\s\s\s\s\s\s\sisoft\s\s\s\s\s\s\s\smpap\s\s\s\s\s\s\s\s\spfou\s\s\s\s\s\s\s\s\ssmpr\n\s\s\s\s}\s{\n\s\s\s\s\s\stestthread\screate\s"$defproc;\scheckuser\s$user"\n\s\s\s\s}\n\s\s\s\s#######################################################################\n\s\s\s\s\n\s\s\s\sI\sran\sthis\srepeatedly\sas:\s./tcltest\sz\n\s\s\s\sI\salso\svaried\sthe\srepeat\scount\sin\sthe\stime\sstatement\s(100\sabove).\n\s\s\s\s\n\nObservedBehavior:\n\s\s\s\sSince\sthe\sbehaviour\sis\stiming-dependent,\sit\svaries\sbetween\sruns,\n\s\s\s\sand\swith\sthe\slength\sof\seach\srun.\s\sSometimes\sthe\sscript\scompletes\n\s\s\s\swithout\serrors,\ssometimes\sone\sor\smore\sof\sthe\stests\sfail,\ssometimes\n\s\s\s\syou\sget\sa\scrash\sand\score\sdump.\s\sWith\sthe\srepeat\scount\sat\s10,\sit\n\s\s\s\susually\scompletes\sok.\s\sAt\s30\srepetitions,\syou\susually\sget\sa\stest\n\s\s\s\sfailure\sbut\snot\sa\score\sdump.\s\sAt\s100,\syou\susually\sget\sa\score\sdump\n\s\s\s\salso.\n\s\s\s\s\n\s\s\s\sEg:\n\s\s\s\s\n\s\s\s\s$\s./tcltest\sz\n\s\s\s\sError\sfrom\sthread\s3856\n\s\s\s\s/home/dbik\s!=\s/home/abal\n\s\s\s\s\s\s\s\swhile\sexecuting\n\s\s\s\s"error\s"$h\s!=\s$h0""\n\s\s\s\s\s\s\s\sinvoked\sfrom\swithin\n\s\s\s\s"time\s{\n\s\s\s\s\s\s\s\sset\sh\s[glob\s~$user]\n\s\s\s\s\s\s\s\sif\s{\s[string\scompare\s$h\s$h0]\s}\s{\n\s\s\s\s\s\s\s\s\s\serror\s"$h\s!=\s$h0"\n\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s}\s100"\n\s\s\s\s\s\s\s\s(procedure\s"checkuser"\sline\s3)\n\s\s\s\s\s\s\s\sinvoked\sfrom\swithin\n\s\s\s\s"checkuser\sdbik"\n\s\s\s\sSegmentation\sfault(coredump)\n\s\s\s\s$\n\s\s\s\s\n\s\s\s\sInvoking\sdbx\sto\sget\sa\sstack\strace:\n\s\s\s\s$\sdbx\stcltest\score\n\s\s\s\sType\s'help'\sfor\shelp.\n\s\s\s\sreading\ssymbolic\sinformation\s...\n\s\s\s\s[using\smemory\simage\sin\score]\n\s\s\s\s\n\s\s\s\sSegmentation\sfault\sin\sfclose\sat\s0xd000f68c\s($t17)\n\s\s\s\s0xd000f68c\s(fclose+0x6c)\s807f001c\s\s\s\s\s\s\s\slwz\s\s\sr3,0x1c(r31)\n\s\s\s\s(dbx)\sfile\stclUnixFile.c\n\s\s\s\s(dbx)\sfile\stclFileName.c\n\s\s\s\s(dbx)\swhere\n\s\s\s\sfclose(??)\sat\s0xd000f68c\n\s\s\s\spw_close(??)\sat\s0xd006e284\n\s\s\s\sendpwent_r(??)\sat\s0xd006f460\n\s\s\s\sTclpGetUserHome(name\s=\s"imnadm",\sbufferPtr\s=\s0x20270368),\sline\s381\sin\n\s\s\s\s"tclUnixFi\n\s\s\s\sle.c"\n\s\s\s\sDoTildeSubst(interp\s=\s0x200d5f68,\suser\s=\s"imnadm",\sresultPtr\s=\n\s\s\s\s0x20270368),\sline\n\s\s\s\s\s1148\sin\s"tclFileName.c"\n\s\s\s\sunnamed\sblock\s$b202,\sline\s1321\sin\s"tclFileName.c"\n\s\s\s\sTclGlob(interp\s=\s0x200d5f68,\spattern\s=\s"~imnadm",\snoComplain\s=\s0),\sline\n\s\s\s\s1321\sin\n\s\s\s\s"tclFileName.c"\n\s\s\s\sTcl_GlobObjCmd(dummy\s=\s(nil),\sinterp\s=\s0x200d5f68,\sobjc\s=\s2,\sobjv\s=\n\s\s\s\s0x2027b048),\n\s\s\s\s\sline\s1214\sin\s"tclFileName.c"\n\s\s\s\sunnamed\sblock\s$b158,\sline\s843\sin\s"tclExecute.c"\n\s\s\s\sTclExecuteByteCode(0x200d5f68,\s0x200cdbd8),\sline\s843\sin\s"tclExecute.c"\n\s\s\s\sTcl_EvalObjEx(0x200d5f68,\s0x2027d728,\s0x0),\sline\s2719\sin\s"tclBasic.c"\n\s\s\s\sTcl_TimeObjCmd(0x0,\s0x200d5f68,\s0x3,\s0x2027b038),\sline\s1555\sin\n\s\s\s\s"tclCmdMZ.c"\n\s\s\s\sunnamed\sblock\s$b158,\sline\s843\sin\s"tclExecute.c"\n\s\s\s\sTclExecuteByteCode(0x200d5f68,\s0x2009c8d8),\sline\s843\sin\s"tclExecute.c"\n\s\s\s\sTcl_EvalObjEx(0x200d5f68,\s0x2027d710,\s0x0),\sline\s2719\sin\s"tclBasic.c"\n\s\s\s\sTclObjInterpProc(0x2009be98,\s0x200d5f68,\s0x2,\s0x20271c18),\sline\s995\sin\n\s\s\s\s"tclProc.\n\s\s\s\sc"\n\s\s\s\sEvalObjv(0x200d5f68,\s0x2,\s0x20271c18,\s0x200cc627,\s0x11,\s0x0),\sline\s917\n\s\s\s\sin\s"tclPa\n\s\s\s\srse.c"\n\s\s\s\sTcl_EvalEx(0x200d5f68,\s0x200cc558,\s0xe0,\s0x0),\sline\s1378\sin\s"tclParse.c"\n\s\s\s\sTcl_Eval(0x200d5f68,\s0x200cc558),\sline\s1485\sin\s"tclParse.c"\n\s\s\s\sNewThread()\sat\s0x100a89c8\n\s\s\s\s_pthread_body(??)\sat\s0xd06f01e8\n\s\s\s\s(dbx)\n\s\s\s\s\n\s\s\s\sBUT,\sthe\scrash\sis\snot\salways\sin\sthe\ssame\splace.\s\sIt\sis\susually\sinside\n\s\s\s\sthe\scall\sto\sendpwent_r,\ssometimes\sin\sa\scall\sto\sfree,\ssometimes\sother\n\s\s\s\splaces,\ssuggesting\sthat\smemory\shas\sbeen\scorrupted.\n\s\s\s\s\n\nDesiredBehavior:\n\s\s\s\sWith\sthis\stest,\sthe\susers'\sdirectories\sshould\snot\sappear\sto\schange,\n\s\s\s\sand\stcl\sshould\snot\scrash.\s\s\n\s\s\s\s\n\s\s\s\sThe\sproblem\sis\sthat\sthe\scode\swhich\sexpands\s~username\scalls\sgetpwnam\n\s\s\s\swhich\sis\snot\sthread-safe.\s\sIt\suses\sa\sstatic\sbuffer,\sso\ssometimes\n\s\s\s\sthreads\soverwrite\seach\sothers\sresults.\s\s\n\s\s\s\s\n\nPatch:\nno\spatch,\ssee\sbelow\n\nComments:\n\s\s\s\sSpecifically\sfor\sAIX,\sthe\sproblem\sillustrated\scan\sbe\sfixed\sby\schanging\n\s\s\s\sthe\scall\sof\sgetpwnam\sto\suse\sgetpwnam_r.\n\s\s\s\s\n\s\s\s\sBUT\sthis\sis\sjust\sone\sexample.\s\sThere\sare\sother\snon-thread-safe\slibrary\n\s\s\s\sroutines\sused,\seg.\slocaltime\sin\stclUnixTime.c\s.\s\sAlso\sfrom\sthe\slimited\n\s\s\s\sinvestigation\sI\shave\sdone\sI\sbelieve\sthe\sfixes\sneeded\svary\sbetween\n\s\s\s\splatforms,\n\s\s\s\sbecause\sthe\sthread-safe\s*_r\sroutines\sare\snot\swell\sstandardised.\s\n\s\s\s\sI\sdo\snot\shave\sthe\stime\sneeded\sto\sinvestigate\sand\sgenerate\sa\scomplete\n\s\s\s\sset\sof\sfixes.\n\s\s\s\s\n\s\s\s\sPS:\smy\semail\saddress\sis:\s\smacleod\s@\sintrasoft\s.\sgr\s(remove\sadded\sspaces)\n\s\s\s\s\nPosted\sTo\scomp.lang.tcl:\sPosted\sSuccessfully\n\nAdditional\scomments\son\s3/30/99\n\nThis\sis\sa\sfollow-up\sto\smy\sown\sbug\sreport.\n(Also\sposted\sto\scomp.lang.tcl)\n\nThe\sversion\sof\sX11\swhich\scomes\swith\sAIX4.3.2\sincludes\sa\sheader\nX11/Xos_r.h\swhich\sdefines\sthread-safe\swrappers\sfor\scommon\nthread-unsafe\slibrary\sroutines,\swith\sifdefs\sfor\svarious\ssystems.\nThis\sappears\sto\sbe\sfreely-reusable,\sand\smight\sbe\sa\suseful\nbasis\sfor\sa\sportable\sfix\sto\sthis\sproblem.\n\nThis\sstuff\sseems\sto\svary\sa\slot.\s\sEg.\son\sAIX4.3.2\sthe\sdocs\ssay\sthat\ngethostbyname\sis\sthread-safe,\sby\sgethostbyaddr\sis\snot.\s\sOn\sAIX4.1.5\nwhich\swe\salso\shave,\sboth\sare\sthread-unsafe.\n\n\nWe\sneed\sa\spatch\sto\sapply\sor\swe\sneed\sto\spurchase\san\sAIX\sbox.\sEither\sway,\shis\swill\snot\sbe\sdone\sintime\sfor\s8.1b3.\s\s04/06/1999\s14:34\s-\ssurles\s-\n\n
J foundin obsolete:\s8.1b2
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 49.\sThreading
J title Threaded\sTcl\scalls\snon-thread-safe\slibrary\sfunctions
J type Bug
K 217833ffffffffffffffffffffffffffffffffff
U nobody
Z f82766dd98d9655bd88b2254cdd2bd7a