-
Notifications
You must be signed in to change notification settings - Fork 917
Fix race condition in JavaScript TextInterceptorTests #8455
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
Conversation
|
|
09f9738 to
d5b991f
Compare
d5b991f to
1b7528a
Compare
|
Curious! Are you sure That Maybe there should be method in |
1b7528a to
72d0fcd
Compare
yes I had that in mind too since this is the case for all race conditions. If you make the code slow enough they disappear. It is difficult to proof that this is not the case here too - given that sync is surprisingly slow. I will close this PR later and isolate the three tests to wrap them in a retry script via #8450 |
it stores it in fields, but those should be volatile at the very least, yeah. I won't change anything unless it also fixes the problem completely, since changing the timing could only obfuscate the issue.
this wouldn't be sufficient. Since nothing knows what is still in the event queue at this point. I observed the clear event arriving after the Preference write but before the write event arrived. The "happens before" promise doesn't exist if the event thread itself can't be flushed. |
|
the fact that this was copied around everywhere: doesn't really motivate me to work on this at all tbh. |
hmmm, I totally misread where the storage was at a glance! 😆 But yes, possibly volatile ...
I was only thinking of the test requirements, not a general fix. Enough to ensure the setting in the test works synchronously. Another option might be to add a temporary second preference listener (assuming they're called in the order they're added) and listen for the required event(s) to propagate? |
5262616 to
bd4e182
Compare
|
another attempt:
(verified with ~400 local test runs) lazy init via CAS block is also incorrect, but lets see if the tests work first before making more changes. |
bd4e182 to
9d611a2
Compare
|
planing to merge maintenance PRs like this one here soon. |
|
rebasing, planning to merge it once green |
9d611a2 to
e63ea4c
Compare
|
reverted a test too much. Will update in a moment. |
(e.g JsTypedTextInterceptorTest#testDisabledSmartQuotes and the JsDeletedTextInterceptorTest equivalent had a high failure ratse) situation: - OptionsUtils caches some Preference values and updates those asynchronously via a listener (Preferences event Thread is not EDT) - tests expect values to be immediately available after written to Preferences (and also that clear() isn't delayed) fix: - disable async preferences tracking during tests, write values manually - update all OptionsUtils copies so that the cached values are made volatile since they are shared between threads and fixed lazy init code
e63ea4c to
e7a32d0
Compare
(e.g
JsTypedTextInterceptorTest#testDisabledSmartQuoteshad a high failure rate)situation:
OptionsUtilscaches some Preference values and updates those asynchronously via a listener (PreferenceseventThreadis not EDT even though it has a deceivingly similar name when looked at through the debugger)Preferences(and also thatclear()isn't delayed)fix:
OptionsUtilsinstead of preferences.OptionsUtilscopies so that the cached values are made volatile since they are shared between threads and fixed lazy init code which used a CAS block as critical sectionpart of #8183