<i>TclpCheckStackSpace() fails on recent linux system</i> status still Open with 4 other changes
by
.
D 2007-01-22T14:51:09
J icomment Logged\sIn:\sYES\s\nuser_id=139606\nOriginator:\sYES\n\nThis\stest\sprogram\sreports\sstack\ssize\scorrectly\sso\sthis\sworks.\sIn\stcl\spthread_getattr_np(pthread_self(),\s&threadAttr)\sfills\sthreadAttr\swith\scrap.\sI\scan\seasily\sreproduce\sthat\sby\scalling\spthread_getattr_np\sNOT\sfrom\sthread.\n\nLet's\sstrace\stclsh:\n\n[root@db01new\sbin]#\sstrace\s-o\sWYNIK\s-f\s-F\s-s\s200\s./tclsh8.5\nxyz\s46955385561024\nthread\sstack\ssize\sis\s93782034972672.\n%\sexit\n\nand\snow\ssee\swhat\sit\sdid:\n[root@db01new\sbin]#\sgrep\s-E\s"(clone|thread\sstack\ssize)"\sWYNIK\n13270\sclone(child_stack=0x40200270,\sflags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|CLONE_DETACHED,\sparent_tidptr=0x402009f0,\stls=0x40200960,\schild_tidptr=0x402009f0)\s=\s13271\n13270\swrite(1,\s"thread\sstack\ssize\sis\s93782034972672.\\n",\s37)\s=\s37\n\nFor\sme\sit\slooks\slike\smain\sprocess\s13270\scalled\spthread_create()\swhich\screated\sthread\swith\spid\s13271\sand\slater\scalled\spthread_getattr_np()\sfrom\smain\sprocess\sinstead\sof\sfrom\snewly\screated\sthread...\swhich\sleads\sto\scrap\sbeing\sfilled,\sright?\n\n[root@db01new\s~]#\sulimit\s-a\ntime(cpu-seconds)\s\s\s\sunlimited\nfile(blocks)\s\s\s\s\s\s\s\s\sunlimited\ncoredump(blocks)\s\s\s\s\s0\ndata(kbytes)\s\s\s\s\s\s\s\s\sunlimited\nstack(kbytes)\s\s\s\s\s\s\s\sunlimited\nlockedmem(kbytes)\s\s\s\s32\nmemory(kbytes)\s\s\s\s\s\s\sunlimited\nnofiles(descriptors)\s1024\nprocesses\s\s\s\s\s\s\s\s\s\s\s\sunlimited\nvmemory(kbytes)\s\s\s\s\s\sunlimited\nflocks\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sunlimited\n[root@db01new\s~]#\s./a.out\nxyz\s1075841376\nthread\sstack\ssize\sis\s2101248.\n\n\n\n#define\s_GNU_SOURCE=1\n\n#include\s<stdio.h>\n#include\s<pthread.h>\n#include\s<sys/time.h>\n#include\s<sys/resource.h>\n\nvoid\s*testme(void\s*threadid)\s{\n\s\s\s\s\s\s\s\ssize_t\sstackSize\s=\s0;\n\s\s\s\s\s\s\s\spthread_attr_t\sthreadAttr;\n\n\s\s\s\s\s\s\s\sprintf("xyz\s%ld\\n",\spthread_self());\n\n\s\s\s\s\s\s\s\sif\s(pthread_getattr_np(pthread_self(),\s&threadAttr)\s!=\s0)\s{\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\spthread_attr_destroy(&threadAttr);\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\spthread_exit(NULL);\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sreturn\sNULL;\n\s\s\s\s\s\s\s\s}\n\n\s\s\s\s\s\s\s\sif\s(pthread_attr_getstacksize(&threadAttr,\s&stackSize)\s!=\s0)\s{\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\spthread_attr_destroy(&threadAttr);\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\spthread_exit(NULL);\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sreturn\sNULL;\n\s\s\s\s\s\s\s\s}\n\n\s\s\s\s\s\s\s\sprintf("thread\sstack\ssize\sis\s%Zu.\\n",\sstackSize);\n\n\s\s\s\s\s\s\s\spthread_attr_destroy(&threadAttr);\n\n\s\s\s\s\s\s\s\spthread_exit(NULL);\n}\n\nint\smain()\s{\n\s\s\s\s\s\s\s\sint\src;\n\s\s\s\s\s\s\s\slong\st;\n\s\s\s\s\s\s\s\spthread_t\sthr;\n\n\s\s\s\s\s\s\s\sstruct\srlimit\sr;\n\n\s\s\s\s\s\s\s\sr.rlim_cur\s=\sRLIM_INFINITY;\n\s\s\s\s\s\s\s\sr.rlim_max\s=\sRLIM_INFINITY;\n\n\s\s\s\s\s\s\s\src\s=\ssetrlimit(RLIMIT_STACK,\s&r);\n\s\s\s\s\s\s\s\sif\s(rc)\s{\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sprintf("ERROR;\ssetrlimit\sfailed\s%d\\n",\src);\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sreturn\s-1;\n\s\s\s\s\s\s\s\s}\n\n\s\s\s\s\s\s\s\src\s=\spthread_create(&thr,\sNULL,\stestme,\s(void\s*)t);\n\s\s\s\s\s\s\s\sif\s(rc){\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sprintf("ERROR;\sreturn\scode\sfrom\spthread_create()\sis\s%d\\n",\src);\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sreturn\s-1;\n\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\spthread_exit(NULL);\n\n\s\s\s\s\s\s\s\sreturn\s0;\n}\n\n\n\nps,\sfrom\snptl\sheaders:\n/*\sInitialize\sthread\sattribute\s*ATTR\swith\sattributes\scorresponding\sto\sthe\n\s\s\salready\srunning\sthread\sTH.\s\sIt\sshall\sbe\scalled\son\sunitialized\sATTR\n\s\s\sand\sdestroyed\swith\spthread_attr_destroy\swhen\sno\slonger\sneeded.\s\s*/\nextern\sint\spthread_getattr_np\s(pthread_t\s__th,\spthread_attr_t\s*__attr)\n\s\s\s\s\s__THROW\s__nonnull\s((2));\n\nwhile\scurrently\stcl\sinitializes\spthread_attr_t\sprior\sto\scalling\spthread_getattr_np.\s\n
J login arekm
J mimetype text/plain
J username arekm
K 1618411fffffffffffffffffffffffffffffffff
U arekm
Z 827641c231303668bce83986354add52