+2
Escalated

EXC_BAD_ACCESS on IL2CPP Asset Bundle

Wrathmage 1 year ago updated by Lazlo Bonin (Lead Developer) 10 months ago 9

Hi there!

Here in the company I work for, we're developing an application that is meant to be a hub for several minigames. All of the minigames are included into the main application after the user installed the app through AssetBundle, which is downloaded directly from our servers

All minigames are developed in different Unity Projects, therefore they doesn't have any access to the main project until they are downloaded into the main application

I know that isn't possible to send new scripts through Asset Bundle, so all of our scripts that the minigames could use are already compiled into the base application, which include the Bolt plugin

Whenever the main app is open, the user has an option to download new minigames and/or update the minigames he/she has already downloaded if there is any to be updated

When using an iOS device, whenever I try to open a minigame that has any bolt component, such as the FlowMachine attached in a GameObject for exemple, the app crashes. For Android, Windows and Mac it works just fine

I believe that this problem is related with Bolt, because we have minigames that does not have any bolt component and they work perfectly for Android, iOS, Windows and Mac.

I've tried several things in one minigame that had just one GameObject with the FlowMachine component attached to it (with and without the FlowMacro asset referenced), and thats enough to cause the crash. If the same minigame doesn't have the FlowMachine component attached, it works just fine

To solve the problem, I've tried:

  • Change the Unity version, but never below 2018.3.2f1 due to changes in the prefab system;
  • Do the AOT prebuild (Tools>Ludiq>AOT Pre-Build);
  • Disable the Strip Engine Code option when making the build of the main application an algo when generating the AssetBundle;
  • Enable and disable the AOT Safe Mode option under Ludiq options in the Unity preferences window
  • Put some delay between loading the AssetBundle and opening the Scene
  • Include into the application base all FlowMachines that is going to be used in the minigames (doing the AOT prebuild process before generating the build for Xcode)
  • Doing the Prebuild process before generating the AssetBundle
  • Disabling the option in xcode to recompile from bitcode
  • Using Macro and embed source into the FlowMachine component

The exception is always the same: EXC_BAD_ACCESS (SIGSEGV), always in the thread responsible for the Preload process

Crash report

According my research, this exception is related to missing references and object reference not set erros, but might be something else according with Unity

Has anyone tried something similar or has any idea how to solve this problem?

Bolt Version:
1.4.4
Unity Version:
2018.3.2f1
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
Pending Review

Hi Wrathmage,

Sorry you're experiencing this issue and for the late reply, I was away for the past two weeks.

After some quick research, it does indeed sound like EXC_BAC_ACCESS is related to null reference exceptions. However, from the crash report that you sent me, I cannot see how they are related to Bolt. Can you enable Developer Build so that you can get a managed stack trace? More information about how to do this in the second section of the Unity manual here: https://docs.unity3d.com/Manual/TroubleShootingIPhone.html

Thanks!

Hi Lazlo,

Thank you for the reply

I don't have much experience debuging for iOS, but I think I got the managed stack trace, but I tested some Android build using IL2CPP as scripting backend and I got the same behaviour. I think this problem could be related to the scripting backend or the AOT process

Managed stack trace.rtf

Printscreen

Android stack trace

Need More Information

Hi Wrathmage,

Thanks for following up with more logs.

Sadly, I can't seem to find any clue as to the cause of the problems from the logs. None of the stack traces point to either Bolt or Ludiq (except for the name of your custom object, "Bolt_Visual_Script").

First, I'd like to determine whether this is a problem with AOT in general (which would affect any IL2CPP platform) or with iOS specifically. You mentioned the Android build works. When building for Android, are you using the IL2CPP or the Mono runtime? (IIRC only IL2CPP is allowed, but googling further I'm not so sure anymore).

On one hand, if you are using Mono, can you switch your Android build to IL2CPP runtime and tell me whether you still get the same issue?

On the other hand, if you are already using IL2CPP on your Android build, it means the issue is iOS specific. At this point, all I can recommend is filing a bug report with Unity, as I don't have the debugging access or experience to interpret native pointer errors like those on a specific platform.

Hi Lazlo

Oh, that's no good....

Answering to your question, yes, I had build for Android with il2cpp and the same error has occurred

Hi Wrathmage,

Thanks for the followup.

Since this is an AOT/IL2CPP bug, Going forward, I can test the issue on our end by building for Standalone with IL2CPP enabled. I'd need either:

  • Reproduction steps to recreate the issue from a new project OR
  • Project files that trigger the bug sent to support@ludiq.io

Hi Lazlo

I've sent the project files alongside more info for the given email