mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
47.17k stars 9.82k forks source link

Fix integration test "FreeText Editor FreeText (delete existing) must delete an existing annotation" #18368

Closed timvandermeij closed 5 hours ago

timvandermeij commented 3 days ago

The most recent failure is in http://54.193.163.58:8877/018387cde149e38/output.txt with the following traceback:

Failures:
1) FreeText Editor FreeText (delete existing) must delete an existing annotation
  Message:
    ProtocolError: Waiting for selector `#pdfjs_internal_editor_3.selectedEditor` failed: script.callFunction timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.
  Stack:
        at <instance_members_initializer> (file:///C:/pdfjs/botio-files-pdfjs/private/018387cde149e38/node_modules/puppeteer-core/lib/esm/puppeteer/common/CallbackRegistry.js:89:14)
        at new Callback (file:///C:/pdfjs/botio-files-pdfjs/private/018387cde149e38/node_modules/puppeteer-core/lib/esm/puppeteer/common/CallbackRegistry.js:93:16)
        at CallbackRegistry.create (file:///C:/pdfjs/botio-files-pdfjs/private/018387cde149e38/node_modules/puppeteer-core/lib/esm/puppeteer/common/CallbackRegistry.js:19:26)
        at BidiConnection.send (file:///C:/pdfjs/botio-files-pdfjs/private/018387cde149e38/node_modules/puppeteer-core/lib/esm/puppeteer/bidi/Connection.js:51:32)
        at Session.send (file:///C:/pdfjs/botio-files-pdfjs/private/018387cde149e38/node_modules/puppeteer-core/lib/esm/puppeteer/bidi/core/Session.js:154:42)
        at Session.<anonymous> (file:///C:/pdfjs/botio-files-pdfjs/private/018387cde149e38/node_modules/puppeteer-core/lib/esm/puppeteer/util/decorators.js:94:27)
        at WindowRealm.callFunction (file:///C:/pdfjs/botio-files-pdfjs/private/018387cde149e38/node_modules/puppeteer-core/lib/esm/puppeteer/bidi/core/Realm.js:92:51)
        at WindowRealm.<anonymous> (file:///C:/pdfjs/botio-files-pdfjs/private/018387cde149e38/node_modules/puppeteer-core/lib/esm/puppeteer/util/decorators.js:94:27)
        at #evaluate (file:///C:/pdfjs/botio-files-pdfjs/private/018387cde149e38/node_modules/puppeteer-core/lib/esm/puppeteer/bidi/Realm.js:127:42)
        at async BidiFrameRealm.evaluateHandle (file:///C:/pdfjs/botio-files-pdfjs/private/018387cde149e38/node_modules/puppeteer-core/lib/esm/puppeteer/bidi/Realm.js:94:16)

The source code can be found here: https://github.com/mozilla/pdf.js/blob/master/test/integration/freetext_editor_spec.mjs#L1213-L1263

We should find out what causes this as it's one of the last intermittents we have left.

calixteman commented 3 days ago

Maybe I fixed it in https://github.com/mozilla/pdf.js/pull/18366. The rect is empty because the editor isn't rendered and then clicking on "it" does nothing, consequently the editor isn't selected.

timvandermeij commented 3 days ago

Unfortunately I don't think that fixed this particular issue because this intermittent happened in #18367 and that one was rebased onto the current master branch where that patch is already active; see the file at the revision of the last commit in that PR at https://github.com/mozilla/pdf.js/blob/4e8a015a78e8c372244fc119757b55c3ad13388f/test/integration/test_utils.mjs#L138 where the waitForSelector call is present. Looking at http://54.193.163.58:8877/386a81e543ffce1/output.txt, which prompted your fix, it does look similar, but given that that fix is already in place something else is probably going on in this test.

timvandermeij commented 3 days ago

It's indeed a bit problematic because I can't spot anything wrong in the code, especially after the extra hardening that was applied to getRect, and I can't reproduce it locally too. For now let's just use this issue to track that it happened and see if it happens again, and in the meantime we'll first get other issues out of the way, which also gives me some time to think about how to get more relevant debugging information for the bot tests.

timvandermeij commented 2 days ago

For future reference, it happened again in #18369, see http://54.193.163.58:8877/fc78ad56a1a8b11/output.txt, which also contains the getRect hardening, so it does appear that there is a different issue with this particular test only. Moreover, note that both times this only happened on Windows.

timvandermeij commented 1 day ago

This problem is likely fixed by #18374, but due to its intermittent nature we'll leave this issue open for a bit to make sure it doesn't reappear.

timvandermeij commented 5 hours ago

Closing since we haven't seen this reappear so far. If it does, we'll track it in #18396.