Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

coredump using tcl-thread

94 views
Skip to first unread message

Andreas Otto

unread,
Dec 29, 2019, 1:47:22 PM12/29/19
to
Hi, I just receive a CORE Dump in tcl "thread" code

Thread code:
>>>>>>>>>>>>>>>>>>>>>>>>
foreach _F $argv {
thread::create "
[setupVar LLabel _F PROJECT_SRC PROJECT_BUILD PWD YEAR WRITE FORCE VERBOSE VVERBOSE FIX PRINT]

source $wrk
"
}
<<<<<<<<<<<<<<<<<<<<<<<<<

the code start for every file in "argv" a thread job to update the file data.
all the "work" code is in the a worker file at "wrk". The "environment is set by variables "LLabel _F PROJECT_SRC..." using the "setupVar" proc in the script "..." argument of "thread::create".


Thread 2 "tclsh8.6" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff6a4a700 (LWP 9916)]
0x00007ffff7b6aa92 in TclpThreadGetMasterTSD (tsdKeyPtr=0x0) at PATH/tcl-latest/unix/tclUnixThrd.c:813
813 return pthread_getspecific(*ptkeyPtr);
Missing separate debuginfos, use: zypper install libz1-debuginfo-1.2.11-lp151.5.3.1.x86_64
(gdb) bt
#0 0x00007ffff7b6aa92 in TclpThreadGetMasterTSD (tsdKeyPtr=0x0) at PATH/tcl-latest/unix/tclUnixThrd.c:813
#1 0x00007ffff7b42bd1 in TclThreadStorageKeyGet (dataKeyPtr=0x7ffff7dd64c8 <dataKey>) at PATH/tcl-latest/generic/tclThreadStorage.c:192
#2 0x00007ffff7b424e8 in Tcl_GetThreadData (keyPtr=0x7ffff7dd64c8 <dataKey>, size=8) at PATH/tcl-latest/generic/tclThread.c:87
#3 0x00007ffff7b1b6dd in TclFreeObj (objPtr=0x7ffff005bb60) at PATH/tcl-latest/generic/tclObj.c:1494
#4 0x00007ffff7b57a98 in ObjFindNamespaceVar (interp=0x7ffff0001050, namePtr=0x7ffff004c6c0, contextNsPtr=0x7ffff0001a10, flags=262145) at PATH/tcl-latest/generic/tclVar.c:5759
#5 0x00007ffff7b51011 in TclLookupSimpleVar (interp=0x7ffff0001050, varNamePtr=0x7ffff004c6c0, flags=513, create=1, errMsgPtr=0x7ffff6a493d8, indexPtr=0x7ffff6a493e4) at PATH/tcl-latest/generic/tclVar.c:935
#6 0x00007ffff7b50a60 in TclObjLookupVarEx (interp=0x7ffff0001050, part1Ptr=0x7ffff004c6c0, part2Ptr=0x0, flags=514, msg=0x7ffff7b94bdb "access", createPart1=1, createPart2=1, arrayPtrPtr=0x7ffff6a495d0)
at PATH/tcl-latest/generic/tclVar.c:713
#7 0x00007ffff7abab1e in TEBCresume (data=0x7ffff006d598, interp=0x7ffff0001050, result=0) at PATH/tcl-latest/generic/tclExecute.c:4427
#8 0x00007ffff79dd052 in TclNRRunCallbacks (interp=0x7ffff0001050, result=0, rootPtr=0x0) at PATH/tcl-latest/generic/tclBasic.c:4461
#9 0x00007ffff79dc925 in Tcl_EvalObjv (interp=0x7ffff0001050, objc=2, objv=0x7ffff0041050, flags=2097168) at PATH/tcl-latest/generic/tclBasic.c:4189
#10 0x00007ffff79ded68 in TclEvalEx (interp=0x7ffff0001050,
script=0x7ffff004d1c0 "\n set LLabel {{%PREFIX% \\file ......
outerScript=0x7ffff004d1c0 "\n set LLabel {{%PREFIX% \\file .....
#11 0x00007ffff79de113 in Tcl_EvalEx (interp=0x7ffff0001050,
script=0x7ffff004d1c0 "\n set LLabel {{%PREFIX% \\file .....


mfg ao.

js

unread,
Dec 29, 2019, 5:36:34 PM12/29/19
to
On 12/29/19 1:47 PM, Andreas Otto wrote:
> Hi, I just receive a CORE Dump in tcl "thread" code
>
> Thread code:
>>>>>>>>>>>>>>>>>>>>>>>>>
> foreach _F $argv {
> thread::create "
> [setupVar LLabel _F PROJECT_SRC PROJECT_BUILD PWD YEAR WRITE FORCE VERBOSE VVERBOSE FIX PRINT]
>
> source $wrk
> "
> }
> <<<<<<<<<<<<<<<<<<<<<<<<<
>
> the code start for every file in "argv" a thread job to update the file data.
> all the "work" code is in the a worker file at "wrk". The "environment is set by variables "LLabel _F PROJECT_SRC..." using the "setupVar" proc in the script "..." argument of "thread::create".
>
>

I have used threads a lot lately and I have found that it core dumps way
more frequently than normal Tcl. However, I have also found that that
was all due to the programmer's error.

That said, from looking at your code and reading your description, it is
likely that your thread initialization script is not doing what you may
think it is doing. You are sending it the *result* of [setUpVar]
invoked in the main thread. Try this syntax:

foreach _F $argv {
set tid [thread::create {thread::wait}]
thread::send $tid {setUpVar LLabel _F PROJECT_SRC PROJECT_BUILD PWD
YEAR WRITE FORCE VERBOSE VVERBOSE FIX PRINT}

thread::send $tid $wrk

# and may be start things off if $wrk is not doing it already
thread::send $tid start_working
}



js

unread,
Dec 29, 2019, 6:01:22 PM12/29/19
to
On 12/29/19 5:36 PM, js wrote:
> On 12/29/19 1:47 PM, Andreas Otto wrote:
>> Hi, I just receive a CORE Dump in tcl "thread" code
>>
>
> foreach _F $argv {
>   set tid [thread::create {thread::wait}]
>    thread::send $tid {setUpVar LLabel _F PROJECT_SRC PROJECT_BUILD PWD
> YEAR WRITE FORCE VERBOSE VVERBOSE FIX PRINT}
>
>    thread::send $tid $wrk
>
>     # and may be start things off if $wrk is not doing it already
>     thread::send $tid start_working
> }
>

Also note that the proc "setUpVar" does not exist in the thread. You
need to create it in the thread prior to using it. Or, if it is just a
bunch of "set x .." statements, you can do this:

thread::send $tid {set LLabel ...}
...

and so on.



Andreas Otto

unread,
Dec 30, 2019, 3:18:53 AM12/30/19
to

> Also note that the proc "setUpVar" does not exist in the thread. You
> need to create it in the thread prior to using it. Or, if it is just a
> bunch of "set x .." statements, you can do this:
>
> thread::send $tid {set LLabel ...}
> ...
>
> and so on.

the "setUpVar" is a proc in the CALLIG code - the "thread::create" get the script via \"\" this mean "setUpVar" create valid TCL code placed in the thread-startup script.

but ok, I understand that the "thread-startup script" is not the place to start real work → I used this place to do all the job work.

mfg ao
"
0 new messages