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

Prevent a possible assert in the debugger when a thread detaches #1283

Merged
merged 1 commit into from
Apr 14, 2020

Conversation

joshpeterson
Copy link

When a new thread is attached to the VM, the debugger will add it to the
thread_to_tls hash table. When that thread detaches, it will be
removed. Once the thread is attached, if a client is debugging, the
client can use the CMD_THREAD_GET_FRAME_INFO command to ask for
details about that thread.

This is a possibility that the thread detaches before the
CMD_THREAD_GET_FRAME_INFO command is processed, so the thread may not
exist the the thread_to_tls hash table any more.

This is a race condition, but is a valid state, so instead of asserting,
the debugger agent should indicate to the client that the thread no
longer exists, using ERR_UNLOADED.

When a new thread is attached to the VM, the debugger will add it to the
`thread_to_tls` hash table. When that thread detaches, it will be
removed. Once the thread is attached, if a client is debugging, the
client can use the `CMD_THREAD_GET_FRAME_INFO` command to ask for
details about that thread.

This is a possibility that the thread detaches before the
`CMD_THREAD_GET_FRAME_INFO` command is processed, so the thread may not
exist the the `thread_to_tls` hash table any more.

This is a race condition, but is a valid state, so instead of asserting,
the debugger agent should indicate to the client that the thread no
longer exists, using `ERR_UNLOADED`.
Copy link
Collaborator

@UnityAlex UnityAlex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@joshpeterson joshpeterson merged commit e24b695 into unity-master Apr 14, 2020
@joshpeterson
Copy link
Author

Upstream PR: mono#19541

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

Successfully merging this pull request may close these issues.

2 participants