Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2003-05-14
06:00 • Closed ticket [710642ffff]: Thread-unsafe handling of cwdPathPtr plus 7 othe... artifact: 5427546c70 user: hobbs
2003-05-13
21:24 • Ticket [710642ffff]: 6 changes artifact: bd195821e8 user: vincentdarley
2003-05-11
08:23 • Add attachment tclIOUtil.c.patch.710642 to ticket [710642ffffffffff|710... artifact: f9d3346acf user: hobbs
08:23 • Ticket [710642ffff] Thread-unsafe handling of cwdPathPtr status still Open w... artifact: 529a0edd5c user: hobbs
2003-04-11
23:35 • Ticket [710642ffff]: 4 changes artifact: b60afc9803 user: vincentdarley
2003-04-02
16:11 • Add attachment tclIOUtil.c.diff to ticket [710642ffff] artifact: 3a34eee33f user: vasiljevic
16:11 • Ticket [710642ffff] Thread-unsafe handling of cwdPathPtr status still Open w... artifact: 0d358f57d5 user: vasiljevic
16:10 • Ticket [710642ffff]: 4 changes artifact: 439520c971 user: vasiljevic
2003-04-01
00:35 • Ticket [710642ffff]: 4 changes artifact: 952c42b5c0 user: vincentdarley
2003-03-28
23:28 • Add attachment tclIOUtil.c to ticket [710642ffff] artifact: 7c5c55acf1 user: vasiljevic
23:28 • Ticket [710642ffff] Thread-unsafe handling of cwdPathPtr status still Open w... artifact: 3980bdaf41 user: vasiljevic
2003-03-27
10:27 • New ticket [710642ffff]. artifact: 8a66cdb9fb user: vasiljevic

Thread-unsafe handling of cwdPathPtr

Closed / Fixed710642ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2003-03-27 10:27:22
The new pluggable filesystem code located in
generic/tclIOUtils.c naively plays with global
Tcl_Obj*, passing them between threads
per-reference and neglecting the proper locks
for all except write operations. 
The spot in question is the global Tcl_Obj *cwdPathPtr.

The net-effect is that paths passed to the OS-calls 
gets garbled, memory is being trashed leading to
process exitus and whole bunch of other ugly things
is happening.

I think this has to be entirely revised, as one can not
simply share Tcl_Objs between threads. One has to 
always make a deep-copy (w/o internal references) 
of the object before passing it to some other thread.

I have some ideas on how to solve this, but it is 
really not that straight-forward, since few of design
issues have to be modified.

This bug is really a show-stopper for MT-apps
therefore the highest priority.
vasiljevicplain2003-03-28 23:28:02
File Added - 46156: tclIOUtil.c

Logged In: YES 
user_id=95086

Here is my reworked version which uses char* to
hold the cwd. I know it is not 100% good because
a path may contain NULL chars. We might improve this
and store char* and its length. The Tcl_Obj is really 
not usable in MT-environments since it can't be 
deep-copied
with the current duplicate function (i mean path objects).
Anyways, the entire file is attached.
vincentdarleyplain2003-04-01 00:35:41
Logged In: YES 
user_id=32170

Can you provide a unified diff (diff -u) for easier 
analysis, please?
vasiljevicplain2003-04-02 16:10:51
Logged In: YES 
user_id=95086

Sure. It is attached. I did the diff against the 8.4.2 version.
Note that I've used some pretty conservative locks in 
Tcl_FSGetCwd and Tcl_FSChdir. This may be relaxed
eventually.
vasiljevicplain2003-04-02 16:11:44
File Added - 46565: tclIOUtil.c.diff
vincentdarleyplain2003-04-11 23:35:49
Logged In: YES 
user_id=32170

I'll be looking into this soon, now I've resolved the 
various other bugs I was working on.  Your code looks 
like a good template, but I'd like to remove the need 
for 'inner' functions.
hobbsplain2003-05-11 08:23:25
File Added - 50090: tclIOUtil.c.patch.710642

Logged In: YES 
user_id=72656

I've attached Zoran's latest version (with one minor change to 
init char *str) and commited that to core-8-4-branch.  We 
need a version for the HEAD.  It would also be nice to have 
some sort of tests that exercise this (if possible).
vincentdarleyplain2003-05-13 21:24:48
Logged In: YES 
user_id=32170

Zoran says this should also apply to cvs head.
hobbsplain2003-05-14 06:00:25
Logged In: YES 
user_id=72656

Applied to head with offsets.
Log in (anonymous is fine) to add a comment.

Attachments: