Open 18637 opened 9 months ago
scrcpy version: v2.1.1 (The reason for this is I found later versions of SCRCPY automatically turned on the screen when connecting)
Even v2.1.1 should do that.
Anyway, there is an option --no-power-on
since scrcpy 1.24.
adb: error: failed to read copy response
That's an adb connection issue. Try adb kill-server
, or adb disconnect
before restarting scrcpy.
Sorry Forgot to include that doing the following
adb kill-server, or adb disconnect or both, then restarting adb and re connecting.
Makes no difference. Still fails to push and I lose no other adb functionality.
I can still run an adb shell, run commands and also push files to the phone so I can't see there is an issue with adb??
The only thing that is failing is pushing the scrcpy-server.
I can still run an adb shell, run commands and also push files to the phone so I can't see there is an issue with adb??
If I try to manually push "scrcpy-server" I get the same adb: error: failed to read copy response.
If you reproduce the problem with adb only (without scrcpy), the issue is necessary with adb.
(to push the file, scrcpy does nothing else than just executing an adb push
command)
Turning off and on the computer to fix the issue is no a valid option for me.
Just for testing, what if you reboot the phone instead? What if you use another phone on this computer?
I can push any other file to the phone no problems at all??
Even to the same target (adb push somefile /data/local/tmp/scrcpy-server.jar
)?
Try another adb version maybe? (there might be a bug in a specific version)
For starters, I appreciate your help.
I can't reproduce the problem without involving "scrcpy-server". That is the only file that fails to push when it gets in this state.
If I turn the phone off and on, the problem still persists. There is no change. same error.
From the same computer I still push the scrcpy-server to a different phone. But this is not the main phone I use scrcpy for so maybe over time it might do the same but I cant confirm that.
I have tried pushing files fine but i havent tried pushing a file and naming it scrcpy.server.jar as per adb push somefile /data/local/tmp/scrcpy-server.jar
I was thinking it was to do with (I assume not knowing too much) it was some tcp connection issue scrcpy was trying to setup.
If its purely a push issue, is there a way to pre push the scrcpy-server, start scrcpy via a adb command and then when I shut down scrcpy the scrcpy-server remains on the phone as an alternative?
Ok I tested the commands above when it is in a broken state
C:\Users\User\Shadow>adb push devices.txt /data/local/tmp/scrcpy-server.jar
devices.txt: 1 file pushed, 0 skipped. 0.0 MB/s (89 bytes in 0.019s)
C:\Users\User\Shadow>adb push scrcpy-server /data/local/tmp/scrcpy-server.jar
scrcpy-server: 1 file pushed, 0 skipped. 20.1 MB/s (56995 bytes in 0.003s)
adb: error: failed to read copy response
After reboot. I tested new version. Took about 3 hrs to stop working.
C:\Users\User\Shadow_new>scrcpy
scrcpy 2.3.1 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO: --> (tcpip) 192.168.193.202:5555 device SM_A146P
C:\Users\User\Shadow_new\scrcpy-server: 1 file pushed, 0 skipped. 18.9 MB/s (66007 bytes in 0.003s)
adb: error: failed to read copy response
ERROR: "adb push" returned with value 1
ERROR: Server connection failed
Is there anything else I can try?
@rom1v
I want to be able to prove the fault is only related to adb.
To test this, When this error happens i will push the server to the phone by another computer. Then go back to the one I am having issues with.
I then want to start the pushed server without pushing it because its already there and plus it will fail.
How do I start it manually (so it does not try and push) then if its just a push error I should be able to run scrcpy.
Remove this to avoid pushing the server: https://github.com/Genymobile/scrcpy/blob/5a6b8310cae1e0741b4375ca760d9c8dd49822c4/app/src/server.c#L940
And run with --no-cleanup
to prevent removing it from the device.
Thank you.
Well I tried for almost the day on Windows and Linux just could not build get scrcpy to build. :-(
I got this far and then could not get any further. I just can't get past this point.
┌──(kali㉿kali)-[~/Downloads/scrcpy]
└─$ sudo ./release.sh
./gradlew clean
Starting a Gradle Daemon, 3 busy and 2 stopped Daemons could not be reused, use --status for details
BUILD SUCCESSFUL in 8s
1 actionable task: 1 executed
rm -rf "dist" "build-test" "build-server" \
"build-win32" "build-win64"
[ -d "build-test" ] || ( mkdir "build-test" && \
meson setup "build-test" -Db_sanitize=address )
The Meson build system
Version: 1.2.3
Source dir: /home/kali/Downloads/scrcpy
Build dir: /home/kali/Downloads/scrcpy/build-test
Build type: native build
Project name: scrcpy
Project version: 2.3.1
C compiler for the host machine: cc (gcc 13.2.0 "cc (Debian 13.2.0-5) 13.2.0")
C linker for the host machine: cc ld.bfd 2.41
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (1.8.1)
Run-time dependency libavformat found: YES 60.16.100
Run-time dependency libavcodec found: YES 60.31.102
Run-time dependency libavutil found: YES 58.29.100
Run-time dependency libswresample found: YES 4.12.100
Run-time dependency sdl2 found: YES 2.30.0
Run-time dependency libavdevice found: YES 60.3.100
Run-time dependency libusb-1.0 found: YES 1.0.26
Checking for function "strdup" : YES
Checking for function "asprintf" : YES
Checking for function "vasprintf" : YES
Checking for function "nrand48" : YES
Checking for function "jrand48" : YES
Checking for function "reallocarray" : YES
Header "sys/socket.h" has symbol "SOCK_CLOEXEC" : YES
Configuring config.h using configuration
Program ./scripts/build-wrapper.sh found: YES (/home/kali/Downloads/scrcpy/server/./scripts/build-wrapper.sh)
Build targets in project: 14
scrcpy 2.3.1
User defined options
b_sanitize: address
Found ninja-1.11.1 at /usr/bin/ninja
ninja -C "build-test"
ninja: Entering directory `build-test'
[31/118] Compiling C object app/scrcpy.p/src_server.c.o
../app/src/server.c:120:1: warning: ‘push_server’ defined but not used [-Wunused-function]
120 | push_server(struct sc_intr *intr, const char *serial) {
| ^~~~~~~~~~~
[114/118] Generating server/scrcpy-server with a custom command
(not invoking gradle, since we are root)
[118/118] Linking target app/test_vector
./gradlew -p server check
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.4/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD SUCCESSFUL in 23s
48 actionable tasks: 48 executed
[ -d "build-server" ] || ( mkdir "build-server" && \
meson setup "build-server" --buildtype release -Dcompile_app=false )
The Meson build system
Version: 1.2.3
Source dir: /home/kali/Downloads/scrcpy
Build dir: /home/kali/Downloads/scrcpy/build-server
Build type: native build
Project name: scrcpy
Project version: 2.3.1
C compiler for the host machine: cc (gcc 13.2.0 "cc (Debian 13.2.0-5) 13.2.0")
C linker for the host machine: cc ld.bfd 2.41
Host machine cpu family: x86_64
Host machine cpu: x86_64
Program ./scripts/build-wrapper.sh found: YES (/home/kali/Downloads/scrcpy/server/./scripts/build-wrapper.sh)
Build targets in project: 2
scrcpy 2.3.1
User defined options
buildtype : release
compile_app: false
Found ninja-1.11.1 at /usr/bin/ninja
ninja -C "build-server"
ninja: Entering directory `build-server'
[0/1] Generating server/scrcpy-server with a custom command
(not invoking gradle, since we are root)
platform-tools-34.0.5 found
SDL2-2.28.5 found
ffmpeg-6.1-scrcpy-3 found
libusb-1.0.26 found
rm -rf "build-win32"
mkdir -p "build-win32/local"
cp -r app/prebuilt-deps/data/ffmpeg-6.1-scrcpy-3/win32/. "build-win32/local/"
cp -r app/prebuilt-deps/data/SDL2-2.28.5/i686-w64-mingw32/. "build-win32/local/"
cp -r app/prebuilt-deps/data/libusb-1.0.26/libusb-MinGW-Win32/. "build-win32/local/"
meson setup "build-win32" \
--pkg-config-path="build-win32/local/lib/pkgconfig" \
-Dc_args="-I/home/kali/Downloads/scrcpy/build-win32/local/include" \
-Dc_link_args="-L/home/kali/Downloads/scrcpy/build-win32/local/lib" \
--cross-file=cross_win32.txt \
--buildtype=release --strip -Db_lto=true \
-Dcompile_server=false \
-Dportable=true
The Meson build system
Version: 1.2.3
Source dir: /home/kali/Downloads/scrcpy
Build dir: /home/kali/Downloads/scrcpy/build-win32
Build type: cross build
Project name: scrcpy
Project version: 2.3.1
C compiler for the host machine: i686-w64-mingw32-gcc (gcc 12.0.0 "i686-w64-mingw32-gcc (GCC) 12-win32")
C linker for the host machine: i686-w64-mingw32-gcc ld.bfd 2.41
C compiler for the build machine: cc (gcc 13.2.0 "cc (Debian 13.2.0-5) 13.2.0")
C linker for the build machine: cc ld.bfd 2.41
Build machine cpu family: x86_64
Build machine cpu: x86_64
Host machine cpu family: x86
Host machine cpu: i686
Target machine cpu family: x86
Target machine cpu: i686
Windows resource compiler: GNU windres (GNU Binutils) 2.41
Found pkg-config: /usr/bin/i686-w64-mingw32-pkg-config (1.8.1)
Run-time dependency libavformat found: YES 60.16.100
Run-time dependency libavcodec found: YES 60.31.102
Run-time dependency libavutil found: YES 58.29.100
Run-time dependency libswresample found: YES 4.12.100
Run-time dependency sdl2 found: YES 2.28.5
Run-time dependency libusb-1.0 found: YES 1.0.26
Library mingw32 found: YES
Library ws2_32 found: YES
Checking for function "strdup" : YES
Checking for function "asprintf" : YES
Checking for function "vasprintf" : YES
Checking for function "nrand48" : NO
Checking for function "jrand48" : NO
Checking for function "reallocarray" : NO
Configuring config.h using configuration
Build targets in project: 3
scrcpy 2.3.1
User defined options
Cross files : cross_win32.txt
buildtype : release
pkg_config_path: build-win32/local/lib/pkgconfig
strip : True
b_lto : true
c_args : -I/home/kali/Downloads/scrcpy/build-win32/local/include
c_link_args : -L/home/kali/Downloads/scrcpy/build-win32/local/lib
compile_server : false
portable : true
Found ninja-1.11.1 at /usr/bin/ninja
ninja -C "build-win32"
ninja: Entering directory `build-win32'
[30/63] Compiling C object app/scrcpy.exe.p/src_server.c.obj
../app/src/server.c:120:1: warning: ‘push_server’ defined but not used [-Wunused-function]
120 | push_server(struct sc_intr *intr, const char *serial) {
| ^~~~~~~~~~~
[63/63] Linking target app/scrcpy.exe
mkdir -p "dist/scrcpy-win32-v2.3.1-2-g5a6b8310"
cp "build-server"/server/scrcpy-server "dist/scrcpy-win32-v2.3.1-2-g5a6b8310/"
cp: cannot stat 'build-server/server/scrcpy-server': No such file or directory
make: *** [release.mk:105: dist-win32] Error 1
sudo ./release.sh … [114/118] Generating server/scrcpy-server with a custom command (not invoking gradle, since we are root)
Do not execute as root! (no sudo
)
Thank you again. There must have been some some permission issues and It could not create and delete folders. Once I sorted that It ran without root.
I waited until scrcpy was no longer working on this computer and did the following.
Left side original scrcpy | Right modified scrcpy with no push
Since adb still works in this state and I can push any other file except the scrcpy-server. I am not sure what this proves if anything other than the issue is pushing the file scrcpy-server?
Environment
Describe the bug Scrcpy works fine for a period of time. Ranging from half a day to several days. I am always connecting and disconnecting constantly. Scrcpy then fails to start. Output from terminal is
I am unable to connect to the phone again with Scrcpy unless I reboot the computer (I don't need to touch the phone at all).
If I try to manually push "scrcpy-server" I get the same adb: error: failed to read copy response. I can push any other file to the phone no problems at all?? If I use another computer - no problems at all. The problem lies solely with the pushing of the scrcpy-server after a period of connections and disconnections. I have Changed sim cards (to rule this out) no difference.
Looking at the adb client code below this seems to be the issue
Full section of code and code location https://android.googlesource.com/platform/system/core/+/d427b54c535d3f56e9db947efa4878346541f890/adb/client/file_sync_client.cpp
I don't know enough to understand what it means.
Turning off and on the computer to fix the issue is no a valid option for me.
I have tried resetting the NETWORK on the computer and editing the TIMEWAIT for TCP but nothing I have done or can do will fix the problem without a reboot of the computer.
Any ideas or thoughts? There is this issue which is similar https://github.com/Genymobile/scrcpy/issues/3241 same error at least but connecting via USB cable where I am not and have worked out it's only related to pushing the scrcpy-server.