-
-
Notifications
You must be signed in to change notification settings - Fork 764
bug: AppiumFieldDecorator: Memory leak after moving from java-client 8.5.0 to 8.5.1 .... 9.1.0 #2119
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
@amedvedjev do you have the project to reproduce the problem? |
@valfirst Need to write from zero. All projects I have are private. But bet we can reproduce using one thread/phone. Will try to write with Appium test app. |
@mykola-mokhnach @valfirst found easy way to reproduce issue with following test:
can upload all code to try. Results on my machine
|
and another with even more simple code:
|
I can observe one potential issue there:
My advice would be to avoid calling the factory method multiple times on the same object and only have single |
@valfirst Maybe we should explicitly deny such possibility in the decorator... |
@mykola-mokhnach it is huge disadvantage of calling Second problem - we want make search of element often more convenient and thus comfortable code below produce leaks
Third problem. Why with 8.5.0 and below we did not have such issues? |
Not sure why it must be a singleton. The idea is to create a new page every time it needs to be accessed in the UI. Usually this should not happen very often unless the test script constantly switches between different pages.
Lets take a look at this code from the detailed perspective.
Internally this call would iterate through declared fields of the current object and fields of all inherited superclasses, except of the Object.class and create new proxies for all matching ones, maybe overriding existing values
would do exactly the same one more time. And that's all is done to simply click one button. Doesn't it look like a bit of an overkill?
I cannot answer this question. Probably because there is some bug, which is hard to spot (or might not be found at all) I appreciate your efforts in helping people that visit the Appium forum and thus I try to prioritise your issues. Nevertheless my point here is that it makes more sense to fix the obvious issue with the upstream code first. |
@mykola-mokhnach thanks for your really great support and work with Appium code!
This is all super convenient and you see we use quite lot of timing change to speedup. As far as now we have a bit more clear picture where issue is I will try to optimise code a bit to eliminate unneeded switches while we already switched into needed time. Will write next week how it helps. Thanks for any fix / advice how to continue keep code simple and fast!!! PS some more real statistic I have while executing some test with Demo app
|
I've spent some fun time debugging the stuff and got #2129 as the result of my efforts. I hope there will be paradise after it's merged. Feel free to test it locally @amedvedjev |
@amedvedjev Have you had a chance to verify the patch? Does it make sense to publish a new client version now that includes it? |
Just want to add a thank you here! I have a (large) test suite that was beginning to push 7Gb of RAM usage by the end of the run, since ByteBuddy was introduced originally. This fix has reduced that back down to 100Mb |
Do I have the most recent component updates?
Is the component officially supported by the Appium team?
Is there an existing issue for this?
Current Behavior
After increasing java client version from 8.5.0 to 8.5.1 ... 9.1.0 we have a huge memory leak while executing tests.
Tests becoming very slow in few minutes.
A bit more details mentioned appium/appium#18860
Expected Behavior
No memory issues.
Minimal Reproducible Example
Environment
appium --version
): 2.x.x (was reproduced with many including latest)Link to Appium Logs
No response
Further Information
also discussed here https://discuss.appium.io/t/appium-terminating-unexpectedly-not-receiving-commands/40782
The text was updated successfully, but these errors were encountered: