| Ticket UUID: | 5974ff814c697f0118bc739d35c88205b06f5e92 | ||
| Title: | Error in "test thread-5.2": joined detached thread does not always return error | ||
| Type: | Bug | Created on: | 2015-09-21 09:12:58 |
| Submitter: | anonymous | Assigned to: | jan.nijtmans |
| Subsystem: | 49. Threading | Severity: | Important |
| Priority: | 5 Medium | Last modified: | 2026-10-18 21:50:45 |
| Status: | Closed | Closed by: | jan.nijtmans |
| Resolution: | Fixed | Closed on: | 2026-10-18 21:50:45 |
| Version: | 8.6.18, 9.0.5, 9.1.0 | ||
| Description: | ||||
The test 5.2 in thread.test makes the assumption that joining a detached thread will return an error. As per the POSIX spec, calling pthread_join on a detached thread is undefined behavior. Currently, this test never finishes on musl libc. | ||||
| User Comments: | ||||
anonymous added on 2018-11-18 18:15:08:
Still the case in version 8.6.9 serhiy.storchaka added on 2026-10-14 19:49:47:
This is a bug in Tcl, not only in the test: on Unix Tcl_JoinThread() calls pthread_join() for any thread, also a detached one. With glibc, joining a detached thread that has already exited even "succeeds" (reproduced with 8.6.18, 9.0.5 and 9.1 using [testthread]). Proposed fix in branch unix-join-detached-thread: Tcl_JoinThread() only joins threads created joinable, and only once, as on Windows. Tests thread-5.3 to thread-5.5. jan.nijtmans added on 2026-10-18 21:50:45:
Fixed in [30d8ccce48|trunk], core-9-0-branch and core-8-6-branch Many thanks! | ||||
