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
Appium should detect when Instruments is not responding #1306
Comments
Instruments often gets stuck at 100% CPU and appium hangs forever. Ending the process after each test helps, however it doesn't fix the issue. Appium should detect that Instruments isn't responding and end the session. |
There are private APIs to do this in OS X, you could write an app to poll it every 2 seconds or so and then terminate when the app is unresponsive + (bool) isProcessHanging:(int)pid
{
pid_t p = (pid_t)pid;
ProcessSerialNumber psn;
OSStatus success = GetProcessForPID(p, &psn);
if (success != 0)
return false;
CGSConnectionID myCid = _CGSDefaultConnection();
return CGSEventIsAppUnresponsive(myCid, &psn);
} |
Is there anything on Google about that API? I'm not seeing results. |
there probably is. I think that's where I found it when I first used it; though it is a private API after all |
Here's a list of private CoreGraphics APIs |
It looks like I was using the wrong term. |
I believe there's also a way to register for a notification if you want to do it that way |
That'd be better than polling. |
This seems to do what I want. |
@jlipps What do you think about integrating this into Appium so Instruments is ended when it hangs? The code will have to be modified so only Instruments is force quit. |
I like that version better because it's not polling |
I forked it. It looks like the only required change is filtering out non-Instruments processes.
|
though honestly one CGS call every 2 mins is not a huge polling hit on the system, and it lets you identify the process by pid |
I think either approach is better than the current situation of hanging forever. |
I think the notification way still lets us extract a pid. |
The current situation is something hangs forever? I thought that's why we have a launchTimeout now. |
Launch timeout only handles the launch case. If we're in the middle of the test and instruments flakes out, appium will not recover. |
Ah didn't realized that happens. OK. On Nov 11, 2013, at 2:00 PM, bootstraponline notifications@github.com wrote:
|
It happens frequently when running multiple tests. :( |
I have 47 moderately complex iOS tests and I can't make it through a complete run without triggering this issue. |
I can run all the appium tests just fine without this happening; only instruments does hang on startup 1-2 times per test suite run |
Happens all the time running the Woven tests. I'm happy to send those to you if you want to try. |
I have this scenario:
According to log - "Instruments exited with code 0", but the test from step 1 nothing to knows about this and continues sending command requests. Should Appium detect that intruments exited and pass this error to the test? |
I updated the logic so only Instruments is ended. All the code is in this repository. When running the binary I have to use this path @jlipps Is this fine to integrate into appium? Edit: From my testing it seems Cocoa is required which needs Info.plist meaning it can't be a command line app. |
Yeah go ahead. How are you planning on integrating it? |
|
👍 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
The instruments process is consuming 300%+ CPU and appium hangs forever. What's going on? I suspect this is yet another gift from Apple.
The text was updated successfully, but these errors were encountered: