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

[Meta] Fix log issues from the dumpio: true Puppeteer option #18281

Open
timvandermeij opened this issue Jun 18, 2024 · 5 comments
Open

[Meta] Fix log issues from the dumpio: true Puppeteer option #18281

timvandermeij opened this issue Jun 18, 2024 · 5 comments

Comments

@timvandermeij
Copy link
Contributor

timvandermeij commented Jun 18, 2024

In PR #18260 we enabled dumpio: true for Puppeteer. This option forwards the browser logs to Node's log stream so that we can see any warnings/errors that are logged in e.g. the web console. This surfaced a few interesting issues that we should fix, not only to reduce the amount of logs but mainly because they might point at actual issues in our code.

This issue is a meta issue for this effort. We should go over the logs and file individual issues for each interesting issues. The logs from the last run in the PR are:

This meta issue already contains following issues:

@timvandermeij timvandermeij changed the title Fix issues logged by the dumpio: true Puppeteer option [Meta] Fix log issues from the dumpio: true Puppeteer option Jul 5, 2024
@timvandermeij
Copy link
Contributor Author

timvandermeij commented Jul 5, 2024

Having looked through the logs of the last few weeks, which are fortunately pretty clean after all the fixed above, I think we have two main categories of tracebacks left:

  1. dispatchEventInSandbox-related logs such as in http://54.241.84.105:8877/c51fe1b82f42d3b/output.txt. In Avoid dispatching an event in pdfjsSandbox when destruction has run #18293 this was attempted to be solved, but it looks like the problem lies elsewhere.
  2. bindListeners-related logs such as in http://54.193.163.58:8877/5f4c377dce34650/output.txt. This one seems to be because in at least the regular and secondary toolbar we only register event listeners but don't unregister them, and that should hopefully be easy to fix with e.g. abort controllers.

@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented Jul 5, 2024

2. bindListeners-related logs such as in http://54.193.163.58:8877/5f4c377dce34650/output.txt. This one seems to be because in at least the regular and secondary toolbar we only register event listeners but don't unregister them, and that should hopefully be easy to fix with e.g. abort controllers.

What's triggering those event listeners though, since the Toolbar/SecondaryToolbar have no async code and the errors appear to suggest that the tests somehow click on toolbar-buttons after we've invoked testingClose in the viewer?

@timvandermeij
Copy link
Contributor Author

timvandermeij commented Jul 6, 2024

Good question, and I'm not really sure. However, I just found http://54.193.163.58:8877/7a0c5f232507dff/output.txt and http://54.193.163.58:8877/c0e29236d621ca3/output.txt which both also have the bindListener traceback at the same position in the logs, so that might be an indication that the must check the keyboard event is limited to the input integration test does something to trigger it (it interacts with the page number field in the toolbar).

@calixteman
Copy link
Contributor

We're deleting the page number here:

await page.click("#pageNumber");
await awaitPromise(handle);
handle = await createPromise(page, resolve => {
document
.getElementById("pageNumber")
.addEventListener("keyup", resolve, { once: true });
});
await page.keyboard.press("Backspace");
await awaitPromise(handle);

and I guess the callback defined here:

pdf.js/web/toolbar.js

Lines 212 to 217 in 145951d

pageNumber.addEventListener("change", function () {
eventBus.dispatch("pagenumberchanged", {
source: self,
value: this.value,
});
});

is triggered just before we close.
So I think we should add the abort controller stuff in the toolbar to remove every listener we've here.

@timvandermeij
Copy link
Contributor Author

timvandermeij commented Jul 9, 2024

It looks like there's a third one in addition to the two from #18281 (comment). For example in http://54.241.84.105:8877/00b7f8245c22a11/output.txt the #colorSelect one appears; this one happens less often but I have seen it a couple of times now. I don't recall having seen any other types of tracebacks, so for now I think it's limited to these three.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants