|
2026-10-21
| ||
| 10:03 | • Closed ticket [17902c1882]: env(PATHEXT) not present plus 4 other changes artifact: 5dccdf3277 user: serhiy.storchaka | |
|
2019-03-07
| ||
| 08:38 | • Closed ticket [9471e6e304]: InitWinEnv not thread safe plus 6 other changes artifact: 1d76bffb00 user: jan.nijtmans | |
| 07:58 | Fix [9471e6e304]: InitWinEnv not thread safe check-in: e8d0d31e48 user: jan.nijtmans tags: core-8-6-branch | |
|
2019-02-12
| ||
| 13:42 | • Ticket [9471e6e304] InitWinEnv not thread safe status still Open with 3 othe... artifact: d45e812c57 user: jan.nijtmans | |
|
2018-12-16
| ||
| 09:21 | • Ticket [9471e6e304]: 3 changes artifact: 67017cf3d1 user: chw | |
|
2018-12-15
| ||
| 15:17 | • Ticket [9471e6e304]: 4 changes artifact: a21f34102c user: christian.nassau | |
|
2016-02-15
| ||
| 10:54 | • New ticket [9471e6e304]. artifact: 71f3079625 user: christian.nassau | |
| Ticket UUID: | 9471e6e3042c18f3c8403b7013ecdf104efb5b6d | ||
| Title: | InitWinEnv not thread safe | ||
| Type: | Bug | Created on: | 2016-02-15 10:54:11 |
| Submitter: | christian.nassau | Assigned to: | jan.nijtmans |
| Subsystem: | 08. Environment Variables | Severity: | Severe |
| Priority: | 6 | Last modified: | 2019-03-07 08:38:45 |
| Status: | Closed | Closed by: | jan.nijtmans |
| Resolution: | Fixed | Closed on: | 2019-03-07 08:38:45 |
| Version: | 8.6.3 | ||
| Description: | ||||
We're seeing the following error during the simultaneous creation of several Tcl interpreters on Windows:
Can't find a usable init.tcl in the following directories:
{D:\ourniceproject\tcl8.6}
D:/ourniceproject/tcl8.6/init.tcl: can't read "env(ComSpec)": no such element in array
can't read "env(ComSpec)": no such element in array
while executing
"set temp $env($p)"
(procedure "InitWinEnv" line 9)
invoked from within
"InitWinEnv"
...
The problem seems to be that two simultaneous calls to "InitWinEnv" both try to replace "env(ComSpec)" with "env(COMSPEC)". The relevant code section is
set temp $env($p)
unset env($p)
set env($u) $temp
The "unset env($p)" from the first thread here leads to the error in the second thread.
| ||||
| User Comments: | ||||
christian.nassau added on 2018-12-15 15:17:37:
Here is a fix; I have no idea where to submit this "officially".
Index: library/init.tcl
==================================================================
--- library/init.tcl
+++ library/init.tcl
@@ -96,13 +96,17 @@
set u [string toupper $p]
if {$u ne $p} {
switch -- $u {
COMSPEC -
PATH {
- set temp $env($p)
- unset env($p)
- set env($u) $temp
+ # need to catch access to env since it is a volatile
+ # array that can be changed by another thread
+ # (ticket [9471e6e3042c18f3c8403b7013ecdf104efb5b6d])
+ if {![catch {set temp $env($p)}]} {
+ unset -nocomplain env($p)
+ set env($u) $temp
+ }
trace add variable env($p) write \
[namespace code [list EnvTraceProc $p]]
trace add variable env($u) write \
[namespace code [list EnvTraceProc $p]]
}
chw added on 2018-12-16 09:21:33:
I believe the InitWinEnv in init.tcl can be completely left out when some WIN32 specific logic is added to tclEnv.c, as shown in https://www.androwish.org/index.html/artifact/94ec044a94ead074?ln=138-149 Eventually, as a by catch this doesn't have threading issues. jan.nijtmans added on 2019-03-07 08:38:45:
Should be fixed now in all branches. Thanks to Christian Werner for his fix proposal! | ||||
