Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

application crash #5

Closed
gryzor2 opened this issue Feb 19, 2016 · 10 comments
Closed

application crash #5

gryzor2 opened this issue Feb 19, 2016 · 10 comments

Comments

@gryzor2
Copy link

gryzor2 commented Feb 19, 2016

Thanks for this simple and nice game :)

If i change the color number to max, and grid size to 22x22, the application tends to crash at the moment I complete the flood.

@hejops
Copy link

hejops commented Feb 19, 2016

I get the same issue.

@GunshipPenguin
Copy link
Owner

I believe I'm aware of the bug causing the crash you mentioned, although I haven't managed to track down the cause exactly. Could you provide me with a stacktrace?

@Jibec
Copy link

Jibec commented Feb 23, 2016

same issue here, it's easy to reproduce : play the game in 24*24 with 3 color which is quite easy.
The last or "before last" moves always crash.

@GunshipPenguin
Copy link
Owner

I can't be fully sure of the crash that's happening on your devices because I don't have a stacktrace, but I'm fairly sure that this is a stackoverflow error due to seeing almost exactly the same problem on my friend's phone.

Because I can't replicate this error on my phone, can one of you try building the app from the iterative_floodfill branch, installing it to your device and seeing if that solves the problem. I've replaced the recursive flood fill algorithm with an iterative one on that branch, which should solve the problem.

@hashar
Copy link

hashar commented Feb 24, 2016

I have reproduced it thanks to the instruction above. 24x24 grid with 3 colors. One of the very last move caused the application to quit and the Android popup Application "Open Flood" as stopped (rough translation from french) and the OK button.

I had adb logcat running and that is definitely a stack overflow:

02-24 21:27:10.322 I/Keyboard.Facilitator(  544): onFinishInput()
02-24 21:27:40.377 I/dalvikvm(19021): threadid=1: stack overflow on call to Lcom/gunshippenguin/openflood/Game;.floodFill:VIIII
02-24 21:27:40.377 I/dalvikvm(19021):   method requires 28+20+20=68 bytes, fp is 0x40eb2334 (52 left)
02-24 21:27:40.377 I/dalvikvm(19021):   expanding stack end (0x40eb2300 to 0x40eb2000)
02-24 21:27:40.377 I/dalvikvm(19021): Shrank stack (to 0x40eb2300, curFrame is 0x40eb7ec4)
02-24 21:27:40.377 D/AndroidRuntime(19021): Shutting down VM
02-24 21:27:40.377 W/dalvikvm(19021): threadid=1: thread exiting with uncaught exception (group=0x41d60930)
02-24 21:27:40.455 D/dalvikvm(19021): GC_CONCURRENT freed 266K, 3% free 9726K/10024K, paused 4ms+6ms, total 30ms
02-24 21:27:40.478 E/AndroidRuntime(19021): FATAL EXCEPTION: main
02-24 21:27:40.478 E/AndroidRuntime(19021): java.lang.StackOverflowError
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:79)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:79)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:79)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:79)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:79)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:77)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:79)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.floodFill(Game.java:78)
02-24 21:27:40.478 E/AndroidRuntime(19021):     at com.gunshippenguin.openflood.Game.fl
02-24 21:27:40.502 D/dalvikvm(19021): GC_CONCURRENT freed 768K, 8% free 9463K/10268K, paused 2ms+3ms, total 23ms
02-24 21:27:40.502 D/dalvikvm(19021): WAIT_FOR_CONCURRENT_GC blocked 17ms
02-24 21:27:40.517 W/ActivityManager(  391):   Force finishing activity com.gunshippenguin.openflood/.GameActivity
02-24 21:27:41.064 W/ActivityManager(  391): Activity pause timeout for ActivityRecord{42a82630 u0 com.gunshippenguin.openflood/.GameActivity}
02-24 21:27:41.705 I/ActivityManager(  391): No longer want com.android.vending (pid 18495): empty #17
02-24 21:27:51.705 W/ActivityManager(  391): Activity destroy timeout for ActivityRecord{42a82630 u0 com.gunshippenguin.openflood/.GameActivity}
02-24 21:27:59.994 I/ActivityManager(  391): No longer want com.google.android.gsf.login (pid 18190): empty #17
02-24 21:28:10.322 I/Keyboard.Facilitator.LanguageModelFlusher(  544): run()
02-24 21:28:10.322 I/Keyboard.Facilitator(  544): flushDynamicLanguageModels()
02-24 21:29:03.994 D/dalvikvm(13192): GC_CONCURRENT freed 389K, 6% free 9668K/10208K, paused 4ms+3ms, total 33ms
02-24 21:29:03.994 D/dalvikvm(13192): WAIT_FOR_CONCURRENT_GC blocked 17ms

My setup is irrelevant but:

Phone: Google Galaxy Nexus, rather old phone
Android: 4.2.1 stock one, updated OTA by provider somehow
open_flood: 1.1.0 from F-Droid repository added on Feb 12 2016

floodFill() being a recursive function which lacks some harness to prevent it from overflowing the stack. Most probably it is going too deep.

@Jibec
Copy link

Jibec commented Feb 25, 2016

If you give an apk, I can test, but I don't know anything about compilation for android.
I see hashar has a french configuration, same as I.

@hashar
Copy link

hashar commented Feb 25, 2016

On large boards with mostly the same color, the recursive algorithm goes to deep and the poor Android stack ends up filled.

The other filling algorithm would not suffer from that.b It does not fill the stack. So imho it is already fixed. Need testing of the new algo.

@GunshipPenguin
Copy link
Owner

I have merged the iterative_floodfill branch into master. The algorithm that I replaced the old recursive one with is pretty simple, works fine on my phone, and fixed this problem on another phone that I tested. I will be releasing 1.1.1 shortly which will contain the new algorithm.

If anybody finds any problems with the new algorithm, please open a new issue.

@hashar
Copy link

hashar commented Feb 28, 2016

F-Droid has pushed 1.1.1 (their page) which comes with the new iterative algorithm. That definitely fixed the uses cases mentioned on this issue.

Well done @GunshipPenguin

@Jibec
Copy link

Jibec commented Mar 2, 2016

same here, I confirm it's working fine with 1.1.1
Thanks @GunshipPenguin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants