Skip to content

Use lock to avoid kernel address conflicts in nb-tester #3143

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

Merged
merged 4 commits into from
May 16, 2025

Conversation

frankharkins
Copy link
Member

@frankharkins frankharkins commented May 15, 2025

This PR uses a lock to try and avoid this error when running in a GitHub action:

zmq.error.ZMQError: Address already in use (addr='tcp://127.0.0.1:45769')

This is a bit of a shot in the dark because I can't reproduce it locally.

This is related to #2387, but is not necessarily a full fix as I believe there is more than one thing going on there.


Inspired by jupyter/nbclient#327

Not sure why filelock wasn't working, but asyncio.Lock() does work correctly (tested with print statements)
@frankharkins frankharkins changed the title Try filelock with nb-tester kernel creation Use lock to avoid kernel address conflicts in nb-tester May 15, 2025
@frankharkins
Copy link
Member Author

I re-ran the notebook test ~10 times and didn't experience the issue, so hopefully this fixes it.

@frankharkins frankharkins marked this pull request as ready for review May 15, 2025 16:57
Copy link
Collaborator

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Awesome! Good job using asyncio.lock rather than the filelock library

@frankharkins frankharkins added this pull request to the merge queue May 16, 2025
Merged via the queue into main with commit ecc9b9d May 16, 2025
3 checks passed
@frankharkins frankharkins deleted the FH/nb-tester-filelock branch May 16, 2025 10:14
@Eric-Arellano
Copy link
Collaborator

@Qiskit/docs-content-team test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants