Overview
| Artifact ID: | 08d87ed52b32421efe512d8d4734cf6321e2119ab40419bb4eeafa659140e3ac |
|---|---|
| Ticket: | 87b69745be15c2816574ec415dfe2c3c407cc5d6
interp creation resets encoding directory search path |
| User & Date: | sebres on 2025-08-13 18:26:22 |
Changes
- icomment:
> Tcl mutexes are recursive as far as I can tell. Yes, as already confirmed in the core mailing list, you are right and this is indeed reentrant now (changed in 8.7+ after TIP#509). > I do not like the comparison of systemEncoding outside of holding the mutex. And if it is compared by locked mutex what would it change?<br/> The issue is, as already said, just a conceptual bug and simply a timing thing and may happen with and without lock. In particular of mentioned code, mutex outside of the comparison changes absolutely nothing and in best case may only avoid some unneeded epoch change, however only if system encoding changes continuously across several threads. But then, as already said, you'd have completely different issues (ending with SF). The only solution would be something like I provided in [f2ff05fc84], or system encoding stored per thread (TSV). > Globals shared between threads should be accessed under a lock even when reading. No. In this particular comparison it doesn't change something, since it is only protection against increase of FS epoch and function simply returns if it is equal now. Few nanoseconds later or earlier it may be different (no matter with or without lock). With already mentioned consequences. Feel free to revert it (mark may change as mistake branch and reset tags to previous commit), if you don't like it. But I guess in case of possible race condition, you overestimate the lock protection here and underestimate the consequences of conceptual bug (the issue by "wrong" design - thread-safety of the system encoding).
- login: "sebres"
- mimetype: "text/x-markdown"