Skip to content

Conversation

@trexfeathers
Copy link
Contributor

@trexfeathers trexfeathers commented Oct 23, 2025

🚀 Pull Request

Description

Thanks to @RachelNorth and @TeresaHughes for reporting this.

Even when our NetCDF save operations are fully serialised - no parallelism - HDF still occasionally fails to acquire the file. This is despite all Python locks being available at expected moments, and the file reporting as closed. During testing, 2nd retry always succeeded. This is likely caused by HDF-level locking running on a different timescale to Python-level locking - i.e. sometimes Python has released its locks but HDF still has not. Thought to be filesystem-dependent; further investigation is needed but time is limited at the moment so it seemed best to just get the protective code in immediately.


Consult Iris pull request check list


Add any of the below labels to trigger actions on this PR:

  • benchmark_this Request that this pull request be benchmarked to check if it introduces performance shifts

@codecov
Copy link

codecov bot commented Oct 23, 2025

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.30%. Comparing base (24e258f) to head (b89f40c).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
lib/iris/fileformats/netcdf/_thread_safe_nc.py 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6760      +/-   ##
==========================================
+ Coverage   90.25%   90.30%   +0.05%     
==========================================
  Files          91       91              
  Lines       24630    24682      +52     
  Branches     4609     4625      +16     
==========================================
+ Hits        22229    22290      +61     
+ Misses       1624     1620       -4     
+ Partials      777      772       -5     

☔ View full report in Codecov by Sentry.
📢 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.

return DatasetOriginal(*args, **kwargs)


def test_handle_hdf_locking_error(dataset_path, monkeypatch, write_proxy):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I should probably also have test coverage showing that Iris will bail after 5 attempts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@trexfeathers trexfeathers marked this pull request as draft October 29, 2025 11:15
@trexfeathers trexfeathers requested a review from HGWright October 29, 2025 11:15
@trexfeathers trexfeathers moved this to 🚀 In Progress in 🦌 Iris 3.14 Oct 29, 2025
@trexfeathers trexfeathers moved this from 🚀 In Progress to 👀 In Review in 🦌 Iris 3.14 Oct 29, 2025
@trexfeathers trexfeathers marked this pull request as ready for review October 29, 2025 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status
Status: 👀 In Review

Development

Successfully merging this pull request may close these issues.

2 participants