Uploaded image for project: 'Appcelerator - INBOX'
  1. Appcelerator - INBOX
  2. AC-2201

iOS: Apps hang at startup when network connection is poor

    Details

      Description

      Let me start by giving a general description of the behavior I am witnessing.

      When using Titanium 2.x, targeting iOS 5 or 6....

      If I launch my app in a situation where the device or simulator BELIEVES it has a network connection, but where one is not actually available, the app will hang. True, this might seem to be a rare situation, but it happens quite frequently here in downtown Chicago. My phone reports a 4g connection with AT&T, but the network is unresponsive.

      I have witnessed all of the following depending upon my app and whether I am running on the device or in simulator.

      1. The app hangs forever on the splash screen.
      2. The app makes it past the startup screen, but the UI is unresponsive.
      3. The app hangs on the startup screen for a long time, but eventually finishes launching normally.
      4. The app hangs on the startup screen, and then iOS shuts it down (for taking to long to launch?)
      5. Occasionally, the console shows the error "Timing out waiting on main thread. Possibly a deadlock? in TiThreadPerformOnMainThread (TiBase.m:238)"

      I know that a while back, this type of problem could be traced to having analytics enabled, but I am seeing this even with <analytics>false</analytics> in my tiapp.xml

      It also appears that the issue is somehow related to the loading of modules, as my apps which do not use modules do not exhibit the bug.

      Steps to reproduce:

      Create a new default Titanium Mobile project. Run in simulator to show that it is working correctly (you can switch between tabs).
      Now, set analytics to false in tiapp.xml (just to rule that out as the cause).
      Then, fool your computer into thinking you have a network connection when you actually do not. The easiest way to do this is with Apple's Network Link Conditioner Preference pane. You will need to create a new profile with 0% bandwidth and 100% of up and down packets dropped.

      Confirm that your computer appears to have a network connection, but an attempt to access a web page yields NO response.

      Run the test app in the simulator. It works just as before.

      But finally, try adding a module to the project. I used ti.storekit for my testing. Also, be sure to actually require the module at the beginning of the app.js code.

      Run the app in the simulator, and you should find that it either hangs for a long time on the default splash screen, or that the window is unresponsive when you attempt to switch tabs-- for a long time or FOREVER.

      As I said, the conditions under which this bug would appear are fairly rare. Apps launch fine when the device knows there is no network connection, and they launch fine when the device HAS a network connection. Usually even when the connection is marginal, the app will eventually launch.

      But when the device (or simulator) thinks it has a connection but it actuality it does not, the app will hang at launch.
      If anyone could verify that they can reproduce this behavior, I will feel a little better that it is not something wonky on my end. Although, it still won't leave us with a solution yet.

      UPDATE

      When using Little Snitch to monitor network activity, it seems that my little test app STILL is trying to connect to api.appcelerator.com on port 443 at launch. This is even after analytics is set to FALSE in tiapp.xml

      Maybe this issue IS related to TIMOB-9090 (reported fixed) and TIMOB-2984 (still open).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                shossain Shak Hossain (Inactive)
                Reporter:
                lukebar Luke Bartolomeo
              • Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Git Integration