RFR: 8368124: Show useful thread names in ASAN reports [v4]

Thomas Stuefe stuefe at openjdk.org
Wed Sep 24 05:40:16 UTC 2025


On Wed, 24 Sep 2025 01:20:14 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Thomas Stuefe has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   review feedback
>
> src/hotspot/os/linux/os_linux.cpp line 4871:
> 
>> 4869:   if (Linux::_pthread_setname_np) {
>> 4870:     // set name in pthread lib
>> 4871:     rc = Linux::_pthread_setname_np(pthread_self(), buf);
> 
> This seems redundant given we have to do the `prctl` directly ourselves.

`pthread_setname_np` does more than `prctl`, though. It also populates the task name entry in /proc. See `ls /proc/<pid>/task/comm | xargs cat` . 

We could do this ourselves, too, admittedly. That could get rid of the dlsym for the _pthread_setname, but goes a bit beyond the scope of this PR. And if glibc ever adds anything to `pthread_setname_np`, we will miss out. What do you think?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27395#discussion_r2374464443


More information about the hotspot-dev mailing list