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

A segmentation fault occurs when using USB connected. #1684

Closed
Cloudinsea opened this issue Aug 17, 2020 · 15 comments
Closed

A segmentation fault occurs when using USB connected. #1684

Cloudinsea opened this issue Aug 17, 2020 · 15 comments
Labels

Comments

@Cloudinsea
Copy link

Cloudinsea commented Aug 17, 2020

Environment

  • OS: [Windows 10]
  • scrcpy version: [1.16]
  • installation method: [ Windows]
  • device model: Meizu 16th
  • Android version: [10]

terminal code:

D:\download\Common software packages\spacedesk\scrcpy-win64-v1.16>scrcpy -v
scrcpy 1.16

dependencies:
 - SDL 2.0.12
 - libavcodec 58.91.100
 - libavformat 58.45.100
 - libavutil 56.51.100

D:\download\Common software packages\spacedesk\scrcpy-win64-v1.16>adb usb
restarting in USB mode

D:\download\Common software packages\spacedesk\scrcpy-win64-v1.16>adb devices
List of devices attached
882QADT8Q4ATN   device


D:\download\Common software packages\spacedesk\scrcpy-win64-v1.16>scrcpy
INFO: scrcpy 1.16 <https://github.com/Genymobile/scrcpy>
D:\download\Common software packages\spacedesk\scrcpy-win6... file pushed, 0 skipped. 42.6 MB/s (33622 bytes in 0.001s)
[server] INFO: Device: Meizu 16th (Android 10)
INFO: Renderer: direct3d
INFO: Initial texture: 1080x2160
WARN: Device disconnected
Segmentation fault
Press any key to continue...
@rom1v
Copy link
Collaborator

rom1v commented Aug 17, 2020

How long between the start of scrcpy and the disconnection and segfault?

Does it happen always?

Does it also happen on v1.14 or v1.15?

@rom1v rom1v added the bug label Aug 17, 2020
@rom1v
Copy link
Collaborator

rom1v commented Aug 17, 2020

Does the segfault appear in adb logcat? (sometimes the printed Segmentation fault actually occurs on the device)

@zhaoboy9692
Copy link

zhaoboy9692 commented Aug 18, 2020

2020-08-18 10:15:13.464 scrcpy[2764:798647] INFO: scrcpy 1.14 <https://github.com/Genymobile/scrcpy>
/usr/local/Cellar/scrcpy/1.14_1/share/scrcpy/scr...ed, 0 skipped. 83.3 MB/s (33142 bytes in 0.000s)
[server] INFO: Device: Meizu 16th (Android 10)
2020-08-18 10:15:13.831 scrcpy[2764:798647] INFO: Created renderer: metal
2020-08-18 10:15:13.831 scrcpy[2764:798647] INFO: Renderer: metal
2020-08-18 10:15:13.834 scrcpy[2764:798647] INFO: Initial texture: 1080x2160
2020-08-18 10:15:14.330 scrcpy[2764:798647] WARN: Device disconnected
Segmentation fault

@Cloudinsea
Copy link
Author

Does the segfault appear in adb logcat? (sometimes the printed Segmentation fault actually occurs on the device)

No, when I open another CMD window, and then 'adb logcat', the segfault doesn't appear when connecting to phone.

@Cloudinsea
Copy link
Author

How long between the start of scrcpy and the disconnection and segfault?

Does it happen always?

Does it also happen on v1.14 or v1.15?

It never work once and happen always. I never used other version of scrcpy.

@zhaoboy9692
Copy link

How long between the start of scrcpy and the disconnection and segfault?
Does it happen always?
Does it also happen on v1.14 or v1.15?

It never work once and happen always. I never used other version of scrcpy.

me too ,system update ,and happen

@rom1v
Copy link
Collaborator

rom1v commented Aug 18, 2020

@zhaoboy9692 oh so it's also happening on v1.14, also on macOS 😕

@Cloudinsea

It never work once and happen always.

Oh, great. Will be easier to find the cause then 😉

@zhaoboy9692 or @Cloudinsea
Could you please build the app manually (use the prebuilt server to only build the client, to keep things simple) with ASAN enabled (just add -Db_sanitize=address to the meson command):

Download scrcpy-server-v1.16, then:

git clone https://github.com/Genymobile/scrcpy
cd scrcpy
# edit /path/to/scrcpy-server to point to the server you just downloaded
meson x -Dprebuilt_server=/path/to/scrcpy-server -Db_sanitize=address
ninja -Cx
./run x

@zhaoboy9692
Copy link

zhaoboy9692 commented Aug 18, 2020

@zhaoboy9692 oh so it's also happening on v1.14, also on macOS 😕

@Cloudinsea

It never work once and happen always.

Oh, great. Will be easier to find the cause then 😉

@zhaoboy9692 or @Cloudinsea
Could you please build the app manually (use the prebuilt server to only build the client, to keep things simple) with ASAN enabled (just add -Db_sanitize=address to the meson command):

Download scrcpy-server-v1.16, then:

git clone https://github.com/Genymobile/scrcpy
cd scrcpy
# edit /path/to/scrcpy-server to point to the server you just downloaded
meson x -Dprebuilt_server=/path/to/scrcpy-server -Db_sanitize=address
ninja -Cx
./run x
2020-08-18 18:57:33.553 scrcpy[14058:6656076] INFO: scrcpy 1.16 <https://github.com/Genymobile/scrcpy>
2020-08-18 18:57:33.553 scrcpy[14058:6656076] DEBUG: Using SCRCPY_SERVER_PATH: x/server/scrcpy-server
x/server/scrcpy-server: 1 file pushed, 0 skipped. 74.9 MB/s (33622 bytes in 0.000s)
2020-08-18 18:57:33.868 scrcpy[14058:6656076] DEBUG: Screensaver enabled
[server] INFO: Device: Meizu 16th (Android 10)
2020-08-18 18:57:34.222 scrcpy[14058:6656076] DEBUG: Starting stream thread
2020-08-18 18:57:34.222 scrcpy[14058:6656076] DEBUG: Starting controller thread
2020-08-18 18:57:34.222 scrcpy[14058:6656076] DEBUG: Starting receiver thread
[server] DEBUG: Applying workarounds to avoid NullPointerException
2020-08-18 18:57:34.246 scrcpy[14058:6656076] INFO: Renderer: metal
2020-08-18 18:57:34.246 scrcpy[14058:6656076] DEBUG: Trilinear filtering disabled (not an OpenGL renderer)
2020-08-18 18:57:34.249 scrcpy[14058:6656076] INFO: Initial texture: 1080x2160
2020-08-18 18:57:34.696 scrcpy[14058:6656407] DEBUG: Receiver stopped
2020-08-18 18:57:34.696 scrcpy[14058:6656405] DEBUG: End of frames
2020-08-18 18:57:34.696 scrcpy[14058:6656076] DEBUG: Video stream stopped
2020-08-18 18:57:34.696 scrcpy[14058:6656076] WARN: Device disconnected
2020-08-18 18:57:34.696 scrcpy[14058:6656076] DEBUG: quit...
Segmentation fault
2020-08-18 18:57:34.701 scrcpy[14058:6656281] DEBUG: Server terminated

oh no ,dont work

@rom1v
Copy link
Collaborator

rom1v commented Aug 18, 2020

Thanks 👍

2020-08-18 18:57:34.696 scrcpy[14058:6656076] DEBUG: quit...
Segmentation fault
2020-08-18 18:57:34.701 scrcpy[14058:6656281] DEBUG: Server terminated

OK, so the segfault does not come from scrcpy itself (nothing is reported by ASAN, and a debug log is printed after the segfault).

So either it comes from the device, or from adb itself (you could try with another version of adb).

Could you also try with v1.13, please? (v1.14 introduced a fix for #994 which could impact Meizu-specific workarounds #365 #434).

@Dwhy
Copy link

Dwhy commented Aug 20, 2020

解决了吗?我也是同样的问题

@rom1v
Copy link
Collaborator

rom1v commented Aug 20, 2020

Does adb alone work normally? adb shell, adb logcat?

@Dwhy
Copy link

Dwhy commented Aug 21, 2020

是否adb单独工作是否正常?adb shelladb logcat

[server] INFO: Device: HUAWEI HLK-AL00 (Android 10)
[server] ERROR: Exception on thread Thread[main,5,main]
android.media.MediaCodec$CodecException: Error 0xfffffc0e
        at android.media.MediaCodec.native_configure(Native Method)
        at android.media.MediaCodec.configure(MediaCodec.java:2023)
        at android.media.MediaCodec.configure(MediaCodec.java:1951)
        at com.genymobile.scrcpy.ScreenEncoder.configure(ScreenEncoder.java:205)

        at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncode
r.java:84)
        at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:5
5)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:76)
        at com.genymobile.scrcpy.Server.main(Server.java:225)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:359)
[server] ERROR: The hardware encoder is not able to encode at the given definiti
on.
[server] ERROR: Try with a lower definition:
[server] ERROR:     scrcpy -m 1024
INFO: Renderer: direct3d
INFO: Initial texture: 1080x2336
WARN: Device disconnected
Press any key to continue...

@rom1v
Copy link
Collaborator

rom1v commented Aug 21, 2020

@Dwhy
Copy link

Dwhy commented Aug 21, 2020

@Dwhy this is not a segfault. https://github.com/Genymobile/scrcpy/blob/master/FAQ.md#exception

i am sorry,I thought the error of the two mobile phones was the same, so I posted the other one。This is the same as his

INFO: scrcpy 1.16 <https://github.com/Genymobile/scrcpy>
H:\androidTool\scrcpy-win64-v1.16\scrc...ped. 45.4 MB/s (33622 bytes in 0.001s)
[server] INFO: Device: Meizu 16th (Android 10)
Segmentation fault
INFO: Renderer: direct3d
INFO: Initial texture: 1080x2160
WARN: Device disconnected
Press any key to continue...

@rom1v
Copy link
Collaborator

rom1v commented Aug 21, 2020

It's definitely not a segfault in scrcpy, but either on the device or adb.

Could you try with older versions of scrcpy? (they also include different version of adb)

@rom1v rom1v closed this as completed Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants