Overview
| Artifact ID: | 10bed5da47981d97d10493b138da1b65040c522b |
|---|---|
| Ticket: | 932314ffffffffffffffffffffffffffffffffff
epoch safety in threads? |
| User & Date: | dgp on 2004-04-09 14:11:39 |
Changes
- assignee changed to: "vincentdarley"
- cmimetype changed to: "text/plain"
- comment changed to:
The interal rep of a "path" Tcl_Obj can remember things, like which filesystem has claimed it. Each "path" Tcl_Obj remembers a filesystemEpoch value, to help determine whether the cached information still agrees with the authoritative data structures. The epoch value checking done within tclPathObj.c always compares the filesystemEpoch value in the "path" to the tsdPtr->filesystemEpoch value, which characterizes the local thread's copy of the master filesystem data structures. That will keep the "path" values consistent with the thread's view of the filesystem state, I agree. However, the Tcl_FSRegister(), Tcl_FSUnregister(), and Tcl_FSMountsChanged() routines all directly manipulate the master per-process filesystem data. The per-thread cache of that data will be out of date until some routine in the thread calls FsGetFirstFilesystem() in tclIOUtil.c. It appears to me then, that the epoch checking of "path" values isn't really checking validity unless somehow threads are prompted to call FsGetFirstFilesystem() when the master data changes. As one example, consider Tcl_FSGetFilesystemForPath(). It calls TclFSEnsureEpochOk() which will check that the epoch within the "path" is the same as that of the thread's copy of the filesystem. If so, then the cached filesystem that claimed this "path" before is returned. Only later in Tcl_FSGFFP() is FsGetFirstFilesystem() called, so that it might be noticed that the filesystem return is invalid (perhaps now unregistered! or perhaps just mounting changes have changed the filesystem that has a valid claim) That particular example can probably be fixed by moving the FsGetFirstFilesystem() call before the TclFSEnsureEpochOk() call, but I'm also curious about the general issue of keeping per-thread caches in sync with the master data.
- foundin changed to: "obsolete: 8.5a2"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "dgp"
- subsystem changed to: "37. File System"
- title changed to: "epoch safety in threads?"
- type changed to: "Bug"