-
Notifications
You must be signed in to change notification settings - Fork 68
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
AxeBuilder.analyze allocates/leaks ~3 MiB per call #1086
Comments
AFAICT, the script lands in the TestStats structure this way:
Not sure if there's any way to stop that from happening... |
@christian-bromann Hey Christian, sorry to bother you, but would you consider this behavior a bug in WebdriverIO itself, or here in @axe-core/webdriverio? I don't see a a way for Axe to do anything else here, and the "leak" actually happens in the reporter's Maybe it makes sense to only save the beginning of the script body in the |
This certainly seems like a bug in WebdriverIO, feel free to raise it there instead. |
So, webdriverio/webdriverio#13219 would deal with ~1.2 MiB/call due to the main Axe script. The remainder has more complicated causes:
|
There has been discussion at the W3C to support "pinning scripts" which in Bidi is now available through the preload script command. I would recommend to maybe take a look at this option where you maybe inject an Axe scripts once in the beginning of the session where you attach the function to the window environment and then just have a small execute payload that essentially triggers the execution. |
Describe the bug
Since introducing axe tests throughout our entire SPA, we've been battling 2 GiB OOM errors on our CI runners. I can trace approximately 1.2 MiB per call to leaking this large axe script:
in the TestStats output array:
Various other strings in that structure make up most of the remainder of the 3 MiB per-call allocation (I think it's mostly violations which take up the remaining space, and one
window.partialResults ??= ''; ...
script).To Reproduce
We can reproduce the issue as described in #1044. I've also pushed a simplified reproducer to https://github.com/johannespfrang/axe-wdio-memory-leak.
Expected behavior
No memory leaks. The TestStats should, if at all, only contain test stats, and not duplicate the same long scripts (as strings) hundreds/thousands of times.
Screenshots
Provided above
Environment (please include versions for all products, browsers, OS, etc used ):
@axe-core/webdriverio 4.9.1
@wdio/spec-reporter 8.39.0
WebdriverIO 8.39.1
Chrome for Testing 126.0.6478.182
Ubuntu 24.04
The text was updated successfully, but these errors were encountered: