-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Fix reference test "pr12564" #18259
Comments
Good news: I have managed to find a way to reproduce the issue locally on Linux. Bad news: even with To reproduce the issue:
So far I've seen at least one occurrence of the error in every run except for one, so it might need a few tries before you hit it, but then you'll see this:
Sadly there is no more debugging information from |
I think we're getting closer now. I have checked out to commit 53dfb5a which is the one right before the Hopefully the above, in combination with the local reproducer, helps to debug this further since as this point I'm not really sure how to proceed here. |
So the data returned by the DecompressionStream or by our own decompressor are the same. diff --git a/src/core/evaluator.js b/src/core/evaluator.js
index 5e31d0d92..4d03a9193 100644
--- a/src/core/evaluator.js
+++ b/src/core/evaluator.js
@@ -857,6 +857,10 @@ class PartialEvaluator {
if (cacheGlobally) {
this.globalImageCache.addByteSize(imageRef, imgData.dataLen);
}
+
+ if (objId === "img_p0_15") {
+ await new Promise(r => setTimeout(r, 100));
+ }
return this._sendImgData(objId, imgData, cacheGlobally);
})
.catch(reason => { I manage to reproduce the issue with either Chrome or Firefox. |
FYI: Note that there's an easy way to repeat a test any number of times, by setting
That diff seems to reproduce even without commit 9654ad5, so there's probably some older intermittent issue where we're not correctly awaiting dependencies in |
Yep, my explanation is the following (I'm not sure it's correct):
This way the dependency will be added only when the draw is done but the draw requires the dependency ! |
The question is why it doesn't work, since this code should already ensure that we wait for the dependency to resolve: Lines 969 to 978 in 06800cd
|
Because the main thread receives the dependency when it's occupied to draw. |
Yes, but the existing code in
Sorry, but that sounds like a hack and we really need to figure out and fix the "real" error here. |
I don't think it's a hack. Line 798 in 06800cd
and then we send the dependency few lines after: Line 868 in 06800cd
and in the main thread we're executing the draw instruction, but the dependency message is still waiting in worker message queue. |
All the message queue is drained before the execution of micro/macro tasks in the main thread. So if the messages with draw instruction and dependency are in the same chunk, whatever the order is, then they will be treated before drawing, consequently the dependency is there when the paintImage wants to get it. But if they aren't in the same chunk, then drawing is executed before the dependency message has been treated. |
But then you block further worker-thread parsing on the image-data being completely decoded, and the point of the Edit: Basically, this is my fault; sorry about that! |
Thank you both for helping out with this! I like how all the puzzle pieces combined helped to solve the issue really quickly, since given how intermittent this was I was initially a bit afraid that this was going to be a time-consuming one to track down. |
In PR #18257 we have seen the following intermittent failure in the reference tests:
It looks like this happened only once before, in PR #18167, which may or may not be where this problem started. We should try to reproduce the issue locally. One idea is to repeatedly open/close the file until it happens so we can hopefully extract some debugging information to find out what goes wrong here.
The text was updated successfully, but these errors were encountered: