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

[browser][MT] Make ChangeLocalTimeZone thread-safe #103953

Closed
wants to merge 1 commit into from

Conversation

mkhamoyan
Copy link
Member

Fixes #101166

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jun 25, 2024
@mkhamoyan mkhamoyan self-assigned this Jun 25, 2024
@mkhamoyan mkhamoyan added os-browser Browser variant of arch-wasm arch-wasm WebAssembly architecture and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Jun 25, 2024
@mkhamoyan mkhamoyan marked this pull request as ready for review June 25, 2024 12:00
@ilonatommy
Copy link
Member

/azp run runtime-wasm

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@ilonatommy ilonatommy left a comment

Choose a reason for hiding this comment

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

Locally I cannot reproduce running in the loop.

Copy link
Member

@pavelsavara pavelsavara left a comment

Choose a reason for hiding this comment

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

I think that this is just hiding real underlying issue with emscripten.

It is posting async messages to UI thread from whatever thread exeuted the TZ change. And those messages probably come in random order.

Let's reconsider.

@mkhamoyan mkhamoyan marked this pull request as draft June 26, 2024 07:52
@pavelsavara
Copy link
Member

Let's revert this change, because it effectively hides the problem from the test.

Let's rather create additional test which will change TZ from many different threads in threadpool.
And observe the overall impact.
What would be expected behavior on Windows ?

@ilonatommy
Copy link
Member

ilonatommy commented Jul 3, 2024

What would be expected behavior on Windows ?

well, change on windows has an effect in the whole system, including registries, so if we do it concurrently I would assume a race and undefined expected result

@pavelsavara
Copy link
Member

well, change on windows has an effect in the whole system, including registries, so if we do it concurrently I would assume a race and undefined expected result

You are right, my bad. We should not try to make it work in parallel from multiple threads.

We need to catch one (non-UI) thread doing it and the change being propagated too slowly. So that we can understand how it works in emscripten and what we need to synchronize in Mono. To prevent this "read after write hazard" or whatever it is.

@ilonatommy
Copy link
Member

We need to catch one (non-UI) thread doing it

Do I understand it right that we drop the concept of improving test, revert the lock changes and now the goal is to pin debugger and investigate what is the reason for the failure? This failure was hit once per few weeks, any suggestions how to increase the probability of reproduction?

@pavelsavara
Copy link
Member

Do I understand it right that we drop the concept of improving test, revert the lock changes

I think so. Current code is how people write TZ code and it's broken only on MT WASM.

now the goal is to pin debugger and investigate what is the reason for the failure?

Yes, I don't expect that you would be able to use debugger.

This failure was hit once per few weeks, any suggestions how to increase the probability of reproduction?

Run it in a loop 1000 times.

@mkhamoyan
Copy link
Member Author

Thanks @pavel and @ilonatommy for clarification.
I left comment under the issue per this discussion and will close this PR.

@mkhamoyan mkhamoyan closed this Jul 3, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Aug 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture os-browser Browser variant of arch-wasm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[browser][MT] TimeZoneInfoTests.ChangeLocalTimeZone not thread safe
3 participants