Device.pull often hangs when pulling files >= 1MB
Hi,
The ADB device is connected to a remote host, therefore I'm setting up the client like this:
from ppadb.client import Client as AdbClient
client = AdbClient(host='remote_host', port=5037)
device = client.devices()[0]
Now, in /data/local/tmp I'm putting a file of varying size, e.g.:
cd /data/local/tmp
head -c 1024 /dev/urandom > output.z # 1k file
head -c $((1024*64)) /dev/urandom > output.z # 64k file
head -c $((1024*1024)) /dev/urandom > output.z # 1MB file
Then try to pull it:
device.pull('/data/local/tmp/output.z', 'output.z')
this works fine if the file is under 1024kB, i.e. 1024*1024 bytes. Then, if the file is at least 1MB, most of the calls to pull stall and the interpreter is locked down, i.e. it can't be terminated by Ctrl-C, because it's stuck at socket.recv. When I add a timeout, it times out at the last call to self.socket.recv in Connection._recv, i.e. it always times out at receiving the last part of the file.
I'm running ADB server version 29.0.1-5644136, the code is executed from Windows using Python 3.7.4.
Same issue here