Bug 243963

Summary: [libpas] FreeBSD displays a lot of warning when thread exits
Product: WebKit Reporter: Basuke Suzuki <Basuke.Suzuki>
Component: PlatformAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Basuke Suzuki 2022-08-15 16:59:51 PDT
> Thread 8807027e0 has exited with leftover thread-specific data after 4 destructor iterations
Comment 1 Basuke Suzuki 2022-08-15 17:08:00 PDT
The reason might be here:

https://github.com/WebKit/WebKit/blob/main/Source/bmalloc/libpas/src/libpas/pas_thread_local_cache.c#L137-L145

It calls thread_setspecific from destructor to mark the thread has been exited already. Then FreeBSD's _thread_cleanupspecific reports error here:

https://github.com/freebsd/freebsd-src/blob/373ffc62c158e52cde86a5b934ab4a51307f9f2e/lib/libthr/thread/thr_spec.c#L163-L167

Are there any other way to set the flag to tell the thread is exiting ?
Comment 2 Basuke Suzuki 2022-08-15 17:09:00 PDT
Apple platforms have `pthread_self_is_exiting_np()` to detect this situation.
Comment 3 Radar WebKit Bug Importer 2022-08-22 17:00:19 PDT
<rdar://problem/99006058>