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

MacOS Segmentation fault: 11 #1414

Open
wudelu opened this issue May 21, 2020 · 25 comments
Open

MacOS Segmentation fault: 11 #1414

wudelu opened this issue May 21, 2020 · 25 comments

Comments

@wudelu
Copy link

wudelu commented May 21, 2020

/usr/local/Cellar/scrcpy/1.8/share/scr...shed. 0.6 MB/s (19850 bytes in 0.030s)
2020-05-21 18:31:56.356 scrcpy[30780:1970626] INFO: Initial texture: 1080x2160
Segmentation fault: 11
JokerWudeMacBook-Pro:~ jokerwu$ scrcpy -v
scrcpy 1.8

dependencies:

  • SDL 2.0.9
  • libavcodec 58.35.100
  • libavformat 58.20.100
  • libavutil 56.22.100
@rom1v
Copy link
Collaborator

rom1v commented May 21, 2020

Which device? Which Android version?

Try with the latest scrcpy version (1.13).

@Climax777
Copy link

I get the same. Using prebuild server 1.13 and scrcpy built in MacPorts:
scrcpy 1.13

dependencies:

  • SDL 2.0.12
  • libavcodec 58.65.102
  • libavformat 58.35.101
  • libavutil 56.38.100

Running lldb on scrcpy, it seems that adb push fails for some reason

(lldb) target create "scrcpy"
Current executable set to 'scrcpy' (x86_64).
(lldb) run
Process 25502 launched: '/usr/local/bin/scrcpy' (x86_64)
2020-05-21 22:45:39.568061+0200 scrcpy[25502:253291] INFO: scrcpy 1.13 <https://github.com/Genymobile/scrcpy>
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 11.1 MB/s (27694 bytes in 0.002s)
2020-05-21 22:45:39.645469+0200 scrcpy[25502:253291] ERROR: "adb push" exited unexpectedly
Process 25502 exited with status = 1 (0x00000001)
(lldb)

Android Debug Bridge version 1.0.41
Version 30.0.1-6435776

@rom1v
Copy link
Collaborator

rom1v commented May 21, 2020

adb shell ls -l /data/local/tmp

@Climax777
Copy link

-rw-rw-rw- root     root      4322329 1970-01-01 02:00 apk1590094170308.apk
-rwxr-xr-x root     root        17880 2018-09-11 03:44 getport
-rw-rw-rw- root     root           55 2020-05-18 17:00 mobile_info.properties
drwxrwxrwx shell    shell             2020-05-18 16:49 tc
-rw-rw-rw- root     root            7 1970-01-01 02:00 vysor.pwd

@rom1v
Copy link
Collaborator

rom1v commented May 21, 2020

I guess the segfault occurs on the device. Could you adb logcat when it happens?

@Climax777
Copy link

https://pastebin.com/9ANvAMeV

@wudelu
Copy link
Author

wudelu commented May 22, 2020

哪个设备?哪个Android版本?

尝试使用最新的scrcpy版本(1.13)。

XIAO MI mix2 Android 9.0
adb log
2020-05-22 08:32:02.985 20079-20079/? E/libc: Access denied finding property "ro.vendor.at_library"
2020-05-22 08:32:03.055 965-2356/? E/OMXNodeInstance: setParameter(0xe89a7284:qcom.encoder.avc, OMX.google.android.index.allocateNativeHandle(0x7f00005d): Output:1 en=0) ERROR: UnsupportedSetting(0x80001019)
2020-05-22 08:32:03.088 965-10879/? E/OMXNodeInstance: getConfig(0xe89a7284:qcom.encoder.avc, ConfigLatency(0x6f800005)) ERROR: UnsupportedIndex(0x8000101a)
2020-05-22 08:32:03.114 965-2356/? E/OMXNodeInstance: getConfig(0xe89a7284:qcom.encoder.avc, ??(0x7f000062)) ERROR: UnsupportedSetting(0x80001019)
2020-05-22 08:32:03.117 965-2356/? E/OMXNodeInstance: getParameter(0xe89a7284:qcom.encoder.avc, ParamConsumerUsageBits(0x6f800004)) ERROR: UnsupportedIndex(0x8000101a)
2020-05-22 08:32:03.120 965-2356/? E/OMXNodeInstance: getParameter(0xe89a7284:qcom.encoder.avc, ParamConsumerUsageBits(0x6f800004)) ERROR: UnsupportedIndex(0x8000101a)

@rom1v
Copy link
Collaborator

rom1v commented May 24, 2020

@Climax777

Could you please execute these two commands manually (adapt PATH/TO/YOUR/scrcpy_server):

adb push PATH/TO/YOUR/scrcpy-server /data/local/tmp/scrcpy-server.jar
adb shell CLASSPATH=/data/local/tmp/scrcpy-server.jar app_process / com.genymobile.scrcpy.Server 1.13 0 8000000 0 -1 false - true true 0

@Climax777
Copy link

@rom1v

That seemed to work. Obviously the socket won't connect since there isn't anything listening.

$ adb -t 2 push scrcpy-server-v1.13 /data/local/tmp/scrcpy-server.jar
scrcpy-server-v1.13: 1 file pushed, 0 skipped. 0.1 MB/s (27694 bytes in 0.365s)
$ adb -t 2 shell CLASSPATH=/data/local/tmp/scrcpy-server.jar app_process / com.genymobile.scrcpy.Server 1.13 0 8000000 0 -1 false - true true 0
[server] INFO: Device: alps IH16 (Android 5.1)
[server] ERROR: Exception on thread Thread[main,5,main]
java.io.IOException: Connection refused
	at android.net.LocalSocketImpl.connectLocal(Native Method)
	at android.net.LocalSocketImpl.connect(LocalSocketImpl.java:290)
	at android.net.LocalSocket.connect(LocalSocket.java:130)
	at com.genymobile.scrcpy.DesktopConnection.connect(DesktopConnection.java:40)
	at com.genymobile.scrcpy.DesktopConnection.open(DesktopConnection.java:63)
	at com.genymobile.scrcpy.Server.scrcpy(Server.java:22)
	at com.genymobile.scrcpy.Server.main(Server.java:177)
	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:250)

@rom1v
Copy link
Collaborator

rom1v commented May 24, 2020

Hmmm…

Running lldb on scrcpy, it seems that adb push fails for some reason

For some reason, it seems that lldb does not like when scrcpy executes adb: #1239 (comment) 😕

Instead, could you enable ASAN:

meson x -Db_sanitize=address
# or just reconfigure if x already exists: meson configure x -Db_sanitize=address
ninja -Cx
./run x

It should print the stacktrace if the segfault occurs on the computer (not on the device).

@rom1v
Copy link
Collaborator

rom1v commented May 24, 2020

Ref #726

@rom1v
Copy link
Collaborator

rom1v commented May 25, 2020

@Climax777 Does it give a stacktrace?

@Climax777
Copy link

2020-05-25 21:41:50.021 scrcpy[1484:16146] INFO: scrcpy 1.13 <https://github.com/Genymobile/scrcpy>
x/server/scrcpy-server: 1 file pushed, 0 skipped. 0.1 MB/s (27694 bytes in 0.357s)
[server] INFO: Device: alps IH16 (Android 5.1)
AddressSanitizer:DEADLYSIGNAL
=================================================================
==1484==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x7fff6f24a70a bp 0x000000000001 sp 0x700002788788 T6)
==1484==The signal is caused by a READ memory access.
==1484==Hint: this fault was caused by a dereference of a high value address (see registers below).  Dissassemble the provided pc to learn which register value was used.
2020-05-25 21:41:51.581 scrcpy[1484:16146] INFO: Renderer: metal
2020-05-25 21:41:51.581 scrcpy[1484:16146] WARN: Trilinear filtering disabled (not an OpenGL renderer)
2020-05-25 21:41:51.587 scrcpy[1484:16146] INFO: Initial texture: 480x800
    #0 0x7fff6f24a709 in dyld_stub_binder (libdyld.dylib:x86_64+0x19709)

==1484==Register values:
rax = 0x0000000000003358  rbx = 0x0000000000000004  rcx = 0x0000000111d3fa50  rdx = 0x0000000000000014
rdi = 0x00000001120ebe10  rsi = 0x0000000000000008  rbp = 0x0000000000000001  rsp = 0x0000700002788788
 r8 = 0x0000000000000001   r9 = 0x0000000000000001  r10 = 0x0000000000000000  r11 = 0x0000000111f4a160
r12 = 0x00007fff6f44c7a4  r13 = 0x0000000111f5a500  r14 = 0x00007000027888b0  r15 = 0x0000700002788850
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (libdyld.dylib:x86_64+0x19709) in dyld_stub_binder
Thread T6 created by T0 here:
    #0 0x110425b8a in wrap_pthread_create (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x3fb8a)
    #1 0x11037b576 in SDL_SYS_CreateThread (libSDL2-2.0.0.dylib:x86_64+0xb8576)
    #2 0x11031643e in SDL_CreateThreadWithStackSize_REAL (libSDL2-2.0.0.dylib:x86_64+0x5343e)
    #3 0x110316561 in SDL_CreateThread_REAL (libSDL2-2.0.0.dylib:x86_64+0x53561)
    #4 0x10fe64cb8 in scrcpy (scrcpy:x86_64+0x100010cb8)
    #5 0x10fe56edf in main (scrcpy:x86_64+0x100002edf)
    #6 0x7fff6f24bcc8 in start (libdyld.dylib:x86_64+0x1acc8)

==1484==ABORTING
./run: line 23:  1484 Abort trap: 6           SCRCPY_SERVER_PATH="$BUILDDIR/server/scrcpy-server" "$BUILDDIR/app/scrcpy" "$@"

@rom1v
Copy link
Collaborator

rom1v commented May 25, 2020

Weird, it seems the problem is not in scrcpy, but in SDL :/

Could you build in debug mode and retry?

meson configure x --buildtype=debug
ninja -Cx
./run x

@rom1v
Copy link
Collaborator

rom1v commented May 25, 2020

Using prebuild server 1.13 and scrcpy built in MacPorts

Could you build scrcpy "manually" and retry?

@Climax777
Copy link

Do you mean the server?

@Climax777
Copy link

2020-05-25 21:50:12.350 scrcpy[1942:26342] INFO: scrcpy 1.13 <https://github.com/Genymobile/scrcpy>
2020-05-25 21:50:12.351 scrcpy[1942:26342] DEBUG: Using SCRCPY_SERVER_PATH: x/server/scrcpy-server
x/server/scrcpy-server: 1 file pushed, 0 skipped. 2.5 MB/s (27694 bytes in 0.011s)
[server] INFO: Device: alps IH16 (Android 5.1)
2020-05-25 21:50:13.333 scrcpy[1942:26342] DEBUG: Starting stream thread
2020-05-25 21:50:13.334 scrcpy[1942:26342] DEBUG: Starting controller thread
2020-05-25 21:50:13.334 scrcpy[1942:26342] DEBUG: Starting receiver thread
AddressSanitizer:DEADLYSIGNAL
=================================================================
==1942==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x7fff6f24a70a bp 0x000000000001 sp 0x700004deba18 T5)
==1942==The signal is caused by a READ memory access.
==1942==Hint: this fault was caused by a dereference of a high value address (see registers below).  Dissassemble the provided pc to learn which register value was used.
2020-05-25 21:50:13.365 scrcpy[1942:26342] INFO: Created renderer: metal
2020-05-25 21:50:13.365 scrcpy[1942:26342] INFO: Renderer: metal
2020-05-25 21:50:13.365 scrcpy[1942:26342] WARN: Trilinear filtering disabled (not an OpenGL renderer)
2020-05-25 21:50:13.370 scrcpy[1942:26342] INFO: Initial texture: 480x800
    #0 0x7fff6f24a709 in dyld_stub_binder (libdyld.dylib:x86_64+0x19709)

==1942==Register values:
rax = 0x0000000000003358  rbx = 0x0000000000000004  rcx = 0x000000010e7d3a50  rdx = 0x0000000000000014
rdi = 0x000000010eb7fe10  rsi = 0x0000000000000008  rbp = 0x0000000000000001  rsp = 0x0000700004deba18
 r8 = 0x0000000000000001   r9 = 0x0000000000000001  r10 = 0x0000000000000000  r11 = 0x000000010e9de160
r12 = 0x00007fff6f44c7a4  r13 = 0x000000010e9ee500  r14 = 0x0000700004debb40  r15 = 0x0000700004debae0
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (libdyld.dylib:x86_64+0x19709) in dyld_stub_binder
Thread T5 created by T0 here:
    #0 0x10ceb5b8a in wrap_pthread_create (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x3fb8a)
    #1 0x10ce05576 in SDL_SYS_CreateThread (libSDL2-2.0.0.dylib:x86_64+0xb8576)
    #2 0x10cda043e in SDL_CreateThreadWithStackSize_REAL (libSDL2-2.0.0.dylib:x86_64+0x5343e)
    #3 0x10cda0561 in SDL_CreateThread_REAL (libSDL2-2.0.0.dylib:x86_64+0x53561)
    #4 0x10c8d4f49 in stream_start (scrcpy:x86_64+0x100020f49)
    #5 0x10c8ca48d in scrcpy (scrcpy:x86_64+0x10001648d)
    #6 0x10c8b6b2c in main (scrcpy:x86_64+0x100002b2c)
    #7 0x7fff6f24bcc8 in start (libdyld.dylib:x86_64+0x1acc8)

==1942==ABORTING
./run: line 23:  1942 Abort trap: 6           SCRCPY_SERVER_PATH="$BUILDDIR/server/scrcpy-server" "$BUILDDIR/app/scrcpy" "$@"

Doesn't seem much different in terms of output.

@rom1v
Copy link
Collaborator

rom1v commented May 25, 2020

Do you mean the server?

No, the client. But I'm not sure what "MacPorts" is :)

@Climax777
Copy link

MacPorts is just an alternative to Homebrew. I did build it manually, as per instructions in the README.md.

@rom1v
Copy link
Collaborator

rom1v commented May 26, 2020

What macOS version?

@Climax777
Copy link

Climax777 commented May 26, 2020 via email

@prabowomurti
Copy link

I also use Macports (instead of Homebrew) in Catalina and build it manually and not getting any error message. I use the latest version of scrcpy (1.14).

laylamajnun:scrcpy sangprabo$ ninja -Cx
ninja: Entering directory `x'
[12/26] Compiling C object 'app/a172ced@@scrcpy@exe/src_server.c.o'.
../app/src/server.c:204:24: warning: format specifies type 'unsigned short' but the argument has type 'int' [-Wformat]
                 port, port + 1);
                 ~~~~~~^~~~~~~~~
../app/src/util/log.h:16:61: note: expanded from macro 'LOGW'
#define LOGW(...) SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__)
                                                            ^~~~~~~~~~~
1 warning generated.

@rom1v
Copy link
Collaborator

rom1v commented May 29, 2020

You don't build the latest client, this warning has been fixed by 7eb16ce, between v1.12 and v1.13.

You should git pull.

@rom1v rom1v mentioned this issue Jun 24, 2020
2 tasks
@harens
Copy link
Contributor

harens commented May 6, 2021

For any future readers, just to note that scrcpy is on MacPorts with binaries for 10.12+ (project page):

sudo port install scrcpy

See #2256 (comment) for more details, and note that this also sorts out the adb tools for you. MacPorts can be installed from here.

@Coool
Copy link

Coool commented Sep 16, 2022

scrcpy for macOS

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

6 participants