Skip to content

gh-132912: Use readline to synchronize between procs in remote pdb test#132949

Merged
pablogsal merged 1 commit into
python:mainfrom
gaogaotiantian:remote-interrupt-test
Apr 25, 2025
Merged

gh-132912: Use readline to synchronize between procs in remote pdb test#132949
pablogsal merged 1 commit into
python:mainfrom
gaogaotiantian:remote-interrupt-test

Conversation

@gaogaotiantian

@gaogaotiantian gaogaotiantian commented Apr 25, 2025

Copy link
Copy Markdown
Member

I think we can use stdout to do the synchronization. It's much simpler and we don't need to rely on time.sleep() which will surprise you all the time.

This PR also get rid of the socket that is used to do synchronization. There's a downside to that - socket has a timeout which means if our c did not work properly, it will hang forever. However, we are already risking the hanging because we have _read_until_prompt - that has a readline() in it and if something goes way out of control it will hang. I don't think the extra protection gave us much - because it's not a test for continue. If we need to consider the possibility that everything could go wrong, a lot of the existing tests need to be rewritten.

I also changed the sleep value because that makes the test take 1s+ on a perfect computer and that's a bit too much. 0.2s is more in the range of the time it already needs to spawn the process and everything.

@pablogsal pablogsal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but please check with this for a while to ensure we don't have surprises:

$ ./python -m test test_remote_pdb -v --forever -j10 --timeout=60

@gaogaotiantian

Copy link
Copy Markdown
Member Author

I see no issues with a few hundred iterations.

@pablogsal pablogsal merged commit a1f4a6b into python:main Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants