Skip to content

python3Packages.paho-mqtt: backport fix for flaky tests - #545193

Merged
vcunat merged 1 commit into
NixOS:masterfrom
leonbohn:paho-mqtt-flaky-tests
Aug 1, 2026
Merged

vcunat merged 1 commit into
NixOS:masterfrom
leonbohn:paho-mqtt-flaky-tests

Conversation

@leonbohn

Copy link
Copy Markdown
Contributor

During testing, MQTT clients are spawned as subprocesses and then
stopped via SIGINT. Whether or not the SIGINT signal arrives before or
after the client has completed the initial setup and reached its loop_forever() or wait_for_keyboard_input() call is timing-dependent. This limitaiton seems to be known by the upstream developers as witnessed by this comment in the custom implementation of wait_for_keyboard_interrupt. As a consequence of it, people are getting failures during teardown for different tests depending on the machine as
the timing is slightly different, see #542586.

Fixing via a static set of disabled tests seems to not be the right
approach. This PR instead uses pytest-rerunfailures to allow multiple
retries which (hopefully) makes failures much more unlikely. This may
increase the runtime of checkPhase, but for me it reliably prevents the
test from failing.

Assisted by: Claude Sonnet 5, which helped me understand the issue and suggested simply rerunning the flaky tests.

Sorry for opening this twice, its my first time contributing here. Please let me know if I should do something else.

Things done

@nixpkgs-ci
nixpkgs-ci Bot requested review from dotlambda and mogorman July 24, 2026 10:42
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 1001-2500 This PR causes many rebuilds on Linux and should target the staging branches. 12.first-time contribution This PR is the author's first one; please be gentle! llm-assisted Contributions that include code generation with LLMs 6.topic: python Python is a high-level, general-purpose programming language. labels Jul 24, 2026
@leonbohn
leonbohn force-pushed the paho-mqtt-flaky-tests branch from f585b8c to edcc359 Compare July 24, 2026 20:42
@leonbohn

Copy link
Copy Markdown
Contributor Author

In the meantime, @JamieMagee has fixed this issue upstream eclipse-paho/paho.mqtt.python#934.
This PR now simply backports this fix. I hope that force pushing was the right call.

Unfortunately, I had to manually create a patch file since the changes do not cleanly apply after applying the other patch related to ssl certificates.

@nixpkgs-ci nixpkgs-ci Bot removed the llm-assisted Contributions that include code generation with LLMs label Jul 24, 2026
@dotlambda dotlambda changed the title python3Packages.paho-mqtt: rerun flaky tests python3Packages.paho-mqtt: backport fix for flaky tests Jul 24, 2026
@dotlambda
dotlambda changed the base branch from staging to master July 24, 2026 21:42
@dotlambda dotlambda added the backport staging-26.05 Backport PR automatically label Jul 24, 2026
@nixpkgs-ci nixpkgs-ci Bot closed this Jul 24, 2026
@nixpkgs-ci nixpkgs-ci Bot reopened this Jul 24, 2026

@nixpkgs-branch-check nixpkgs-branch-check Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The PR's base branch is set to master, but 171 commits from the staging branch are included. Make sure you know the right base branch for your changes, then:

  • If the changes should go to the staging branch, change the base branch.
  • If the changes should go to the master branch, rebase your PR onto the correct merge-base:
    # git rebase --onto $(git merge-base upstream/master HEAD) $(git merge-base upstream/staging HEAD)
    git rebase --onto ac1872b9b2927bf24d648290f73f026cd0cb054a 7a0b03740a1ca30d640da4526a9229dda5833efd
    git push --force-with-lease

@dotlambda dotlambda linked an issue Jul 24, 2026 that may be closed by this pull request
4 tasks done
@dotlambda
dotlambda dismissed nixpkgs-branch-check[bot]’s stale review July 24, 2026 21:43

We merge to master because it fails to build there.

nixpkgs-branch-check[bot]

This comment was marked as outdated.

@nixpkgs-ci nixpkgs-ci Bot added 8.has: package (update) This PR updates a package to a newer version 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-nixos-tests This PR causes rebuilds for all NixOS tests and should normally target the staging branches. and removed 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 1001-2500 This PR causes many rebuilds on Linux and should target the staging branches. labels Jul 24, 2026
@dotlambda

Copy link
Copy Markdown
Member

Please rebase on git merge-base upstream/master upstream/staging.

nixpkgs-branch-check[bot]

This comment was marked as outdated.

nixpkgs-branch-check[bot]

This comment was marked as outdated.

@nixpkgs-ci nixpkgs-ci Bot added 8.has: package (update) This PR updates a package to a newer version 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-nixos-tests This PR causes rebuilds for all NixOS tests and should normally target the staging branches. 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: haskell General-purpose, statically typed, purely functional programming language 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 6.topic: systemd Software suite that provides an array of system components for Linux operating systems. and removed 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 1001-2500 This PR causes many rebuilds on Linux and should target the staging branches. labels Jul 24, 2026
@leonbohn
leonbohn force-pushed the paho-mqtt-flaky-tests branch from edcc359 to 8a076c9 Compare July 26, 2026 17:52
@leonbohn
leonbohn changed the base branch from master to staging July 26, 2026 17:52
@nixpkgs-ci nixpkgs-ci Bot closed this Jul 26, 2026
@nixpkgs-ci nixpkgs-ci Bot reopened this Jul 26, 2026
@nixpkgs-branch-check
nixpkgs-branch-check Bot dismissed stale reviews from themself July 26, 2026 17:57

Review dismissed automatically

nixpkgs-branch-check[bot]

This comment was marked as outdated.

@nixpkgs-branch-check nixpkgs-branch-check Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The PR's base branch is set to master, but this PR causes 1287 rebuilds.
It is therefore considered a mass rebuild.
Please change the base branch to the right base branch for your changes (probably staging).

@dotlambda

Copy link
Copy Markdown
Member

I don't understand why it's so hard to follow my instructions. Do the rebase I asked for and don't change the target branch.

During testing, MQTT clients are spawned as subprocesses and then
stopped via SIGINT. Whether or not the SIGINT signal arrives before or
after the client has completed the initial setup and reached its
`loop_forever()` or `wait_for_keyboard_input()` call is
timing-dependent. This limitaiton is known by the upstream developers
(as witnessed by the comment in the custom implementation of
`wait_for_keyboard_interrupt`). As a consequence, people are getting
failures during teardown for different tests depending on the machine as
the timing is slightly different, see NixOS#542586.

This has been fixed upstream in eclipse-paho/paho.mqtt.python#934 by
introducing a signaling mechanism. This PR backports the fix.

Assited-by: Claude Sonnet 5
@nixpkgs-ci

nixpkgs-ci Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Successfully created backport PR for release-26.05:

@vcunat

vcunat commented Aug 1, 2026

Copy link
Copy Markdown
Member

It might be tough for people not experienced with this 🤷🏽 I'm really looking forward to this package not flaking anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: python Python is a high-level, general-purpose programming language. 8.has: port to stable This PR already has a backport to the stable release. 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 1001-2500 This PR causes many rebuilds on Linux and should target the staging branches. 12.first-time contribution This PR is the author's first one; please be gentle! backport release-26.05 Backport PR automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build failure: python314Packages.paho-mqtt

3 participants