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

Clean up telemetry_test and fix. #3047

Merged
merged 1 commit into from
Apr 29, 2024

Conversation

aee-google
Copy link
Contributor

@aee-google aee-google commented Apr 22, 2024

b/330355045

The fix includes fixing the starboard implementation of MessagePump: MessagePumpUIStarboard and MessagePumpIOStarboard.

@jellefoks
Copy link
Member

jellefoks commented Apr 23, 2024

I tried this on a Sabrina device and it loaded the app but did not respond to remote keypresses. remote devtools worked, but the Quit button on the Cobalt app also got no response beyond a Request to stop log message (conceal worked, but revealing afterward by selecting the app again on the device results in a black screen and an ANR.

@aee-google aee-google force-pushed the fix-bbt-telemetry_test branch 7 times, most recently from 0c92fc5 to f5862e3 Compare April 26, 2024 16:46
@aee-google
Copy link
Contributor Author

Updated base/message_loop/message_pump_io_starboard.cc and base/message_loop/message_pump_ui_starboard.cc using

void MessagePumpLibevent::Run(Delegate* delegate) {
as a reference.

@aee-google
Copy link
Contributor Author

The failed checks are due to infra issues.

C:\BuildTools\VC\Tools\MSVC\14.34.31933\include\xtree(44): fatal error C1088:
    Cannot flush compiler intermediate file:
        'C:\Users\ContainerAdministrator\AppData\Local\Temp2\_CL_3c56ab4bex': No space left on device

@sherryzy
Copy link
Contributor

Can you explain a little bit what's the original issue with the MessagePump and how do you fix it? It will be very helpful if you can provide more context here.

Copy link
Member

@jellefoks jellefoks left a comment

Choose a reason for hiding this comment

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

This is awesome. There is a lot of long overdue and complex cleanup in here. Thanks!

@aee-google
Copy link
Contributor Author

The MessagePump::Delegate interface changed.

New:

Delegate::NextWorkInfo next_work_info = delegate->DoWork();

Old:

bool did_work = delegate->DoWork();
TimeDelta next_delayed_work_time;
did_work |= delegate->DoDelayedWork(&next_delayed_work_time);

The updated //base implementation simplifies the running of the next task into one call. If there is a delayed task that is ready to be done and and immediate task available, either task might be run in one iteration of the run loop. The DoWork() call returns the info about the next task to be run (unless preempted). This info is mainly held in next_work_info.delayed_run_time. NextWorkInfo also has next_work_info.recent_now which is used to determine the remaining delay in TimeDelta to wait until the next task is ready to be executed.

next_work_info.is_immediate() checks is delayed_run_time.is_null() which actually checks if the interval value of the TimeDelta is 0. A next_work_info.delayed_run_time with an internal value of 0 is an immediate task which should be executed immediately (no sleep/wait).

next_work_info.delayed_run_time.is_max() is a little clunky, but it means that there is no available next task, and we should idle until woken up.

next_work_info.remaining_delay() is the amount of time we should sleep/wait until running the next task. Similar to idle, we can still wake up if an immediate task is posted or if a new delayed task is posted with a more recent desired run time.

The old //base is different.

bool did_work = delegate->DoWork();
TimeDelta next_delayed_work_time;
did_work |= delegate->DoDelayedWork(&next_delayed_work_time);

If we did work, we should try to pull more work to do now. Another iteration should always be attempted.

We did update the MessagePump code to use the new Delegate::NextWorkInfo returned from DoWork(), but we using it subtly incorrectly.

I tried to fix just the issue. But the code as written was difficult to fix without breaking something else. This is what led me to modifying MessagePumpIOStarboard::Run() and MessagePumpUIStarboard::RunUntildle() to look more like MessagePumpLibevent::Run().

In addition to this, I changed SbEventIdSet outstanding_events_ to be absl::optional<SbEventId> outstanding_event_ since only one element is stored at a time. Same for outstanding_delayed_event_.

@aee-google
Copy link
Contributor Author

Do I need to keep retrying the on_device checks that failed? Are they more flaky than the normal checks (which are also quite flaky)?

auto-merge was automatically disabled April 27, 2024 00:54

Pull Request is not mergeable

@sherryzy
Copy link
Contributor

Thanks for the detailed explanation. For the failing the tests, maybe better do some retries once or twice to see if it's just flaky. And you can compare the test result with trunk as well. If it continue fails, maybe take a look if it fails for the same reason. Now, it seems like many Android tests fail.

@aee-google aee-google merged commit a529b2b into youtube:main Apr 29, 2024
639 of 647 checks passed
@aee-google aee-google deleted the fix-bbt-telemetry_test branch April 29, 2024 20:36
@aee-google aee-google added the cp-25.lts.1+ Cherry Pick to the 25.lts.1+ branch label Apr 30, 2024
cobalt-github-releaser-bot pushed a commit that referenced this pull request Apr 30, 2024
b/330355045

The fix includes fixing the starboard implementation of `MessagePump`:
`MessagePumpUIStarboard` and `MessagePumpIOStarboard`.

(cherry picked from commit a529b2b)
aee-google added a commit that referenced this pull request May 1, 2024
b/330355045

The fix includes fixing the starboard implementation of `MessagePump`:
`MessagePumpUIStarboard` and `MessagePumpIOStarboard`.

(cherry picked from commit a529b2b)
aee-google added a commit that referenced this pull request May 2, 2024
Refer to the original PR: #3047

b/330355045

The fix includes fixing the starboard implementation of `MessagePump`:
`MessagePumpUIStarboard` and `MessagePumpIOStarboard`.

Co-authored-by: aee <117306596+aee-google@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cp-25.lts.1+ Cherry Pick to the 25.lts.1+ branch on_device
Projects
None yet
3 participants