Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
worker: refactor thread life cycle management #26099
worker: refactor thread life cycle management #26099
Changes from all commits
fbf740e
8c48265
df06cc4
db9edc1
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We’re not tracking the
uv_async_t
anymore, right? Maybe we should add something liketracker->TrackInlineField()
that allows us to keep track ofMemoryRetainer
s that are direct members of the class…There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean - the one represented by
thread_exit_async_
? that is replaced withAsyncRequest
objects that createsuv_async_t
objects, and tracks through the interface method. theasync_
field inAsyncRequest
is still a pointer, direct member of neitherAsyncRequest
norWorker
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neither
*thread_stopper_.async_
nor*on_thread_finished_.async_
are tracked, yes, because we don’t inform thetracker
about the existence of theAsyncRequest
fields.Also, side note: I’m just noticing that we have the
IsolateData
andEnvironment
fields listed here as well, which I’m not sure makes sense given that they are no longer directly allocated by this object…There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, I don't understand.
*thread_stopper_.async
and*on_thread_finished_.async_
are not tracked through the tracker instanceorof worker, but those are tracked through the tracker instance ofAsyncRequest
object (line 98):Isn't it enough? I hope we don't need multiple trackers for the same allocation?
For the
IsolateData
andEnvironment
: I just removed those from being actively tracked by the worker and pushed in under this PR itself.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gireeshpunathil The problem is that the memory tracker doesn’t know that it should call
AsyncRequest::MemoryInfo
. Currently, the way to inform it would be addingtracker->TrackField("thread_stopper_", &thread_stopper_);
, but then we would end up tracking the memory for theAsyncRequest
itself twice.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gireeshpunathil Should we change this PR to use
TrackInlineField
now?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@addaleax - yes. Though I knew this depend on #26161 for a moment I forgot about that!