Skip to content

Fix not to create unnecessary thread_params#76007

Merged
jkotas merged 2 commits intodotnet:mainfrom
HJLeee:thread_param
Sep 29, 2022
Merged

Fix not to create unnecessary thread_params#76007
jkotas merged 2 commits intodotnet:mainfrom
HJLeee:thread_param

Conversation

@HJLeee
Copy link
Contributor

@HJLeee HJLeee commented Sep 22, 2022

In case of EP_THREAD_TYPE_SERVER, thread_param is a leak in the original code.

@ghost ghost added community-contribution Indicates that the PR has been added by a community member area-Tracing-coreclr labels Sep 22, 2022
@HJLeee
Copy link
Contributor Author

HJLeee commented Sep 22, 2022

@HJLeee
Copy link
Contributor Author

HJLeee commented Sep 22, 2022

#76046

@HJLeee
Copy link
Contributor Author

HJLeee commented Sep 27, 2022

/azp run runtime
to run runtime (Installer Build and Test coreclr OSX_x64 Release) Cancelled after 124m — Installer Build and Test coreclr OSX_x64 Release was canceled

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 76007 in repo dotnet/runtime

@danmoseley
Copy link
Member

@HJLeee unfortunately the azp commands do not work without write access. You can rerun checks by closing and reopening or pushing an empty commit. Of course if you just want to rerun one pipeline it’s more efficient to do that but at the moment you have to ask someone with commit access to do it 😕

@HJLeee
Copy link
Contributor Author

HJLeee commented Sep 27, 2022

Thank you for the tip. Seems useful to the commiters if timeout tests can be run again. :) <- This can abuse CI.

@HJLeee
Copy link
Contributor Author

HJLeee commented Sep 28, 2022

@jkotas Please take a look.


if (id)
{
*reinterpret_cast<DWORD *>(id) = thread_params->thread_params.thread->GetThreadId ();
Copy link
Member

Choose a reason for hiding this comment

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

thread_params can be freed by the newly started thread by this point. The thread id should be captured e.g. before the thread is started.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. Fixed.

}
else if (thread_type == EP_THREAD_TYPE_SESSION || thread_type == EP_THREAD_TYPE_SAMPLING)
{
rt_coreclr_thread_params_internal_t *thread_params = new (nothrow) rt_coreclr_thread_params_internal_t ();
Copy link
Member

Choose a reason for hiding this comment

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

thread_params is still going to leak when the thread fails to start (CreateNewThread fails).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. Fixed.

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Thanks!

@jkotas jkotas merged commit f518c05 into dotnet:main Sep 29, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Oct 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-Tracing-coreclr community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants