adjust / corona_sdk

This is the Corona SDK of
http://www.adjust.com
6 stars 7 forks source link

It seems there LuaState has not been initiated yet #8

Closed bulupe closed 5 years ago

bulupe commented 6 years ago

https://github.com/adjust/corona_sdk/blob/c276ffc006704077c244a89f3c823f47487127c8/plugin/android/plugin/src/main/java/plugin/adjust/LuaLoader.java#L245

Hi there,

Thanks for the fast fix for previous report however now I am getting android errors at line 245; You can find new error details below and it might be worth to check this forum thread as well https://forums.coronalabs.com/topic/51956-android-issue-sending-events-from-java-to-lua/?p=270250

Thanks

Fatal Exception: java.lang.IllegalStateException: stack overflow at com.naef.jnlua.LuaState.lua_newtable(Unknown Source) at com.naef.jnlua.LuaState.newTable(Unknown Source) at com.ansca.corona.CoronaLua.newEvent(CoronaLua.java:99) at plugin.adjust.LuaLoader$1.executeUsing(LuaLoader.java:245) at com.ansca.corona.CoronaRuntimeTaskDispatcher$TaskEvent.Send(CoronaRuntimeTaskDispatcher.java:170) at com.ansca.corona.events.EventManager.sendEvents(EventManager.java:91) at com.ansca.corona.Controller.updateRuntimeState(Controller.java:308) at com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onDrawFrame(CoronaGLSurfaceView.java:425) at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1623) at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1378)

screen shot 2018-05-21 at 14 23 29
uerceg commented 6 years ago

Hi @bulupe

Thanks for the report and the description. Can you reproduce this error in you app? If yes, can you maybe give us the steps you take in your app in order to reproduce this?

bulupe commented 6 years ago

Hi @uerceg,

Unfortunately, I can not reproduce, this error report is from crashlytics. I have just released a new version 2 hours ago including your fixes with 20% rollout. It seems the previous error is not reported anymore however there is this new one.

Previous one was happening a lot but until full rollout I can not say how many users are affected by this one.

screen shot 2018-05-21 at 15 57 19
uerceg commented 6 years ago

@bulupe

Thanks for the details. We're investigating and attempting to reproduce the error, so far no luck. Will keep you posted in here on the progress.

uerceg commented 6 years ago

@bulupe

Also, trying to figure out what in particular might cause this issue in your app, so looking for an use case in your app that executes this code path. If you take a look at https://github.com/adjust/corona_sdk/blob/c276ffc006704077c244a89f3c823f47487127c8/plugin/android/plugin/src/main/java/plugin/adjust/LuaLoader.java, you'll see that the line that causes the problem is part of the dispatchEvent method. If you look for usages, you will see methods from LuaLoader.java that are using it, but each one of those should have it's equivalent in Lua interface as well.

Which of those methods does your app call from Lua?

Thanks in advance for answer.

bulupe commented 6 years ago

Hi there,

We are using init and trackEvent method but I think it might be related to this, we are sending events when we have an ad impression, like interstitial or rewarded android apps goes to suspended state when an interstitial or rewarded starts, do you think this is related?

Thanks

uerceg commented 6 years ago

Hm. We’ll try to test as close as we can to this state you described you app is at, but not sure how that relates to the stack trace you provided. I am not sure if that's the thing that might be causing this issue, but we'll try to check.

CoronaLua.newEvent (line 245) which is flagged as troublesome in LuaLoader.java is only being executed when our SDK wants to return something back to Lua world.

SDK initialisation and event tracking are usually one way streets, so flow only goes from Lua to native part and that should be it.

Moments in which SDK wants to pass something to Lua world is if you have implemented any of the callbacks inside of your Lua code which our SDK might trigger upon receiving information of interest for that callback:

Or if you are using any of these:

In case you are not using any of these methods, our Corona Android plugin should never invoke dispatchEvent method, thus line 245 shouldn't be executed.

With this described, is there any of these SDK functionalities which you might be using in your app and which might cause SDK to have need to send something to Lua world and cause troublesome line to be executed?

bulupe commented 6 years ago

Dear @uerceg ,

Thank you for detailed answer, we are using a few callback, some of them for debugging purposes and I am going to disable them. The ones I am going to remove are;

setEventTrackingFailureListener setEventTrackingSuccessListener

However I will leave setAttributionListener and it may also help us to deduce.

Thank you for your help.

uerceg commented 6 years ago

Yeah, that might help, especially having in mind that you seem to be facing this when event is being tracked. But even though that might solve your issue, there is still to investigate what is causing issue in your particular case.

Just to be sure if I understood your case - you are launching second from your original app and upon this launch, you are tracking event? If this is the case, are you first launching another app and then tracking even or you first track even from your original app and then start another one?

bulupe commented 6 years ago

No, I guess I could not tell correctly. There is just a single app and actually it is a game. So basically we use adjust for install tracking and also for better attribution we track some events so we can calculate which channel is working better for user attribution.

The events are fired when an Advertisement related event occurs like Video show, banner click, video click etc. However it seems that especially on Android platform our games goes to suspended mode when video starts and then it resumes when user close that advertisement.

I hope it is more clear right now.

uerceg commented 6 years ago

Yep, it is clearer. One more question. When advertisement is being displayed, are you in control of presenting this ad or some 3rd party code does it from your app? Wondering if display of this ad simply means that your app goes to background (in Android terms - current Activity just went through it’s onPause() method) or do you mean something else when saying suspended mode?

bulupe commented 6 years ago

Its a third party mediation tool which means tons of third party advertisiment SDK's are being involved. I guess it goes to background, I am saying suspended because I got Application Suspended event from Corona which probably means app goes background.

uerceg commented 6 years ago

Gotcha. Thanks for these clarifications, we’ll try to recreate flow you described and try to see if we can reach the source of the issue.

Until then, I think it is a fair guess that if you remove those callbacks you don’t really need in production, issue should not be happening. In case you do that, let us know if it helped and we’ll keep you posted in here about issue investigation progress.

bulupe commented 6 years ago

Sure, thanks.

bulupe commented 6 years ago

Hi @uerceg ,

The number of crash reports dropped I still got this error but it is really really rare.

screen shot 2018-05-23 at 16 55 30

Thanks

uerceg commented 6 years ago

Hi @bulupe

Thanks for the report. This is after removal of event callbacks? Can you match crash with app version that device has installed in time of crash (like, is there maybe a chance that these now sporadic and rare crashes are still from your app version that had callbacks and maybe these users still didn't update to newer version)?

bulupe commented 6 years ago

Yes, after removal however I could not remove all event callbacks I have attribution call back remaining. Application version is being tracked and this data is from the latest version, previous versions are still firing this error too much.

uerceg commented 6 years ago

Gotcha. Thanks for the update, we're investigating, still didn't manage to reproduce the crash, but will keep you posted in here on progress as soon as I have some update on the case.

uerceg commented 6 years ago

Hi @bulupe

I wanted to follow up on this one - we were investigating and testing firing of session/event callbacks and other method which are invoking code path which you saw in stack trace while app is in background (Corona fired applicationSuspend system event), but rather no luck in reproducing this crash at all.

How does it look like for you nowdays - still facing this issue or not anymore?

uerceg commented 5 years ago

Closing this one due to inactivity. Please feel free to reopen it in case issue still persists with our latest SDK version.