WebNN: Retry createContext to avoid service connection error #57049
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.
When running WebNN conformance tests, we sometimes
encounter the flaky error "Failed to execute 'createContext' on
'ML': WebNN service connection error."[1].
This is caused by a previous test case's context lost failure,
which is handled by killing the GPU process. However, if the
GPU process hasn't restarted in time, calling another
createContextimmediately will trigger the WebNN contextprovider's disconnect handler[2].
To resolve this issue, this CL waits 3 seconds for the GPU
process to restart and then retries calling
createContext.[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/ml/ml.cc;l=124
[2] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/ml/ml.cc;l=140
Bug: 472168103
Change-Id: Id4808a01c8e617bf38a8225c016f3eb616a1d936
Reviewed-on: https://chromium-review.googlesource.com/7349171
WPT-Export-Revision: 56c4be46313e49ddf96e9e5e88d85ead02c001d8