Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access to Internal Resolver Thread ID #1513

Open
tarun-t opened this issue Jul 24, 2024 · 1 comment
Open

Access to Internal Resolver Thread ID #1513

tarun-t opened this issue Jul 24, 2024 · 1 comment

Comments

@tarun-t
Copy link

tarun-t commented Jul 24, 2024

Description

Currently, there is no way to access the thread ID of the internal thread used by Asio for DNS resolution. This information could be valuable for debugging, logging, or performance analysis.

Current Behavior

Asio creates internal threads for certain operations, including name resolution. These threads perform DNS lookups asynchronously, but their thread IDs are not exposed through the public API.

Desired Behavior

It would be beneficial to have a method to retrieve the thread ID of the internal resolver thread. This could be implemented as:

A new method in the ip::tcp::resolver class
A property of the io_context that manages these threads
A callback that provides this information when a resolver operation is initiated

Use Case

Access to this thread ID would allow developers to:

Track and log which thread is handling DNS resolutions
Set CPU affinity for these threads if desired

Questions

Is there a technical reason why this information is not currently exposed?

Additional Context

This limitation was discovered while attempting to track all threads involved in network operations within an application using Asio.

@InternalHigh
Copy link

It will prevent implementing DNS resolution without threads in the future. Maybe thread naming is a viable option.

BTW: @chriskohlhoff ignores issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants