Overview
| Artifact ID: | 326bbff738ed08de67f634c4f2369b10cee26fae |
|---|---|
| Ticket: | 7d83d2193d6da63f5ba269bb9e3132074ef8212c
Standard channel restrictions apply to first channels opened in a new thread on Windows |
| User & Date: | anonymous on 2014-09-25 14:46:19 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
The absence of standard channels (see ticket 027ba061a8aac869441267c2aef4c4bf9c705c10) on new threads on Windows makes the tree first opened channels to be taken by the core as the standard ones, provoking spurious 'channel is shared' errors on [::thread::detach]. The context in which this issue appeared is a server where the server socket is started in a different thread. Upon connection, connection sockets are transferred to their own threads as well. The following script shows the issue: ~~~ package require Thread; # Print to standard error. proc putsargs {args} { puts stderr $args; }; # Set as error handler. ::thread::errorproc putsargs; # Store main thread id. ::tsv::set threads main [::thread::id]; # Create thread for accepting connections. ::tsv::set threads accept [::thread::create { # Forward logging to main thread. proc putsargs {args} { ::thread::send -async \ [::tsv::get threads main] \ [list ::putsargs {*}$args]; } interp bgerror {} ::putsargs; # Connection handlers. proc _Accept {sock ip port} { putsargs [info level 0]; ::after 0 [list Accept $sock $ip $port]; } proc Accept {sock ip port} { putsargs [info level 0]; ::thread::detach $sock; } set ssock [::socket -server _Accept 54321]; putsargs "Accepting connection on port 54321 (socket=${ssock})" ::thread::wait; }]; ::vwait forever; ~~~ As a workaround, the following snippet should be evaluated when spawning a new thread, so that subsequently opened channels are not taken to be the standard ones. ~~~ ::open nul r; # stdin ::open nul w; # stdout ::open nul w; # stderr ~~~ - foundin changed to: "2.7.0"
- is_private changed to: "0"
- login: "anonymous"
- priority changed to: "5 Medium"
- private_contact changed to: "219192cc5b7de6cef9c96726d1feb29d0382f2dc"
- resolution changed to: "None"
- severity changed to: "Critical"
- status changed to: "Open"
- submitter changed to: "anonymous"
- subsystem changed to: "80. Thread Package"
- title changed to:
Standard channel restrictions apply to first channels opened in a new thread on Windows
- type changed to: "Bug"