LiquidPlayer / LiquidCore

Node.js virtual machine for Android and iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crashes with iOS 12.3.1 on XCode 10.1

umangkathuria opened this issue · comments

Hi,

I have been facing an issue with the latest iOS version- 12.3.1.
I have a simple application which uses LiquidCore to communicate with the NodeJS layer of the app. We ran the same ipa file on different versions of iOS, on iOS12.3.1 we found that the application launches successfully.. and there after as soon as I click the button which internally calls JavaScript code, the application crashes.

I tried looking into the logs and console of the device, and this is the error message that we get at the time application crash-

Can't get most elevated app state from dictionary {
BKSApplicationStateExtensionKey = 0;
SBApplicationStateDisplayIDKey = “com.my.bundle.identifier”;
SBApplicationStateKey = 0;
SBApplicationStateProcessIDKey = 1595;
SBApplicationStateRunningReasonsKey = (
{
SBApplicationStateRunningReasonAssertionIdentifierKey = Resume;
SBApplicationStateRunningReasonAssertionReasonKey = 10000;
}
);
}

I ran the same app while my device connected i.e. without creating the iPA, and the application runs fine.
Its just that whenever I use the ipa, the application crashes the very moment I call the JavaScript code.

Can anyone help on this?
Has anyone seen this issue ?
Any thoughts or ideas are welcomed!

Thanks in advance for the help.
@ericwlange @Neusoft-Technology-Solutions @j0j00

@ericwlange Any thoughts on this please ?

Has anyone come across this issue ?

Thanks!

I am not finding a lot of information from Googling this error. Are you using version 0.6.2 of LiquidCore?

The reason I ask is because of this thread: https://forums.xamarin.com/discussion/155919/ios-crash-using-testflight-release-configuration

It was caused because a library was using non-public functions. Versions 0.6.1 and below used private JavaScriptCore API calls (see #108), which is fixed in the latest release.

Otherwise, can you post the entire stack trace?

@ericwlange - We are currently using 0.6.2.

Hey @ericwlange , we are using 0.6.2.
We are facing this issue on 12.3.1.
ipa is launched successfully on 12.3.1 but when the app communicate to LiquidCore for ex. clicking on event button then the app crashes.

Please help us on this issue!!!

Thanks in advance.

CrashLogs - August 1.txt

Here is the complete crashlog from the device.

@umangkathuria @Pooja16Fartyal

Unfortunately, there isn't a lot of information in the crash logs, and the change log for 12.3.1 does not seem in any way relevant: https://support.apple.com/en-us/HT209084#1231

I will try to see what's happening, but at the moment I have no timeframe to give. If you discover anything else that may seem remotely useful, please add them to this thread.

@umangkathuria @Pooja16Fartyal

Also, can you try creating the IPA in debug mode and see if you get the same result? The crash logs will have a better stack trace.

https://stackoverflow.com/a/17282949

@ericwlange , We tried by creating iPA in debug mode but unfortunately the result is same.
Here’s the error from device console-
Can't get most elevated app state from dictionary {
BKSApplicationStateExtensionKey = 0;
SBApplicationStateDisplayIDKey = "com.accenture.mobility.appfactory.dev.subway";
SBApplicationStateKey = 0;
SBApplicationStateProcessIDKey = 342;
SBApplicationStateRunningReasonsKey = (
{
SBApplicationStateRunningReasonAssertionIdentifierKey = Resume;
SBApplicationStateRunningReasonAssertionReasonKey = 10000;
}
);
}

Thread 10 Crashed:
0 libsystem_kernel.dylib 0x00000001be0fe0dc __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001be17b9b0 pthread_kill$VARIANT$armv81 + 296
2 libsystem_c.dylib 0x00000001be057ea8 abort + 140
3 libsystem_c.dylib 0x00000001be025b58 basename_r + 0
4 LiquidCore 0x0000000102fced54 0x102cd0000 + 3140948
5 LiquidCore 0x0000000102f95ccc 0x102cd0000 + 2907340
6 LiquidCore 0x0000000102f96b54 0x102cd0000 + 2911060
7 LiquidCore 0x0000000102e06814 0x102cd0000 + 1271828
8 LiquidCore 0x0000000102e0263c 0x102cd0000 + 1254972
9 LiquidCore 0x0000000102f30798 0x102cd0000 + 2492312
10 LiquidCore 0x0000000102f2e540 0x102cd0000 + 2483520
11 LiquidCore 0x0000000102f2e1c8 0x102cd0000 + 2482632
12 LiquidCore 0x0000000102f2ded0 0x102cd0000 + 2481872
13 LiquidCore 0x0000000102f31b88 0x102cd0000 + 2497416
14 libsystem_pthread.dylib 0x00000001be1802c0 _pthread_body + 128
15 libsystem_pthread.dylib 0x00000001be180220 _pthread_start + 44
16 libsystem_pthread.dylib 0x00000001be183cdc thread_start + 4

Can you please check the issue and help us resolve it quickly?

Hey @ericwlange

Did you get a chance to look into this issue?
Please help us to resolve this issue asap.

Thanks in advance for help!

@ericwlange - Just to check, while we are creating the IPA in Debug mode, is there a way to get more readable logs from LiquidCore's side. Some configuration we could add to get more logs for the crash from LiquidCore side. i.e. using LiquidCore in some equivalent develop/debug mode to understand the crash better.

Any help is appreciated!
Thanks!

@umangkathuria @Pooja16Fartyal @praveenkg85
I am having trouble finding time until the weekend. Just a reminder that this is a volunteer side project for me, so more sinister issues like this will take some time. I will try to make progress on it this weekend.

My basic debugging plan for things like this is to add console debug messages (printf() in iOS, or __android_debug_print() in Android) throughout the code to narrow down where the crash is happening, since we can't get any good information from the crash log. I know of no better way to do this. It is tedious and takes time. If you had the opportunity to attempt to do this to at least narrow down the function or method that is crashing, that would be a huge help. I know that V82JSC is extremely complex, so it may be difficult for you to debug and I'm the only one who understands what it is doing. But anything you can do to reduce the search space would be a big help.

Is this only failing on 12.3.1? What about 12.4?

My Xcode does not even give me the option to install the 12.3.1 runtime. I ran my test app from an .ipa (both release and debug modes) on 12.4 and it ran with no trouble.

Screen Shot 2019-08-24 at 6 00 29 PM

Can you validate if this issue only exists on 12.3.1 or other versions as well? I don't have any hardware with that version, unfortunately.

Actually, I take that back. I found that I have an iPad with 12.3.1 on it. I am also not getting any crashes. Do you have a simple app that can demonstrate the crash?

@umangkathuria @praveenkg85
If you have created a debug IPA, it should contain the symbols so that the stack trace is more readable. It should only require going to Product -> Scheme -> Manage Schemes, select Edit... on your app, and change "Archive" Build Configuration to "Debug". And then you can archive.

Is this the process you followed?

@ericwlange
Here's the sample app that we found to be crashing on iOS 12.3.1 : https://github.com/umangkathuria/LiquidCoreSampleApp

After creating and installing the IPA in the device, as soon as we hit the "Call JS Function" button, the application crashes. The expected scenario would be to get an alert on screen showing the response received from the JS.

If you are able to get the success response, please do let us know the exact configuration you kept for creating the IPA.

Just want to re-iterate that the application doesn't crash when we install it directly in a device, i.e. by not creating the IPA and directly connecting the device and then installing it on it.

Please let us know if you need any more information.

Thanks for the help!

@ericwlange - Regarding the process for builds, we tried both release and debug and both had same logs and they both crashed. I can't share the IPA directly due to profiling issues. May be the sample code will help us understand better where the issue lies.

@umangkathuria My iPad updated itself, so I no longer have 12.3.1, but I built, archived, exported and copied the IPA to my 12.4 device and it worked just fine. ¯\(ツ)

IMG_0001

IMG_0002

Screen Shot 2019-08-31 at 9 53 42 AM

I also tried release mode, same result. What I did:

XCode 10.3 (10G8)
iOS 12.4

Select Liquidcore_SampleApp > General iOS Device
Product->Archive
Distribute App -> Ad Hoc
App Thinning: None
x Rebuid from Bitcode
x Strip Swift Symbols
o Include manifest for over-the-air installation
Automatically manage signing
(I had to change the Team to my own)

SUMMARY
Team: Eric Lange
Certificate: iOS Distribution (Expires 8/23/20)
Profile: iOS Team Ad Hoc Provisioning Profile: *
Architectures: arm64

ENTITLEMENTS
keychain-access-groups
CXSA8L9LJ3.com.umangkathuriaapps.LiquidCore-SampleApp
com.apple.developer.team-identifier
CXSA8L9LJ3
application-identifier
CXSA8L9LJ3.com.umangkathuriaapps.LiquidCore-SampleApp
get-task-allow
false

Export -> Export

Devices -> Click '+'
Selected the exported Liquidcore_SampleApp.ipa, Open

Icon showed up on my iPhone
Disconnected cable (just to be sure)
Opened the app
Tapped on "Call JS Function"

It worked. No crash.

@ericwlange thanks for a quick response.
Would it be possible for you to share the IPA ? I can run it on my 12.3.1 device and rule out the a few possibilities. Probably will help in narrowing down the root cause. Also, if possible, share the dSYM file as well? If there is a crash at my end then from crash logs, may be I can symbolicate it and try to find better logs ?

Build procedure:

cd JavaScriptCode/Factorial
npm install
npm run bundler -- --platform=ios
cp liquid.bundle ../../LiquidCore_SampleApp
cd ../..
pod install

Opened workspace, and then used process described above.

I will send the ipa by email

Nevermind, I zipped it here.

LiquidCore_SampleApp.zip

thanks, will let you know if its a success or not!

hey @ericwlange ! The IPA couldn't be installed since I keep getting "A Valid provisioning file was not found for this executable".
Can you create IPA in some other way that would be installable ? Did you choose iOS Developer while signing or iOS Distribution. I was looking up on internet and found that iOS Developer should be set and also if you can build using the Legacy Build System( From here - https://stackoverflow.com/questions/52424462/xcode-10-a-valid-provisioning-profile-for-this-executable-was-not-found).

Or any way this IPA can be installed ?

I think you will have to give me the UDID of the device you want it installed on and I can add it to my provisioning profile. Apple doesn't make this easy.

@ericwlange - is eric@flicket.tv the correct email address? or do you want me send the UDID on some other ID ?

@umangkathuria Yes, please send any UDIDs that you would like me to provision to the flicket email. I think I can add them dynamically and shouldn't have to recreate the ipa, but not 100% sure.

@ericwlange Sent UDID in your email.
I think we'll need a new build since the updated build will have the updated profile details. Could you please share the fresh build again?
This is what I found related to the same query- https://stackoverflow.com/questions/46269617/after-adding-new-udids-to-provisioning-profile-do-i-need-to-rebuild-the-ipa

Thank you so much for all the help and the extra effort! Appreciate it!

@umangkathuria Ok, please give this one a try.

LiquidCore_SampleApp.zip

This worked just fine! iOS 12.3.1 and No Crashes at all. I need to figure out the difference in the build process to understand the root cause. Will post my findings here in case someone else faces the same issue.

Thanks a lot!

@umangkathuria Very confusing. I would be interested in what you find.

Eric, after following the steps you mentioned above, my build also worked fine.
The only significant difference that we are able to point out to is that we were building with xCode 10.1 and it was crashing. This time as you tried it with xCode 10.3, we tried the same thing and it worked i.e. IPA created using xCode 10.1 crashed on run time as we called the JavaScript code whereas IPA created using xCode 10.3 ran successfully.

Could this be specific to LiquidCore, may be at a lower level or some library that we use. I remember we had some issues with iOS 12.2 where in JavaScriptCore Library got updated and a few symbols were added(kJSTypeSymbol). Could these be related ?

Hard to tell. I can try to replicate this on 10.1 and see if I can track down the issue. BUT, is there any reason to do so? Is there some reason (with clients, perhaps?) why you need to work with 10.1 and not upgrade to the latest XCode?

For now, the best workaround is just to upgrade to the latest XCode.

Yes, that's the reason I asked. There are certain issues due to which I can't upgrade to 10.3 for now.
Could you please give it a try ?

@ericwlange - Any update ?

@umangkathuria No sorry, I have not had a chance to look at it. The priority is lower for me now, considering there is a viable workaround for most use cases.

Closing.