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

Electron app startup is very slow #11241

Open
1 of 2 tasks
thief-sty opened this issue Apr 17, 2024 · 2 comments
Open
1 of 2 tasks

Electron app startup is very slow #11241

thief-sty opened this issue Apr 17, 2024 · 2 comments
Labels
need-to-reproduce More clues are required to reproduce the issue. :type/dev This label is used to indicate that an issue or PR is related to development tasks or changes that

Comments

@thief-sty
Copy link
Contributor

Search first

  • I searched and no similar issues were found

What Happened?

When running yarn e2e-test, the startup time for the Electron app can be very slow.

I have tried to adjust the timeout on the beforeAll hook to account for that (at e2e-tests/fixtures.ts:46, introducing base.slow() or base.setTimeout() with different values), but even with a 180s timeout, sometimes the timeout gets exceeded:

  1) basic.spec.ts:8:5 › create page and blocks, save to disk ───────────────────────

    "beforeAll" hook timeout of 180000ms exceeded.

       at fixtures.ts:45

      43 | }
      44 |
    > 45 | base.beforeAll(async () => {
         |      ^
      46 |   base.setTimeout(180000)
      47 |   if (electronApp) {
      48 |     return

        at /home/sty/Code/logseq/e2e-tests/fixtures.ts:45:6

I am currently hunting timeouts that are too short for e2e-tests to run correctly on my config, and this one is the one I have increased the most yet. I could theoretically increase it even further, but at this point I feel like it's a waste of time, and that there's probably a cause to be found somewhere in the code. I don't have any clues though.

Reproduce the Bug

Run e2e tests

Expected Behavior

No response

Screenshots

No response

Desktop or Mobile Platform Information

No response

Additional Context

No response

Are you willing to submit a PR? If you know how to fix the bug.

  • I'm willing to submit a PR (Thank you!)
@andelf andelf added :type/dev This label is used to indicate that an issue or PR is related to development tasks or changes that need-to-reproduce More clues are required to reproduce the issue. labels Apr 18, 2024
@andelf
Copy link
Collaborator

andelf commented Apr 18, 2024

Use npx cross-env 'DEBUG=pw:browser' CI=true playwright test to debug browser init and check the logs.

@thief-sty
Copy link
Contributor Author

thief-sty commented Apr 18, 2024

This is the output I get on a 10s timeout:

Running 167 tests using 1 worker
°Creating test graph directory: /home/sty/Code/logseq/tmp/#e2e-test/@EG0B80p1Dj
  pw:browser <launching> /home/sty/Code/logseq/node_modules/electron/dist/electron -r /home/sty/Code/logseq/node_modules/playwright-core/lib/server/electron/loader.js --inspect=0 --remote-debugging-port=0 electron.js +0ms
  pw:browser <launched> pid=5346 +6ms
  pw:browser [pid=5346][err] Debugger listening on ws://127.0.0.1:38625/69e72233-4899-4292-ae98-cc631ed894a8 +103ms
  pw:browser [pid=5346][err] For help, see: https://nodejs.org/en/docs/inspector +1ms
  pw:browser <ws connecting> ws://127.0.0.1:38625/69e72233-4899-4292-ae98-cc631ed894a8 +0ms
  pw:browser <ws connected> ws://127.0.0.1:38625/69e72233-4899-4292-ae98-cc631ed894a8 +8ms
  pw:browser [pid=5346][err] Debugger attached. +1ms
F

  1) basic.spec.ts:8:5 › create page and blocks, save to disk ───────────────────────

    electron.launch: Timeout 10000ms exceeded.

       at fixtures.ts:55

      53 |   });
      54 |
    > 55 |   electronApp = await electron.launch({
         |                 ^
      56 |     cwd: "./static",
      57 |     args: ["electron.js"],
      58 |     locale: 'en',

        at /home/sty/Code/logseq/e2e-tests/fixtures.ts:55:17

  1 failed
    basic.spec.ts:8:5 › create page and blocks, save to disk ────────────────────────
  166 skipped

This is with a base.slow() marker (90s timeout):

Running 167 tests using 1 worker
°Creating test graph directory: /home/sty/Code/logseq/tmp/#e2e-test/@9hcHsyUbEA
  pw:browser <launching> /home/sty/Code/logseq/node_modules/electron/dist/electron -r /home/sty/Code/logseq/node_modules/playwright-core/lib/server/electron/loader.js --inspect=0 --remote-debugging-port=0 electron.js +0ms
  pw:browser <launched> pid=5719 +5ms
  pw:browser [pid=5719][err] Debugger listening on ws://127.0.0.1:43819/a2feedaf-1cf4-4560-bfd7-79f7f4719d48 +103ms
  pw:browser [pid=5719][err] For help, see: https://nodejs.org/en/docs/inspector +1ms
  pw:browser <ws connecting> ws://127.0.0.1:43819/a2feedaf-1cf4-4560-bfd7-79f7f4719d48 +0ms
  pw:browser <ws connected> ws://127.0.0.1:43819/a2feedaf-1cf4-4560-bfd7-79f7f4719d48 +11ms
  pw:browser [pid=5719][err] Debugger attached. +1ms
  pw:browser [pid=5719][err] (rsapi) init loggers +775ms
  pw:browser [pid=5719][err]  +7s
  pw:browser [pid=5719][err] DevTools listening on ws://127.0.0.1:36193/devtools/browser/2e0cce85-0f8d-4af5-a85c-bdb4f32f5fbf +0ms
  pw:browser <ws connecting> ws://127.0.0.1:36193/devtools/browser/2e0cce85-0f8d-4af5-a85c-bdb4f32f5fbf +1ms
  pw:browser <ws connected> ws://127.0.0.1:36193/devtools/browser/2e0cce85-0f8d-4af5-a85c-bdb4f32f5fbf +271ms
  pw:browser [pid=5719][out] shadow-cljs - #4 ready! +247ms
  pw:browser [pid=5719][out] 11:11:03.156 › Logseq App(27.1.3) Starting...  +3s
  pw:browser [pid=5719][out] 11:11:03.744 › restore proxy settings {:type "system"} +510ms
  pw:browser [pid=5719][out] 11:11:03.746 › set proxy to {:type "system"} +3ms
^[[CT

  1) basic.spec.ts:8:5 › create page and blocks, save to disk ───────────────────────

    "beforeAll" hook timeout of 90000ms exceeded.

       at fixtures.ts:45

      43 | }
      44 |
    > 45 | base.beforeAll(async () => {
         |      ^
      46 |   base.slow()
      47 |   if (electronApp) {
      48 |     return

        at /home/sty/Code/logseq/e2e-tests/fixtures.ts:45:6

  1 failed
    basic.spec.ts:8:5 › create page and blocks, save to disk ────────────────────────
  166 skipped

It doesn't seem to give any additional info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-to-reproduce More clues are required to reproduce the issue. :type/dev This label is used to indicate that an issue or PR is related to development tasks or changes that
Projects
None yet
Development

No branches or pull requests

2 participants