Skip to content

setCurrentThreadName fails silently if thread name string length longer than OS supports (Version: 2.5.0) #5691

@vlntb

Description

@vlntb

Issue Description

The setCurrentThreadName function does not warn or fail when provided with a string that is too long for the target platform. This results in the name being silently truncated by the operating system, which can make debugging difficult.

For example, on Linux, the thread name is limited to 15 characters (the underlying TASK_COMM_LEN is 16 bytes, including the null terminator). Passing a longer string should ideally trigger an assertion in debug builds or be handled in a way that notifies the developer.

Furthermore, given that in most rippled use cases we pass constant string literals, this check can also be performed at compile time to catch errors even earlier in the development process.

Steps to Reproduce

Expected Result

  • Error or at least truncated string.

Actual Result

  • Thread remains unnamed.

Environment

Linux

Supporting Files

Metadata

Metadata

Assignees

Labels

Good First IssueGreat issue for a new contributorTriagedIssue/PR has been triaged for viability, liveliness, etc.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions