Vungle Plugin on iOS Crashes 3 Minutes After Suspend (active assertions beyond permitted time)

Hi there,

The Vungle plugin is causing a crash on iOS three minutes after an app using it is suspended.  I believe what’s happening is that Vungle is registering some sort of background process (e.g., to download videos) that isn’t being cleaned up properly on suspend.  From some posts on StackOverflow, 180 seconds (three minutes) is the limit for such activities to run, which is why the crash is occurring then.

Here is a simple project that reproduces the bug.  (Add your Vungle key to ads.init.)

build.settings

settings = { plugins = { ["CoronaProvider.ads.vungle"] = { publisherId = "com.vungle" } } }

main.lua

local ads = require("ads") ads.init("vungle", "YOUR VUNGLE KEY HERE") local onSystemEvent = function(event) for k,v in pairs(event) do print(k,v) end end Runtime:addEventListener("system", onSystemEvent)

Steps to reproduce the crash:

  • Build and install.  I built with Corona 2371 and installed on an iPhone 5 running iOS 7.1.2
  • Launch the app, then suspend it.  In the Xcode console, you’ll see the application start and suspend events fire
  • Wait three minutes plus a few seconds
  • In the Xcode console, you’ll see a crash

Sample crash report (unrelated log lines have been removed):

Jul 30 07:53:05 Andrews-iPhone-5 Test[2365] \<Warning\>: name system Jul 30 07:53:05 Andrews-iPhone-5 Test[2365] \<Warning\>: type applicationStart Jul 30 07:53:16 Andrews-iPhone-5 Test[2365] \<Warning\>: name system Jul 30 07:53:16 Andrews-iPhone-5 Test[2365] \<Warning\>: type applicationSuspend Jul 30 07:56:17 Andrews-iPhone-5 backboardd[28] \<Warning\>: Test[2365] has active assertions beyond permitted time: {( \<BKProcessAssertion: 0x1658ef40\> identifier: Called by Test, from machineName process: Test[2365] permittedBackgroundDuration: 180.000000 reason: finishTask owner pid:2365 preventSuspend preventIdleSleep preventSuspendOnSleep )} Jul 30 07:56:17 Andrews-iPhone-5 backboardd[28] \<Warning\>: Forcing crash report of Test[2365]... Jul 30 07:56:18 Andrews-iPhone-5 backboardd[28] \<Warning\>: Finished crash reporting. Jul 30 07:56:18 Andrews-iPhone-5 backboardd[28] \<Warning\>: pid\_suspend failed for [2365]: Unknown error: -1, Unknown error: -1 Jul 30 07:56:18 Andrews-iPhone-5 com.apple.launchd[1] (UIKitApplication:com.aukstudios.test[0xf65c][2365]) \<Notice\>: (UIKitApplication:com.aukstudios.test[0xf65c]) Exited: Killed: 9 Jul 30 07:56:18 Andrews-iPhone-5 backboardd[28] \<Warning\>: Application 'UIKitApplication:com.aukstudios.test[0xf65c]' exited abnormally with signal 9: Killed: 9 Jul 30 07:56:18 Andrews-iPhone-5 ReportCrash[2368] \<Notice\>: Saved crashreport to /var/mobile/Library/Logs/CrashReporter/Test\_2014-07-30-075617\_Andrews-iPhone-5.ips using uid: 0 gid: 0, synthetic\_euid: 501 egid: 0

I’ve also observed this crash on Corona 2256 and iOS 7.0.2 from a build of mine over two months old, so I don’t think it’s a recent regression bug in the plugin but rather a bug that’s been there for some time that we just didn’t notice.

It would be great if anyone else in the community could try this and verify what I’m seeing.

Thanks.

  • Andrew

Hi Andrew,

I’ve just tested and got no such crash.  I use an iPod Touch 4th generation running iOS 6.1.6 and Corona SDK version 2317

I waited 4 minutes and did a suspend and resume with no problem.

After resume I watched a live (non test) Vungle video and then played for over 3 minutes and again suspended and resumed with no crash. 

Still, I’m concerned as my customers running on newer hardware with a more recent OS may be experiencing what you are…

Best,

Martin.

Hi Martin, thanks for testing.

My understanding is that the background process limit is 3 minutes on iOS 7 but is 10 minutes on iOS 6 (http://stackoverflow.com/questions/22679845/ios7-background-task-myapp-has-active-assertions-beyond-permitted-time).  Since you’re using iOS 6, would you mind trying again but this time waiting 10 minutes instead of 3?

  • Andrew

Hi Andrew,

I played my game for 11 minutes and then did a suspend and resume. Still works - no crash on resume.

You could alert Chris Mock at Vungle to this thread. I’ve found Chris to be very helpful in the past.

Best of luck!

Martin.

Hi Martin. Thanks for checking again. My original post may not have been clear. You shouldn’t play the game for 3 (or 10) minutes. Instead, you should launch it, then exit and leave it suspended for 3 (or 10) minutes. The crash occurs *while* the app is suspended. Thus, it’s not horrible from a user experienxe standpoint, but it’s still not good behavior.

Hi Andrew,

This won’t be much use but…

So, I launched the game, exited and restarted just over 10 minutes later. The game started from the very start - not a resume - and there were no errors/crashes/Vungle issues.

Martin.

Hi Andrew and all,

Let me reproduce this on our test iPhone 5 running iOS 7.1.2 and see what we can find. ~Chris

Hi Andrew, 

Currently, our iOS Corona plugin is on SDK 308. We have a fix for this issue in 309, which is currently in QA. Should be done pretty soon, then we’ll push it out :slight_smile:

Cheers,

Jordyn

Vungle 

Tech Support Engineer

Thanks Chris and Jordyn for taking a look and confirming a fix is on the way.  If possible, would you mind updating this thread when version 309 is pushed?  Unfortunately, Corona doesn’t provide us visibility when plugins are updated (though it’s something I’ve chatted with them about improving), so if you have a chance to post on this thread, that would be fantastic.

  • Andrew

We have 3.0.9 available on our dashboard which also means we sent it over to our partners. However, I do not have an exact timeframe when Corona will have it up. Vungle//Chris

Thanks for the update!

Corona team, it would be great if you could reply on this thread when the version 3.0.9 Vungle plugin for iOS that Chris just mentioned is actually up on Corona’s servers.

  • Andrew

Hi Andrew, 

We pushed 309 yesterday, so if you’re on the newest version of Corona, it should auto-update to 309 :slight_smile:

Jordyn / Vungle 

Thanks Jordyn.  I’ve just retested this and I’m still seeing the crash.  I retested using the same code as my original post, but this time on Corona 2393 (latest public release) and an iPad 3 running iOS 7.0.4.

Is Vungle 309 set to have a minimum Corona version even higher than Corona 2393 (latest public release)?  If so, that would explain why I’m still seeing the crash, in which case I’ll try again with an even newer daily build.  If not, then it suggests to me that while you pushed Vungle 309, and hasn’t been integrated into the Corona build process yet for some reason.

  • Andrew

Hi Andrew, 

So sorry about that! We had a miscommunication over here, but apparently we have not pushed 309 to the public Corona repo, just the one we do testing on. I will update here again when it is ready. 

Thanks!

Jordyn/Vungle

My Crash report

Aug 18 14:22:24 Designer-iPad nomsnombers[264] <Warning>: called when add is viewed

Aug 18 14:22:24 Designer-iPad nomsnombers[264] <Warning>: Corona ads ended

Aug 18 14:22:24 Designer-iPad nomsnombers[264] <Warning>: vungleVideoCompleted called

Aug 18 14:22:24 Designer-iPad nomsnombers[264] <Warning>: freeReviveGotAnimation called

Aug 18 14:22:24 Designer-iPad AppStore[265] <Warning>: [SSMetricsEventController] Direct-access controller is calling through XPC to flush Unreported Events

Aug 18 14:22:24 Designer-iPad AppStore[265] <Warning>: [SSMetricsEventController] Direct-access controller is calling through XPC to flush Unreported Events

Aug 18 14:22:26 Designer-iPad ReportCrash[266] <Notice>: ReportCrash acting against PID 264

Aug 18 14:22:26 Designer-iPad ReportCrash[266] <Notice>: Formulating crash report for process nomsnombers[264]

Aug 18 14:22:27 Designer-iPad com.apple.launchd[1] (UIKitApplication:com.funzytime.nomsnombers[0x654e][264]) <Warning>: (UIKitApplication:com.funzytime.nomsnombers[0x654e]) Job appears to have crashed: Segmentation fault: 11

Aug 18 14:22:27 Designer-iPad backboardd[29] <Warning>: Application ‘UIKitApplication:com.funzytime.nomsnombers[0x654e]’ exited abnormally with signal 11: Segmentation fault: 11

Aug 18 14:22:27 Designer-iPad mediaserverd[45] <Warning>: Encountered an XPC error while communicating with backboardd: <error: 0x3a1fa744> { count = 1, contents =

“XPCErrorDescription” => <string: 0x3a1fa9dc> { length = 22, contents = “Connection interrupted” }

}

Aug 18 14:22:27 Designer-iPad ReportCrash[266] <Notice>: Saved crashreport to /var/mobile/Library/Logs/CrashReporter/nomsnombers_2014-08-18-142226_Designer-iPad.plist using uid: 0 gid: 0, synthetic_euid: 501 egid: 0

Aug 18 14:22:27 Designer-iPad mediaserverd[45] <Warning>: 14:22:27.799 [0x23cc000] CMSession retain count > 1! 

Hi everyone! I’ve just tested and looks like 309 is ready :slight_smile: Should fix the background crashes we’ve been seeing.

Jordyn / Vungle

@Andrew

Did the latest Vungle plugin fix the crash after 3 minutes suspend?  I am still seeing my iOS app restart rather than resume after being suspended for several minutes.  I use the Vungle plugin with the latest daily build, but I’m also using several other plugins so I’m curious to know if the issue has been fixed for you before I try to track down any other possible culprits.  Thanks for any info you can provide.

-Stephen

Hi Stephen,

I just checked using my simple test project from the top of this thread, and no, the latest Vungle plugin didn’t fix the issue.  (My test project includes only Vungle, so it’s definitely Vungle that’s the problem.)

Chris or Jordyn, it would be great if you could chime back on on this thread and confirm whether you can reproduce the issue.

Thanks.

  • Andrew

Thanks for checking Andrew.

Yes, could someone from Vungle please chime in?  I’m pushing an update to my app soon and would like to continue to use Vungle.

Thanks,

-Stephen

Hi everyone, 

We thought we had fixed this issue in 3.0.9, but we actually fixed it in 3.0.10. So sorry for the hassle- 3.0.10 is in QA, and I’ll let you know here when it’s pushed to Corona.

Jordyn / Vungle