App freezes when automated

Hello everyone,

We have an iOS 8 app on an iPhone 5S where our automated test script can perform 3 taps, and then the app hangs. If we test manually, the app behaves normally. The app hangs only when we use automated testing. When the app hangs, any taps (manual and automated) do not cause any response from the app or device. Pressing the home key returns us to the home screen, but this then leaves us unable to launch any other application. I tried looking into the issue by creating a quick test script using the Instruments Automation GUI, and I ran into the same issue: 3 taps and then a freeze.

If I terminate Appium or Instruments, the app is closed on the device, and the device’s behavior returns to normal (responds to taps, able to launch apps from home screen).

I am hoping someone has encountered this same issue and would like to offer some advice. Help is gladly appreciated. :smiley:

1 Like

Hi @awang,

I have exactly the same as yours, the app freezes after 3 or 4 tap actions even though I can run the app smoothly with Xcode.
I am glad that I am not the only one who got the issue :smile:

Hey @tbao,

Does your app ask to be allowed to access the device location before it freezes, or does the app present any sort of pop-up at startup?

I did some more troubleshooting and I made a simple app with a simple test to see if I can get Appium running. The simple app and test ran fine, so I think the issue might either be with the app, Xcode and Instruments, or iOS 8. :stuck_out_tongue:

no, my app does not introduce any sort of that.

I can run the test well with xcode6 and iso 7.1 but when I pointed it to ios 8.0 it just freezes that way. I have no clue of where the problem is :frowning:

Ah, that’s interesting. Our app presents a couple of pop-ups before freezing which we dismiss with taps. We make 2 other taps after tapping the pop-ups, which causes the app to hang.

Right now, we’re glad that we’re not the only ones with the problem. :smiley:

I have the same as yours, if i shut down the debug switch in my app code, it will ok, but open the debug switch

@vigossjjj, how are you shutting down the debug switch? I always understood that apps can not be automated if they are not built in debug mode.

@awang, I finally have a workaround for this issue, it turned out the app got frozen because the dev guy logged all the received json data. and somehow the app ran to racing condition with that logging. If I turn the log off then everything is ok.
I guess probably your app has faced the same issue too, here are steps that I made to figured it out:

  1. Run the app until it get frozen, then open activity monitor to print the sample of the app process.
  2. You can find the waiting thread in there, and track back to the code which called to that.
  3. Try to disable that called function and try with the app again to see if it solves the problem.

Although I can have a workaround here but there are still 3 questions that I cannot answer:

  1. Why the app run well with xcode?
  2. Why the app run well with command line ( exactly the same command line as Appium)?
  3. Why the app run well with ios 7.1 on Appium?

I’ll investigate this when I have time. Good luck :slight_smile:


Hi @tbao,

I just tested out what you said with a sample app by adding in a big log line. Amazingly, the app did freeze after adding in the giant log statement. We created a build of our actual app with the logging commented out, and we are very relieved to see automation running on it without the app freezing.

Thank you for your excellent analysis, @tbao! Definitely glad to have learned something new from you! :smiley:

1 Like

Oh wow, that’s a very good issue to be aware of. I’m sure other users will run into it again. Thanks for posting @tbao

This is not all about 3-4 taps. We observed Appium(1.3.1) itself freezes after some hours of script run. So to stop/restart appium we had to force quit it (As Stop button goes unresponsive ). In last 3-4 attempts a complete test suite which was taking around 7 hours with iOS 6, now it is getting freeze just after 30-40% of tests run. Also 30-40% tests of the test suite is now consuming around 9 hours.


Appium 1.3.1
Xcode 6
iOS 8.1

Hi Abhishek!

I tried that out with the sample application, and it seems that Appium gets slower and slower as it sends commands. I added in a counter to my test script, and it seems that Appium can send several hundred taps before its performance comes to a crawl. I would recommend posting this as a separate issue.

Hi Awang

I have filed this issue here:

Hi All,

Somehow we are abled to overcome Appium server freezing issue (which also helps improving execution time to some extent).

Here is my blog on the same :

1 Like

I still have the same issue that freeze my app at the beginning or after 2-3 clicks.
Appium 1.3.5
Robot Framework 2.8.6 (Python 2.7.6 on darwin)
IOS 8.1

Does anybody have the the same issue lately?


@denny_home, did you try to take a look at the sample of the app process when it’s frozen?

There you can find the information of what process is blocking the app, and make some twist in the app’s source code to eliminate that blocking code.

@tbao, thanks for you comments. They are clear and handy. Could you give me some clues how to recognise which process is blocking my app? I’m analyzing my app process sample and looking some info in Call Graph section.

I’m having same issue with my 8.1 iOS sim. It’s very probably thats issue is also caused by loging json data :frowning:

@stefan, I don’t think there is a general way to recognize if a thread is blocking, but this is what I did when looking into the Call Graph:

  1. Track down each thread to the very bottom of the called tree. At the bottom is the function / method of “current” stage of the thread when the sample of the entire process is created.
  2. If there is some function / method related to “wait” then it is possibly the cause of deadlock
  3. Track up from that function / method until you can find where your code actually call it, and disable that call and retry again.

1 Like

While automating our app, strangely few pages failed to load as the loader kept on running without displaying anything on page.
@tbao Thanks to this post I was finally able to run my code on IOS8.
It was happening due to API NSlogs being printed. So I just commented the line out & app started working fine.

1 Like

Thanks @tbao logging of json data causing the problem, after removing everything works fine to me.

1 Like