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

x/mobile: loading libgojni.so prevents android errors from printing to logcat #9482

Closed
dskinner opened this issue Dec 31, 2014 · 3 comments
Closed

Comments

@dskinner
Copy link
Member

Given a libgojni.so that is loaded via Go.init(this) in Application class can cause regular app errors to not print to logcat.

I've seen this behavior using the v7 RecyclerView and not setting a layout manager which would normally print an error to logcat and exit. Instead, the go runtime starts and is followed by a WIN DEATH and nothing is printed in regards to the RecyclerView error.

Disabling Go.init(this) and any other related Go code will allow the error to print to logcat.

I can put together a minimal sample upon request if the above is not clear enough.

@crawshaw
Copy link
Member

By WIN DEATH, do you mean the process exited? If so, that's why you're not seeing any subsequent errors.

I'd need more information to guess why your application is crashing. A copy of the log and some code would be helpful.

@dskinner
Copy link
Member Author

dskinner commented Jan 1, 2015

Here is a minimal sample application with the libgojni.so already built: https://github.com/dskinner/go.issue.9482

Built with go at 6ceb604
and gobind at 3d879bb1b3c296099c6d8ea545d18e259aab1f2d

Tested on a Nexus 10 running Android 5.0.1

This line is intentionally commented out to produce an error: https://github.com/dskinner/go.issue.9482/blob/master/app/src/main/java/cc/dasa/sample/MainActivity.java#L19

In the repo, the shared library is not loaded as can be seen here: https://github.com/dskinner/go.issue.9482/blob/master/app/src/main/java/cc/dasa/sample/App.java#L11

This produces the following stack trace as expected

01-01 11:52:10.612    7316-7316/cc.dasa.sample E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: cc.dasa.sample, PID: 7316
    java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView$LayoutManager.onMeasure(android.support.v7.widget.RecyclerView$Recycler, android.support.v7.widget.RecyclerView$State, int, int)' on a null object reference
            at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:1764)
            at android.view.View.measure(View.java:17430)
            at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:727)
            at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:463)
            at android.view.View.measure(View.java:17430)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
            at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
            at android.view.View.measure(View.java:17430)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
            at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
            at android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
            at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
            at android.view.View.measure(View.java:17430)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
            at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
            at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2560)
            at android.view.View.measure(View.java:17430)
            at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2001)
            at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1166)
            at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1372)
            at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
            at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
            at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
            at android.view.Choreographer.doCallbacks(Choreographer.java:580)
            at android.view.Choreographer.doFrame(Choreographer.java:550)
            at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
            at android.os.Handler.handleCallback(Handler.java:739)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

Once this line is uncommented: https://github.com/dskinner/go.issue.9482/blob/master/app/src/main/java/cc/dasa/sample/App.java#L11

Launching the application produces the following output:

01-01 12:02:45.003      400-413/? I/ActivityManager﹕ START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=cc.dasa.sample/.MainActivity (has extras)} from uid 10012 on display 0
01-01 12:02:45.072     400-2043/? I/ActivityManager﹕ Start proc cc.dasa.sample for activity cc.dasa.sample/.MainActivity: pid=8117 uid=10079 gids={50079, 9997} abi=armeabi-v7a
01-01 12:02:45.098    8117-8117/? I/art﹕ Late-enabling -Xcheck:jni
01-01 12:02:45.182    8117-8117/cc.dasa.sample W/linker﹕ libgojni.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
01-01 12:02:45.222    8117-8134/cc.dasa.sample I/Go﹕ app.Run
01-01 12:02:45.224    8117-8134/cc.dasa.sample I/go/Seq﹕ loaded go/Seq
01-01 12:02:45.225    8117-8117/cc.dasa.sample I/Go﹕ Runtime started
01-01 12:02:45.374     400-2043/? I/art﹕ Explicit concurrent mark sweep GC freed 54700(2MB) AllocSpace objects, 21(4MB) LOS objects, 28% free, 40MB/56MB, paused 1.031ms total 92.567ms
01-01 12:02:45.380    8117-8141/cc.dasa.sample D/OpenGLRenderer﹕ Render dirty regions requested: true
01-01 12:02:45.384    8117-8117/cc.dasa.sample D/Atlas﹕ Validating map...
01-01 12:02:45.409      400-413/? I/WindowState﹕ WIN DEATH: Window{1c8f3738 u0 cc.dasa.sample/cc.dasa.sample.MainActivity}
01-01 12:02:45.441      130-130/? I/Zygote﹕ Process 8117 exited due to signal (11)
01-01 12:02:45.461      400-979/? I/ActivityManager﹕ Process cc.dasa.sample (pid 8117) has died
01-01 12:02:45.462      400-979/? W/ActivityManager﹕ Force removing ActivityRecord{123fa723 u0 cc.dasa.sample/.MainActivity t513}: app died, no saved state
01-01 12:02:45.483     909-1094/? D/mali_winsys﹕ new_window_surface returns 0x3000

Noticeably, the stacktrace for the recyclerview error is lacking above.

It's worth noting I suppose that setting the layoutmanager for recyclerview and loading the libgojni.so does allow the application to launch successfully.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title mobile: loading libgojni.so prevents android errors from printing to logcat x/mobile: loading libgojni.so prevents android errors from printing to logcat Apr 14, 2015
@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015
@rsc rsc removed the repo-mobile label Apr 14, 2015
@dskinner
Copy link
Member Author

dskinner commented Sep 1, 2017

unable to reproduce on latest, closing.

@dskinner dskinner closed this as completed Sep 1, 2017
@golang golang locked and limited conversation to collaborators Sep 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants