Improve cleanup reliability by rom1v · Pull Request #5613 · Genymobile/scrcpy (original) (raw)

@rom1v changed the base branch from master to dev

December 5, 2024 19:12

@rom1v rom1v mentioned this pull request

Dec 6, 2024

@rom1v

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>

@rom1v

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 #5601 <#5601> PR #5613 <#5613>

rom1v added a commit that referenced this pull request

Dec 9, 2024

@rom1v

Reimplement c59a3c3 using Os.setsid().

Refs #5613 comment <#5613 (comment)>

Suggested-by: Simon Chan 1330321+yume-chan@users.noreply.github.com

bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request

Apr 11, 2025

@rom1v

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>

bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request

Apr 11, 2025

@rom1v

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>

bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request

Apr 11, 2025

@rom1v

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})