Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2004-06-24
15:18 • Closed ticket [976496ffff]: complex Tcl/Tk apps run out of TLS indexes on Win32.... artifact: 4339faf2f6 user: mistachkin
03:35 • Add attachment 976496.patch to ticket [976496ffff] artifact: 554824931d user: dgp
03:35 • Ticket [976496ffff] complex Tcl/Tk apps run out of TLS indexes on Win32... s... artifact: 3fefae8b06 user: dgp
00:13 • Ticket [976496ffff]: 5 changes artifact: 9db3332e0b user: kennykb
2004-06-23
05:07 • Add attachment threadStorage5.zip to ticket [976496ffffffffff|976496fff... artifact: 1f26b4a4f9 user: mistachkin
05:07 • Ticket [976496ffff] complex Tcl/Tk apps run out of TLS indexes on Win32... s... artifact: d18d29196f user: mistachkin
05:07 • Ticket [976496ffff]: 4 changes artifact: 42a06f01d4 user: mistachkin
05:06 • Ticket [976496ffff]: 4 changes artifact: 58b172498e user: mistachkin
03:40 • Ticket [976496ffff]: 4 changes artifact: 8accdc755e user: dgp
03:12 • Ticket [976496ffff]: 4 changes artifact: 870989013e user: mistachkin
02:37 • Ticket [976496ffff]: 4 changes artifact: b16cc55baf user: mistachkin
02:36 • Ticket [976496ffff]: 4 changes artifact: 8925917792 user: dgp
2004-06-22
21:29 • Ticket [976496ffff]: 4 changes artifact: 045c5fa71b user: dgp
20:58 • Ticket [976496ffff]: 4 changes artifact: 79d4f5f231 user: dgp
20:58 • Ticket [976496ffff]: 4 changes artifact: c27feb9a8c user: dgp
17:00 • Ticket [976496ffff]: 4 changes artifact: 8222b7c4f3 user: mistachkin
17:00 • Ticket [976496ffff]: 4 changes artifact: 78fcfeff40 user: mistachkin
16:01 • Ticket [976496ffff]: 4 changes artifact: aa61de5abc user: mistachkin
06:54 • Ticket [976496ffff]: 4 changes artifact: 85bb3d1938 user: mistachkin
06:51 • Ticket [976496ffff]: 4 changes artifact: f8f0139f8c user: mistachkin
06:49 • Ticket [976496ffff]: 4 changes artifact: 52e7f04213 user: mistachkin
04:49 • Ticket [976496ffff]: 4 changes artifact: 8deb28c998 user: dgp
04:01 • Ticket [976496ffff]: 4 changes artifact: f79c89de23 user: mistachkin
04:01 • Ticket [976496ffff]: 4 changes artifact: 3570134eef user: mistachkin
2004-06-21
20:08 • Ticket [976496ffff]: 5 changes artifact: 9e198f18fa user: dkf
15:58 • Ticket [976496ffff]: 1 change artifact: 1373b70418 user: dkf
15:57 • Ticket [976496ffff]: 2 changes artifact: cc4886adcf user: dkf
10:14 • Ticket [976496ffff]: 4 changes artifact: 36d063227c user: mistachkin
03:14 • New ticket [976496ffff]. artifact: 824e69334c user: mistachkin

complex Tcl/Tk apps run out of TLS indexes on Win32...

Closed / Accepted976496ffffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2004-06-21 03:14:13
Runaway usage of TLS indexes causes some operating 
systems to fail to load complex Tcl/Tk applications when 
threads are enabled.

The attached patch "fixes" the problem and successfully 
completes "make test" without any new test failures.

However, since the attached patch is non-trivial, I 
would like as many people as possible to review it before 
it is committed to HEAD.

The "tclThreadStorage.c" file should be placed in 
the "generic" directory.

I would also like some help changing the various make 
related files to include a new compile time 
option "USE_THREAD_STORAGE" which would enable the 
new generic "Thread Storage" subsystem instead of 
using pthreads on Unix and TLS on Win32.

Thanks.
mistachkinplain2004-06-21 10:14:13
File Added - 91318: threadStorage.zip
dkf Ticket [976496ffff]: 2 changes [History diff]2004-06-21 15:57:58
dkf Ticket [976496ffff]: 1 change [History diff]2004-06-21 15:58:48
dkfplain2004-06-21 20:08:04
Logged In: YES 
user_id=79902

OK, here are some issues I've spotted.

 * Don't forget to alter the other Makefiles too. :^)

 * Perhaps the right thing to do would be to #def the
TclpThreadData* functions as TclThreadStorage* functions?

 * You don't need STORAGE_LOCK and STORAGE_UNLOCK, and it is
better to use function calls for that instead of macros.

 * TclThreadStorageLockInit unfinished?

 * panic() should be Tcl_Panic()

Alas, I only have limited expertise at evaluating the
semantic content of this alteration.  Assigning to someone
who might know more than me... :^)
mistachkinplain2004-06-22 04:01:46
Logged In: YES 
user_id=113501

Patch updated.

* Modified the unix "Makefile.in" and "tcl.m4".

* Modified "tclThread.c" to call the new thread storage 
functions if USE_THREAD_STORAGE is defined.

* Removed STORAGE_LOCK and STORAGE_UNLOCK defines 
from "tclThreadStorage.c".

* TclThreadStorageLockInit is fine.

* Changed "panic" calls to "Tcl_Panic".
mistachkinplain2004-06-22 04:01:47
File Added - 91421: threadStorage2.zip
dgpplain2004-06-22 04:49:09
File Added - 91427: 976496.patch

Logged In: YES 
user_id=80530

Here are the same changes
packaged as a single patch
file.

Patch itself doesn't quite
work for me.  Without --enable-threads,
there's a link error; with --enable-threads,
tcltest hangs on startup during `make test`
mistachkinplain2004-06-22 06:49:11
File Deleted - 91421:
mistachkinplain2004-06-22 06:51:28
File Added - 91438: threadStorage3.zip

Logged In: YES 
user_id=113501


This new patch should fix the previous problems.
mistachkinplain2004-06-22 06:54:12
Logged In: YES 
user_id=113501


Oh, can somebody please update the Mac OS X files that 
need to be changed to add the "tclThreadStorage.c" file, like 
the ".project" file, I believe?
mistachkinplain2004-06-22 16:01:43
File Deleted - 91438:
mistachkinplain2004-06-22 17:00:10
Logged In: YES 
user_id=113501

Patch updated with various tweaks and performance 
enhancements.

Tested successfully on Windows NT 4 and FreeBSD 4.10-
STABLE.

Needs testing on Windows 98, Windows 2000, Solaris, Linux, 
OpenBSD, Mac OS X (also see previous note about Mac OS X 
below), some 64-bit platforms, and whatever other random 
platforms are out there.

DGP: Could you delete your patch below and recreate it if you 
would?
mistachkinplain2004-06-22 17:00:13
File Added - 91488: threadStorage4.zip
dgpplain2004-06-22 20:58:37
Logged In: YES 
user_id=80530

deleted.  will produce
another after some testing.
dgpplain2004-06-22 20:58:38
File Deleted - 91427:
dgpplain2004-06-22 21:29:26
File Added - 91517: 976496.patch

Logged In: YES 
user_id=80530


Here's the patch as a
single unidiff patch file.

With this patch I see
processes hang at
the end of their run.  Perhaps
some Mutex error during
finalization?
dgpplain2004-06-23 02:36:34
File Deleted - 91517: 



File Added - 91548: 976496.patch

Logged In: YES 
user_id=80530

Updated patch file 976496.patch
corrects the hang.
mistachkinplain2004-06-23 02:37:20
File Deleted - 91488:
mistachkinplain2004-06-23 03:12:27
File Added - 91550: threadStorage5.zip

Logged In: YES 
user_id=113501


New patch, fixes dgp's hang and cosmetic fixes.
dgpplain2004-06-23 03:40:35
File Deleted - 91548: 



File Added - 91554: 976496.patch
mistachkinplain2004-06-23 05:06:36
File Deleted - 91550:
mistachkinplain2004-06-23 05:07:33
Logged In: YES 
user_id=113501

Patch updated, fixes non-threaded warnings on Win32 with 
VC++.
mistachkinplain2004-06-23 05:07:34
File Added - 91562: threadStorage5.zip
kennykbplain2004-06-24 00:13:05
Logged In: YES 
user_id=99768

Tested the version of threadStorage5.zip uploaded on
2004-06-22 18:07, using configure/make on Windows in
all combinations of:

{mingw, vc++}

{enable-threads and without}

{--enable-symbols and --enable-symbols=mem}

No new compilation errors/warnings nor test failures.
dgpplain2004-06-24 03:35:43
File Deleted - 91554: 



File Added - 91692: 976496.patch

Logged In: YES 
user_id=80530

976496.patch updated to 
match the new threadStorage5.zip

Applies, compiles, and tests with
no new failures, both with and
without --enable-threads on both
Solaris and Linux/Alpha (64-bit).

I'd say it's ready to commit.
mistachkin Closed ticket [976496ffff]. [History diff]2004-06-24 15:18:54
Log in (anonymous is fine) to add a comment.

Attachments: