Skip to content

Require ipykernel>=7.4.0 to stop example notebooks hanging in CI - #5905

Merged
rtimms merged 4 commits into
mainfrom
claude/pybamm-issue-5884-df3983
Oct 14, 2026
Merged

rtimms merged 4 commits into
mainfrom
claude/pybamm-issue-5884-df3983

Conversation

@rtimms

@rtimms rtimms commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #5884.

Cause

The Example notebooks job intermittently times out because of a bug in ipykernel 7.3.0, not in PyBaMM. ipykernel 7.2 and 7.3 send shell replies with a raw send on the ROUTER socket that a ZMQStream reads requests from. That can leave an execute_request unread: the kernel sits idle at 0% CPU, never replies, and nbmake waits out its 300 s timeout (ipython/ipykernel#1554). ipykernel 7.4.0 fixes it by sending the reply through the stream (ipython/ipykernel#1529). ipykernel 7.3.0 came in with #5749 on 16 Sep.

Evidence

  • The 20 A re-solve in lead-acid.ipynb takes under 1 s and is deterministic; 1,200 looped solves never stalled.

  • Running 24 copies of the notebook through nbmake with 8 workers reproduced the hang locally (3/24, then 1/24). Hung kernels were idle in their event loop, and a faulthandler dump in the cell never fired, so the cell had already finished. One timeout landed on the trivial pybamm.print_citations() cell.

  • 48 copies per batch:

    ipykernel / jupyter-client Result
    7.3.0 / 8.10.0 (current lock) 1–3 hangs per 24
    7.2.0 / 8.8.0 48/48 passed
    7.4.0 / 8.10.0 48/48 passed in four batches

    One further 7.4.0 batch had 16 failures whose log was lost to a session restart, so its cause is unknown; the four clean batches came after it.

Change

  • dev extra: ipykernel>=7.4.0; python_version >= '3.11'. ipykernel 7.4 requires Python 3.11+, so 3.10 stays on 7.3.0; the examples job runs on 3.13.

  • uv.lock: only ipykernel changes (7.3.0 for 3.10, 7.4.0 for ≥3.11).

  • The save_custom_model and load_custom_model doctests both wrote basicdfn_model.json in the working directory, which made the parallel Doctests job fail on this PR. The save_custom_model example now writes basicdfn_saved.json.

No CHANGELOG entry, as this only changes a dev dependency.

🤖 Generated with Claude Code

ipykernel 7.2/7.3 send shell replies raw on the ROUTER socket that a
ZMQStream reads requests from, which can leave an execute_request unread:
the kernel sits idle and nbmake times out after 300 s. ipykernel 7.4.0
sends the reply through the stream (ipython/ipykernel#1529).

Fixes #5884

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rtimms
rtimms requested a review from a team as a code owner October 13, 2026 23:17
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

ProjectPyBaMM
Branchclaude/pybamm-issue-5884-df3983
Testbedbare-metal

⚠️ WARNING: Truncated view!

The full continuous benchmarking report exceeds the maximum length allowed on this platform.

🐰 View full continuous benchmarking report in Bencher

@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.13%. Comparing base (54318ca) to head (78e8e91).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5905   +/-   ##
=======================================
  Coverage   98.12%   98.13%           
=======================================
  Files         348      348           
  Lines       35578    35578           
=======================================
+ Hits        34912    34913    +1     
+ Misses        666      665    -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

The save_custom_model and load_custom_model doctests both wrote
basicdfn_model.json in the working directory, so under pytest -nauto one
could read the file while the other was rewriting it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rtimms
rtimms enabled auto-merge (squash) October 14, 2026 10:37
@rtimms
rtimms merged commit 2b0951f into main Oct 14, 2026
59 of 65 checks passed
@rtimms
rtimms deleted the claude/pybamm-issue-5884-df3983 branch October 14, 2026 12:24
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.

lead-acid example notebook intermittently times out in CI

3 participants