Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
x/mobile/app: race condition between initSeq and user code #10903
app.run(...) in app/android.go closes mainCalled to signal callMain that it can return to call_main_and_wait, which returns to Go.run(), which finally returns from go.Go.init(), letting user code continue. If user code calls anything touching the seq machinery after the closing of mainCalled but before app.stateStart calls java.Init, a crash will happen. One such crash trace is copied in the end of this report.
It suffices to insert a time.Sleep(2*time.Second) just after the close(mainCalled) in app/android.go to allow calls from java into Go and thereby reproduce the bug:
I have yet to find a satisfactory fix; simply moving the close(mainCalled) just after the stateStart() call results in a panic: