Skip to content

Thread names can't be longer than 16 characters (on Linux)

Summary

On Linux, the RTS code uses pthread_setname_np (when available) to name (OS) threads. According to the library function's manpage, the length of this name is restricted:

The thread name is a meaningful C language string, whose length is restricted to 16 characters, including the terminating null byte ('\0').

Also according to the manual, the call returns ERANGE when

The length of the string specified pointed to by name exceeds the allowed limit.

Since the return value of calls to pthread_setname_np is never actually checked in the RTS code, this doesn't really show up, but at the same time, threads won't be named. At least non-moving mark thread is used as a thread's name at some point in the storage manager, and so is Pause and resume thread in a test-case, both longer than 16 bytes.

Other operating systems providing a pthread_setname_* implementation we use could have similar restrictions (I didn't check).

Environment

  • Operating System: Linux
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information