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

[Bug]: Worker-scoped fixture execution terminates before timeout #30504

Open
NoamGaash opened this issue Apr 24, 2024 · 2 comments
Open

[Bug]: Worker-scoped fixture execution terminates before timeout #30504

NoamGaash opened this issue Apr 24, 2024 · 2 comments
Assignees
Labels

Comments

@NoamGaash
Copy link
Contributor

Version

1.43.1

Steps to reproduce

  1. clone my repo - git clone git@github.com:NoamGaash/never-ending-fixture.git
  2. npm install
  3. npx playwright test -g "my test"

Expected behavior

  1. I expect to see both "Fixture teardown starts" and "Fixture teardown ends" log messages
  2. I expect the string "will never be thrown" to be thrown
  3. I expect the teardown to take at least 40 seconds

Actual behavior

  1. The "Fixture teardown starts" text appears, but "Fixture teardown ends" is missing
  2. The test takes 30.2s
  3. No exception is thrown

Additional context

The documentation states that:

for slow fixtures, especially worker-scoped ones, it is convenient to have a separate timeout

That's why I believe timeouts are expected to work for worker-scoped fixtures.

Environment

System:
    OS: Linux 6.5 Ubuntu 23.10 23.10 (Mantic Minotaur)
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
    Memory: 14.82 GB / 31.01 GB
    Container: Yes
  Binaries:
    Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.12.1/bin/yarn
    npm: 9.5.1 - ~/.nvm/versions/node/v18.12.1/bin/npm
  IDEs:
    VSCode: 1.88.1 - /usr/bin/code
  Languages:
    Bash: 5.2.15 - /usr/bin/bash
  npmPackages:
    @playwright/test: ^1.43.1 => 1.43.1
NoamGaash added a commit to NoamGaash/playwright that referenced this issue Apr 24, 2024
This patch fixes issue microsoft#30504 by gracefully terminating the worker before exiting the process
NoamGaash added a commit to NoamGaash/playwright that referenced this issue Apr 24, 2024
This patch fixes issue microsoft#30504 by gracefully terminating the worker before exiting the process
@pavelfeldman
Copy link
Member

Investigation note:

  • worker is stopped
  • graceful worker termination is scheduled concurrently with the worker teardown

@NoamGaash
Copy link
Contributor Author

@dgozman
Thank you for addressing this issue.
Few words regarding our use case:
In every test, we are uploading test related resources to our servers. We don't want this long operation to block the worker from proceeding the run with other tests, that's why we use fixtures to wait for this operation to be completed during worker's teardown.
As a workaround, we have placed the waiting in an afterAll clause added to every test file, but performance-wise it's a terrible idea as the worker is stopped from running the next test file until the upload operation is completed.
Having the ability to use worker-scope teardown could make our (and our some of our clients) test-suite twice as fast.
I hope this explanation shed some light on why this issue is important for us, I'm here to help so please let me know if there's anything I can explain or do better.
Thank you very much! 🙏

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

No branches or pull requests

3 participants