test: Memory leak fix in act runner#5025
Conversation
|
@straker could you review this? |
|
Thanks for pr. Once the tests runs the 10x and we've shown it doesn't error, we'll need you to remove the 10x runner before we merge. |
chrome is crashing in these tests, do you need me to do this right now, or do i try to fix the issue first? |
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| run_number: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] |
There was a problem hiding this comment.
This needs to be removed prior to merging.
| await driver.close(); | ||
| await new Promise(r => server.close(r)); | ||
| try { | ||
| if (driver) await driver.quit(); |
There was a problem hiding this comment.
This is a good fix, but this PR is incomplete. test/aria-practices/apg.spec.js has the same problem. Could you please update it too?
| const options = new chrome.Options().addArguments([ | ||
| '--headless', | ||
| '--no-sandbox', | ||
| '--disable-extensions', | ||
| '--disable-dev-shm-usage' | ||
| ]); |
There was a problem hiding this comment.
These are reasonable additions, but adding them seems unrelated to this PR.
|
@pswitchy So testing this out further I don't think this fix by itself fixes the problem. Even after adding @stephenmathieson additions to add the options it still fails. I'm going to close this pr and take on figuring out what to do. My guess is something similar to axe-core-npm and pin the chrome/driver version, but that will be a bit more work in this repo. |
I resolved the
MaxListenersExceededWarningby identifying thatprocess.on('exit')listeners were being leaked in each test file. By switching fromdriver.close()todriver.quit(), I ensured that the ChromeDriver child process is fully terminated rather than just closing the browser window.1. Robust Teardown Logic
To prevent
EADDRINUSEerrors and handle cases where the driver might crash, I wrapped the teardown in atry/catch/finallyblock. This guarantees the server closes even if the driver fails to quit.2. My CI Stress Test Configuration
To prove the stability of my fix, I modified the GitHub Actions workflow. I added a strategy matrix to force the suite to run 10 times concurrently on every PR.
Closes:
#5018