iossqlitejiratable-lockingjira-mobile-connect

Two way communication in JIRA Mobile Connect for ios crashes the app due to sqlite locking


I am using the latest tag named "tip" and I am using JIRA on demand.

I just incorporated JIRA mobile connect into my ios app and it is behaving a bit oddly i.e. it is going into an infinite loop and hangs my app. After turning the debug mode on and digging a bit deeper, I find the source of this problem is that the sqlite database table is locked.

The sequence of events is like follows:-

  1. I launched my app for the first time
  2. I created an issue successfully using JIRA mobile connect
  3. I shut down my app
  4. I updated the issue by adding comments in JIRA online via the web interface (to simulate a 2 way communication scenario)
  5. I re-started my ios app
  6. JMC gets the updates from JIRA rest api using https://xxxx.atlassian.net/rest/jconnect/1.0/issue/updates?sinceMillis=1408380024967&uuid=9371F70F-12CD-47EC-AB3E-4B0398FF453E&apikey=YYY&project=AAA- and it is able to find the updates that I had made in step 4
  7. Since it finds changes, JMCIssueStore.m calls updateWithData method which has logic in it i.e.[self createSchema:YES] which attempts to drop the existing 2 tables and recreate the schema.
  8. On the 1st table drop attempt i.e.[db executeUpdate:@"DROP table if exists ISSUE"], the database table is found to be locked and JMC goes in an infinite loop retrying to execute this statement.

I am unable to find any answers for this on the Atlassian Q&A portal or otherwise on the web and I find it surprising as surely other people using this should be having the same issue or I have done something obviously wrong in trying to integrate it.

Has anyone encountered this or something similar? As this is one of the key features for which I am using JIRA Mobile Connect, i really need to figure out if it is worth debugging Jira mobile connect for this or just giving up and doing it from scratch.


Solution

  • The whole issue stemmed from a documentation error in the integration process of JIRA Mobile Connect specifically step 9 here where they asked to exclude all the JMC files from using ARC - which I had done. This is the root cause of the problem.

    After going through the Angry Nerds Sample files and comparing it with my own, I realised they were exactly the same and still the Angry Nerds sample worked and mine didnt.

    I retraced all my integration steps and on reaching step 9, it struck me that when I was going through the code, there were no sign of any manual release statements - which was odd if the code was indeed not using ARC.

    I removed all my -fno-objc-arc flags from all the JMC files. And hey presto! the crashing issue isnt there anymore.