-
-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Improve cleanup reliability #5613
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
Conversation
Some options, such as --show-touches or --stay-awake, modify Android settings and must be restored upon exit. If scrcpy terminates (e.g. due to an early error) in the middle of the clean up configuration, the device may be left in an inconsistent state (some settings might be changed but not restored). This issue can be reproduced with high probability by forcing scrcpy to fail: scrcpy --show-touches --video-encoder=fail To prevent this problem, ensure that the clean up thread is not interrupted until the clean up process is started. Refs #5601 <#5601> PR #5613 <#5613>
My project is using Os.setsid method, it should do the same thing as To my knowledge, on most devices, using But some device still kills the process when unplugging USB cable, like the original issue reported. Shizuku is using daemon, and the behavior is same. |
Ah yes, I will do that instead. I didn't know |
Reimplement c59a3c3 using Os.setsid(). Refs #5613 comment <#5613 (comment)> Suggested-by: Simon Chan <[email protected]>
Some options, such as --show-touches or --stay-awake, modify Android settings and must be restored upon exit. If scrcpy terminates (e.g. due to an early error) in the middle of the clean up configuration, the device may be left in an inconsistent state (some settings might be changed but not restored). This issue can be reproduced with high probability by forcing scrcpy to fail: scrcpy --show-touches --video-encoder=fail To prevent this problem, ensure that the clean up thread is not interrupted until the clean up process is started. Refs Genymobile#5601 <Genymobile#5601> PR Genymobile#5613 <Genymobile#5613>
If available, start the cleanup process in a new session to reduce the likelihood of it being terminated along with the scrcpy server process on some devices. The binaries setsid and nohup are often available, but it is not guaranteed. Refs Genymobile#5601 <Genymobile#5601> PR Genymobile#5613 <Genymobile#5613>
Reimplement c59a3c3 using Os.setsid(). Refs Genymobile#5613 comment <Genymobile#5613 (comment)> Suggested-by: Simon Chan <[email protected]>
Currently, if scrcpy terminates before the cleanup process is started (race condition), e.g. due to an early error, the initial state is not restored. This can be easily reproduced by forcing scrcpy to fail:
In addition, starting the cleanup process with
setsid
ornohup
reduces the likelihood of it being killed along with the scrcpy server process on some devices (but not all).Refs #5601.
Here is a binary to replace in scrcpy 3.0.2:
scrcpy-server
SHA-256: e925077940dbe82ab8375aca06bf471d88a7c775096b6747eac810f074481b9