Skip to content

fix(electron): stalling on delayed process close - #29431

Merged
Max Schmitt (mxschmitt) merged 6 commits into
microsoft:mainfrom
mxschmitt:fix/electron-slower-close
Feb 13, 2024
Merged

Max Schmitt (mxschmitt) merged 6 commits into
microsoft:mainfrom
mxschmitt:fix/electron-slower-close

Conversation

@mxschmitt

@mxschmitt Max Schmitt (mxschmitt) commented Feb 9, 2024 •

Copy link
Copy Markdown
Contributor

Investigation notes:

When we call ElectronApplication.close(), we return before the actual process has been exited. This can/will lead under certain timing conditions to that gracefullyCloseSet still has an entry.
When the worker then tries to exit, we call these entries, which will do options.attemptToGracefullyClose(). A recursive call to ElectronApplication.close() which will never resolve, due to the fact that we call BrowserContext.close again (good) but the actual close event will only be fired once. See here. This is why it was stalling for 30s.

Changes:

Based on that, I see 2 changes which we should do:

  1. Adjust ElectronApplication.close() so it can be called multiple times (like for a normal browser)
  2. Wait until the process has exited before returning from ElectronApplication.close() (like for a normal browser - Browser.close() -> gracefullyClose).

Fixes #27523

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Comment thread tests/electron/electron-app.spec.ts Resolved
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@mxschmitt
Max Schmitt (mxschmitt) merged commit 30557ed into microsoft:main Feb 13, 2024
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

7 flaky ⚠️ [chromium] › library/tracing.spec.ts:243:5 › should not include trace resources from the previous chunks
⚠️ [chromium] › library/tracing.spec.ts:243:5 › should not include trace resources from the previous chunks
⚠️ [chromium] › library/tracing.spec.ts:243:5 › should not include trace resources from the previous chunks
⚠️ [playwright-test] › ui-mode-test-ct.spec.ts:215:5 › should watch component via util
⚠️ [chromium] › library/tracing.spec.ts:243:5 › should not include trace resources from the previous chunks
⚠️ [webkit] › library/tracing.spec.ts:243:5 › should not include trace resources from the previous chunks
⚠️ [playwright-test] › ui-mode-test-ct.spec.ts:59:5 › should run component tests after editing test

26581 passed, 611 skipped
✔️✔️✔️

Merge workflow run.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REGRESSION]: electron tests sometimes freezes for 30 seconds

2 participants