Skip to content

Add ScopedJobThreadPtr class to be used with JobThread - #4275

Merged
kaidokert merged 1 commit into
youtube:25.lts.1+from
alexanderbobrovnik:b3725
Mar 13, 2025
Merged

kaidokert merged 1 commit into
youtube:25.lts.1+from
alexanderbobrovnik:b3725

Conversation

@alexanderbobrovnik

@alexanderbobrovnik alexanderbobrovnik commented Oct 17, 2024 •

Copy link
Copy Markdown
Collaborator

b/372515171

@alexanderbobrovnik alexanderbobrovnik changed the title Add explicit join thread to JobThread Add ScopedJobThreadPtr class to be used with JobThread Oct 22, 2024
@xiaomings
xiaomings requested a review from borongc October 22, 2024 18:20
@xiaomings

Copy link
Copy Markdown
Member

@borongc is it possible for you to help me review the part in this PR where all changes to Schedule() made during the scoped_ptr<> to unique_ptr<> migration is reverted?

@xiaomings

Copy link
Copy Markdown
Member

@osagie98 @sideb0ard is it possible for you to take a look at this one?

@sideb0ard

Copy link
Copy Markdown
Member

@osagie98 @sideb0ard is it possible for you to take a look at this one?

looking now, re-reading bug history.

@sideb0ard sideb0ard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

From reading Xiaoming and Jelle's comments, specifically https://b.corp.google.com/issues/372515171#comment11
this new ScopedJobThreadPtr has the behavior we require in the correct order, i.e. finish jobs, terminate thread, set pointer to null.
However, as this PR and bug are still open, we appear to still have some lingering reservations.

Suggestion:

@alexanderbobrovnik

Copy link
Copy Markdown
Collaborator Author

From reading Xiaoming and Jelle's comments, specifically https://b.corp.google.com/issues/372515171#comment11 this new ScopedJobThreadPtr has the behavior we require in the correct order, i.e. finish jobs, terminate thread, set pointer to null. However, as this PR and bug are still open, we appear to still have some lingering reservations.

Suggestion:

* Can we first add a new test to job_thread_test.cc 'ScheduleJobDuringShutdown', which specifically triggers the DCHECK listed in https://b.corp.google.com/issues/372515171#comment1
  This new test should FAIL with the current implementation.

* Then, secondly, run the new test with this PR, which should PASS. If it does pass, then we can be sure it's solved the issue as we currently understand it.

I've created PR for ScheduleJobDuringShutdown test: #4864

@sideb0ard

Copy link
Copy Markdown
Member

I've created PR for ScheduleJobDuringShutdown test: #4864

perfect, thank you!
Rather than merge #4864 which breaks the build, as expected:

image

Lets go ahead and add that test to this PR, which should now pass with these changes.

@alexanderbobrovnik

Copy link
Copy Markdown
Collaborator Author

I've added ScheduleJobDuringShutdown test to this PR.

@sideb0ard
sideb0ard requested a review from xiaomings March 4, 2025 19:33
@jasonzhangxx

Copy link
Copy Markdown
Contributor

With this change, I think JobThread::ScheduleAndWait can be removed.

And we should also have another change to update tvOS code.

@alexanderbobrovnik

alexanderbobrovnik commented Mar 6, 2025 •

Copy link
Copy Markdown
Collaborator Author

With this change, I think JobThread::ScheduleAndWait can be removed.

And we should also have another change to update tvOS code.

This PR will be followed by CL for the internal part.
But ScheduleAndWait() is still used in a few more places not related to this change (especially a lot in job_thread_test), should I remove it in this PR?

@jasonzhangxx

Copy link
Copy Markdown
Contributor

With this change, I think JobThread::ScheduleAndWait can be removed.
And we should also have another change to update tvOS code.

This PR will be followed by CL for the internal part. But ScheduleAndWait() is still used in a few more places not related to this change (especially a lot in job_thread_test), should I remove it in this PR?

I see, we can remove it in a follow up cl then.

@amurovanyi
amurovanyi requested a review from sideb0ard March 12, 2025 20:19

@sideb0ard sideb0ard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@kaidokert
kaidokert merged commit f3f295a into youtube:25.lts.1+ Mar 13, 2025
oxve added a commit that referenced this pull request Mar 13, 2025
@jasonzhangxx

jasonzhangxx commented Mar 13, 2025 •

Copy link
Copy Markdown
Contributor

The change breaks android on device testing. We need to fix the the failures before merging it. It seems that the failures are due to other issues.

oxve added a commit that referenced this pull request Mar 31, 2025
oxve added a commit that referenced this pull request Apr 1, 2025
@alexanderbobrovnik
alexanderbobrovnik deleted the b3725 branch July 17, 2025 11:38
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.

7 participants