8000 Samsung Galaxy S5 Neo disconnects or seg faults. · Issue #8 · openstf/minicap · GitHub
[go: up one dir, main page]

Skip to content

Samsung Galaxy S5 Neo disconnects or seg faults. #8

Closed

Description

@Trugath

phone:

manufacturer: 'SAMSUNG'
model: 'SM-G903F'
version: '5.1.1'
abi: 'armeabi-v7a'
sdk: '22'
product: 's5neoltexx'

When using STF, if the video stream is viewed it works for a few frames then the phone is disconnected. STF complains of lost connection to minicap.

When trying minicap by itself it hangs and segfaults. output below.

output of minicap:

INFO: Using projection 1080x1920@1080x1920/0
INFO: (external/MY_minicap/src/minicap_22.cpp:240) Creating SurfaceComposerClient
INFO: (external/MY_minicap/src/minicap_22.cpp:243) Performing SurfaceComposerClient init check
INFO: (external/MY_minicap/src/minicap_22.cpp:250) Creating virtual display
INFO: (external/MY_minicap/src/minicap_22.cpp:256) Creating buffer queue
INFO: (external/MY_minicap/src/minicap_22.cpp:261) Creating CPU consumer
INFO: (external/MY_minicap/src/minicap_22.cpp:265) Creating frame waiter
INFO: (external/MY_minicap/src/minicap_22.cpp:269) Publishing virtual display
INFO: (jni/minicap/JpgEncoder.cpp:64) Allocating 6268932 bytes for JPG encoder
INFO: (jni/minicap/minicap.cpp:444) New client connection
Segmentation fault

If no connection is made; the output of minicap stops and, even after waiting a considerable amount of time, no OK is printed.

We have also tested against Samsung S4 and Oneplus One. Both of these function flawlessly. So it is just the S5 Neo that is causing us issues.

Activity

  1. changed the title [-]Samsung Galaxy S5 Neo Does not work.[/-] [+]Samsung Galaxy S5 Neo disconnects or seg faults.[/+] on Nov 5, 2015
  2. sorccu commented on Nov 5, 2015

    @sorccu
    Member

    If you're a business, consider becoming a hardware sponsor and send us the device. Otherwise there are some things we can try to check remotely, but it's very time consuming.

  3. Trugath commented on Nov 5, 2015

    @Trugath
    Author

    After streaming a few times the phone soft bricks and is only restart-able by removing the battery.

  4. Trugath commented on Nov 5, 2015

    @Trugath
    Author

    I reduced the projection from 1080x1920@1080x1920/0 to 1080x1920@540x960/0 and it is a lot more stable. It doesn't segfault immediately on connection when manually launched (it has seg faulted once)

    STF runs somewhat more stable with a half(quarter?) projection.

    I am guessing the seg faults and disconnections are from the overly-aggressive Samsung background app killer shooting minicap in the head for memory usage.

  5. sorccu commented on Nov 5, 2015

    @sorccu
    Member

    If you have NDK installed and can build minicap, try running this :

    adb logcat | ndk-stack -sym obj/local/arm64-v8a

    It should show a bit more details about where the error occurs.

  6. sorccu commented on Nov 5, 2015

    @sorccu
    Member

    Alternatively if you happen to be proficient with gdb, I can give you instructions to make it work.

  7. vbanthia-zz commented on May 9, 2016

    @vbanthia-zz
    Member

    Having same problem with my Samsung Galaxy A7 (2016) Device.

    Below is the device info.

    manufacturer: 'SAMSUNG',
    model: 'SM-A710F',
    version: '5.1.1',
    abi: 'armeabi-v7a',
    sdk: '22',
    product: 'a7xeltexx',
    display:
     { id: 0,
       width: 1080,
       height: 1920,
       xdpi: 403.4110107421875,
       ydpi: 403.0409851074219,
       fps: 59,
       density: 3
    }

    I read source code and found some comments regarding Samsung devices.

    // Set the display's real information. This cannot be accessed automatically
    // due to manufacturers (mainly Samsung) having customized
    // android::DisplayInfo. The information has to be gathered somehow and then
    // passed on here. Currently only the following properties are actually
    // used: width and height.
    virtual int
    setRealInfo(const DisplayInfo& info) = 0;
    };

    // Attempt to get information about the given display. This may segfault
    // on some devices due to manufacturer (mainly Samsung) customizations.
    int
    minicap_try_get_display_info(int32_t displayId, Minicap::DisplayInfo* info);

    I tried various permutation of display_info, but no success.

    Can you provide some instructions how to debug this using gdb? Below is my adb logcat result when it crashes.

    ********** Crash dump: **********
    Build fingerprint: 'samsung/a7xeltexx/a7xelte:5.1.1/LMY47X/A710FXXU1APAC:user/release-keys'
    pid: 19466, tid: 19468, name: Binder_2  >>> /data/local/tmp/minicap-devel/minicap <<<
    signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
    Stack frame #00 pc 00004214  /system/lib/libcutils.so (android_atomic_add+16)
    Stack frame #01 pc 0000edc7  /system/lib/libutils.so (android::RefBase::decStrong(void const*) const+10)
    Stack frame #02 pc 00029efb  /system/lib/libgui.so (android::sp<android::IBinder>::~sp()+18)
    Stack frame #03 pc 00030069  /system/lib/libgui.so (android::ConsumerBase::onFrameReplaced(android::BufferItem const&)+68)
    Stack frame #04 pc 0002bb39  /system/lib/libgui.so (android::BufferQueue::ProxyConsumerListener::onFrameReplaced(android::BufferItem const&)+26)
    Stack frame #05 pc 0002f157  /system/lib/libgui.so (android::BufferQueueProducer::queueBuffer(int, android::IGraphicBufferProducer::QueueBufferInput const&, android::IGraphicBufferProducer::QueueBufferOutput*)+590)
    Stack frame #06 pc 000346c7  /system/lib/libgui.so (android::BnGraphicBufferProducer::onTransact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+626)
    Stack frame #07 pc 0001a8b5  /system/lib/libbinder.so (android::BBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+60)
    Stack frame #08 pc 0001f96
    8000
    3  /system/lib/libbinder.so (android::IPCThreadState::executeCommand(int)+582)
    Stack frame #09 pc 0001fa87  /system/lib/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+38)
    Stack frame #10 pc 0001fac9  /system/lib/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+48)
    Stack frame #11 pc 00023c63  /system/lib/libbinder.so
    Stack frame #12 pc 000106a9  /system/lib/libutils.so (android::Thread::_threadLoop(void*)+112)
    Stack frame #13 pc 00010219  /system/lib/libutils.so
    Stack frame #14 pc 000174a7  /system/lib/libc.so (__pthread_start(void*)+30)
    Stack frame #15 pc 000154c3  /system/lib/libc.so (__start_thread+6)
  8. vbanthia-zz commented on May 9, 2016

    @vbanthia-zz
    Member

    And Also, my development environment is OS X right now with android ndk installed. I can build minicap but not shared libraries. In case if it is required to build shared libraries, I will setup that environment too knowing it will take forever.

  9. sorccu commented on May 9, 2016

    @sorccu
    Member

    I have gdb set up in a branch, let me see if i can cherry-pick it.

  10. sorccu commented on May 9, 2016

    @sorccu
    Member

    See https://github.com/openstf/minicap#debugging and the commit log. It's been almost one year since I last used it, but it worked OK.

  11. vbanthia-zz commented on May 9, 2016

    @vbanthia-zz
    Member

    Thanks, will try it :)

  12. sorccu commented on May 9, 2016

    @sorccu
    Member

    There was some reason I didn't commit it earlier. I don't remember and didn't find any useful notes in the commit log, unfortunately. It's possible you may have to build the shared libraries with additional debug options to see all symbols. Otherwise you might not see the symbol names but it should still work. Or, maybe the gdb.setup file needed a little manual tweaking.

  13. sorccu commented on May 9, 2016

    @sorccu
    Member

    I think I remember now. I was working on a version that didn't require the shared libs at all. It ended in a failure at the time, but only due to my limited knowledge of memory layouts and inner workings of C++ constructors/destructors. I still think it'd be possible with more research.

  14. vbanthia-zz commented on May 9, 2016

    @vbanthia-zz
    Member

    yeah, able to run gdb debugger now. There has been some changes in latest ndk version (r11c).

    gdbclient path has been changed to $NDK_ROOT/prebuilt/darwin-x86_64/bin/gdb from "$NDK_ROOT/toolchains/.../arm-linux-androideabi-gdb"

    Very minute, you have written ndk.sh instead of gdb.sh in the README. Will improve docs, once I understand these all clearly.

    8000
  15. sorccu commented on May 9, 2016

    @sorccu
    Member

    Yeah, it worked with r10e (64-bit).

  16. 4 remaining items

  17. dkw72n commented on Nov 7, 2016

    @dkw72n
    Collaborator

    I happened to have a Samsung Galaxy Note4, and spent my last weekend on this issue.
    I got a conclusion, but it's kind of disappointing.
    The device is flashed with a 5.1.1 stock rom, which can be told from the crash log.
    Here is the crash log:

    --------- beginning of main
    I/DEBUG   ( 2870): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    I/DEBUG   ( 2870): Build fingerprint: 'samsung/trhpltexx/trhplte:5.1.1/LMY47X/N910UXXU2COJ2:user/release-keys'
    I/DEBUG   ( 2870): Revision: '13'
    I/DEBUG   ( 2870): ABI: 'arm'
    I/DEBUG   ( 2870): pid: 8834, tid: 12756, name: Binder_3  >>> /data/local/tmp/minicap <<<
    I/DEBUG   ( 2870): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
    I/DEBUG   ( 2870):     r0 ffffffff  r1 00000000  r2 b6f00d54  r3 b603b2e0
    I/DEBUG   ( 2870):     r4 00000000  r5 ffffffff  r6 b5bff674  r7 b5bff6dc
    I/DEBUG   ( 2870):     r8 00000001  r9 b5bff720  sl b5bff738  fp b60741f4
    I/DEBUG   ( 2870):     ip b6e31d64  sp b5bff648  lr b6e2a1cc  pc b6e2a1cc  cpsr 400b0010
    I/DEBUG   ( 2870):
    I/DEBUG   ( 2870): backtrace:
    I/DEBUG   ( 2870):     #00 pc 000041cc  /system/lib/libcutils.so (android_atomic_add+16)
    I/DEBUG   ( 2870):     #01 pc 0000edc7  /system/lib/libutils.so (android::RefBase::decStrong(void const*) const+10)
    I/DEBUG   ( 2870):     #02 pc 00029dcb  /system/lib/libgui.so (android::sp<android::IBinder>::~sp()+18)
    I/DEBUG   ( 2870):     #03 pc 0002fe49  /system/lib/libgui.so (android::ConsumerBase::onFrameReplaced(android::BufferItem const&)+68)
    I/DEBUG   ( 2870):     #04 pc 0002b97d  /system/lib/libgui.so (android::BufferQueue::ProxyConsumerListener::onFrameReplaced(android::BufferItem const&)+26)
    I/DEBUG   ( 2870):     #05 pc 0002ef5f  /system/lib/libgui.so (android::BufferQueueProducer::queueBuffer(int, android::IGraphicBufferProducer::QueueBufferInput const&, android::IGraphicBufferProducer::QueueBufferOutput*)+574)
    I/DEBUG   ( 2870):     #06 pc 000343cb  /system/lib/libgui.so (android::BnGraphicBufferProducer::onTransact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+610)
    I/DEBUG   ( 2870):     #07 pc 0001a8b5  /system/lib/libbinder.so (android::BBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+60)
    I/DEBUG   ( 2870):     #08 pc 0001f963  /system/lib/libbinder.so (android::IPCThreadState::executeCommand(int)+582)
    I/DEBUG   ( 2870):     #09 pc 0001fa87  /system/lib/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+38)
    I/DEBUG   ( 2870):     #10 pc 0001fac9  /system/lib/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+48)
    I/DEBUG   ( 2870):     #11 pc 00023c67  /system/lib/libbinder.so
    I/DEBUG   ( 2870):     #12 pc 000106a9  /system/lib/libutils.so (android::Thread::_threadLoop(void*)+112)
    I/DEBUG   ( 2870):     #13 pc 00010219  /system/lib/libutils.so
    I/DEBUG   ( 2870):     #14 pc 000174a7  /system/lib/libc.so (__pthread_start(void*)+30)
    I/DEBUG   ( 2870):     #15 pc 000154c3  /system/lib/libc.so (__start_thread+6)
    I/DEBUG   ( 2870):
    I/DEBUG   ( 2870): Tombstone written to: /data/tombstones/tombstone_0
    

    The reason it crashed is that the vtable of android::ConsumerBase::FrameAvailableListener in samsung is not agreed with the one in minicap. After the first frame arrived(in frame #03 above), instead of onFrameAvailable, the dtor is called.
    Sadly I failed to find a decent solution to this issue.

    Hope it helps.

    Nov-8,2016 update:
    There is a mistake in my previous post. The system is trying to call the onFrameReplaced instead of the onFrameAvailabe. onFrameReplaced is not in the source tree until 6.0.

  18. sorccu commented on Nov 7, 2016

    @sorccu
    Member

    Thanks, that's very useful information. It seems that it only happens on the 5.1.1 firmware, as practically all reports are from that version. Reports say the devices work after upgrading to 6.0.

    I'm fairly confident we can find a workaround once I have a little time to look into it.

  19. sorccu commented on Nov 7, 2016

    @sorccu
    Member

    @dkw72n and others Please consider joining our slack at https://openstf.slack.com/ :) Send me an email at simo @ {name of this github organization} .io and I'll invite you.

  20. dkw72n commented on Nov 8, 2016

    @dkw72n
    Collaborator

    @sorccu
    libgui.zip
    Attached is the libgui.so pulled from my device.

  21. sorccu commented on Nov 8, 2016

    @sorccu
    Member

    Actually I do see the onFrameReplaced method in the 5.1 source tree. So does the stack trace mean that it tried to call onFrameReplaced, but accidentally called the destructor instead?

  22. dkw72n commented on Nov 8, 2016

    @dkw72n
    Collaborator

    Not exactly, there are two steps actually:
    a. it tries to call onFrameReplaced, but call the dtor instead, this call returns without error.
    b. right after step a, it tries to decrease the reference count on the accidentally freed object.

    step b is what you saw in the stack trace, step a is the root cause.

  23. sorccu commented on Nov 8, 2016

    @sorccu
    Member

    These Samsung devices on 5.1.x should now work thanks to @dkw72n :)

  24. ledinhphuong commented on Nov 11, 2016

    @ledinhphuong

    @sorccu @dkw72n I verified with the latest code. So it still happens on my Samsung Galaxy Note4 device.

  25. sorccu commented on Nov 11, 2016

    @sorccu
    Member

    If you installed from source, did you remember to run npm install?

  26. ledinhphuong commented on Nov 12, 2016

    @ledinhphuong

    @sorccu I fetched the latest code from mainstream (don't use it via npm) and run minicap directly by ./run.sh autosize command.

  27. dkw72n commented on Nov 12, 2016

    @dkw72n
    Collaborator

    @ledinhphuong Appreciate if you could post the call stack and the /system/lib/libgui.so from your device.

  28. ledinhphuong commented on Nov 16, 2016

    @ledinhphuong

    @sorccu @dkw72n I tried to remove node_modules folder (in STF project) and run npm install again. So the issue is fixed on my device. Thanks.

    P.s: Here are npm ls of STF project: stf-node-modules.txt

  29. sorccu commented on Nov 16, 2016

    @sorccu
    Member

    That's great, thanks for the update!

    If you want to use minicap master in stf, you can do as follows.

    First, in the minicap repo:

    npm link
    

    (it should also run make, but if it doesn't, run it manually)

    Then, it the stf repo:

    npm link minicap-prebuilt
    

    Now it should be linked to your local minicap.

  30. added a commit that references this issue on Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0