Skip to content

'Fix' petsc raises#4384

Merged
dham merged 2 commits intoreleasefrom
connorjward/petsc_raises
Jun 25, 2025
Merged

'Fix' petsc raises#4384
dham merged 2 commits intoreleasefrom
connorjward/petsc_raises

Conversation

@connorjward
Copy link
Contributor

Since https://gitlab.com/petsc/petsc/-/commit/4237731afe36b4db0a3147aff0aed51d4657afa2 and the introduction of petsc_raises (c9d3922) we have been seeing random failures on CI that I have been unable to reproduce locally.

I was able to reproduce the stochastic failures with a Docker image (Python 3.12.3) which appear to go away when I install Python 3.12.11 (matches my local machine). My best guess is therefore that Python fixed things between these releases.

The best approach to me seems to be to allow the more permissive exception check until we reach a Python version that we think should be fine. We can revisit then if the issue continues.

The only other clue I have is we get the following reported error when things fail:

/usr/local/lib/python3.12/dist-packages/_pytest/unraisableexception.py:65: PytestUnraisableExceptionWarning: Exception ignored in tp_clear of: <class 'dict'>

  Traceback (most recent call last):
    File "petsc4py/PETSc/libpetsc4py.pyx", line 1004, in petsc4py.PETSc.MatMultTranspose_Python
    File "/opt/firedrake/firedrake/interpolation.py", line 1684, in multTranspose
      raise NotImplementedError(
  NotImplementedError: Can only apply adjoint to expressions consisting of a single argument at the moment.

  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

The Exception ignored in tp_clear of: <class 'dict'> makes it seem like a GC issue.

@connorjward connorjward mentioned this pull request Jun 20, 2025
Since https://gitlab.com/petsc/petsc/-/commit/4237731afe36b4db0a3147aff0aed51d4657afa2
and the introduction of `petsc_raises`
(c9d3922)
we have been seeing random failures on CI that I have been unable to
reproduce locally.

I was able to reproduce the stochastic failures with a Docker image
so my best guess is that these are caused by differences in the Python
version (since the PETSc error handling touches a *lot* of the Python
internals for handling exceptions).

The best approach to me seems to be to allow the more permissive
exception check until we reach a Python version that we think should
be fine. We can revisit then if the issue continues.
@connorjward connorjward force-pushed the connorjward/petsc_raises branch from 999c421 to 5972883 Compare June 24, 2025 13:55
@connorjward connorjward marked this pull request as ready for review June 24, 2025 13:55
@dham dham merged commit 1044796 into release Jun 25, 2025
6 of 7 checks passed
@dham dham deleted the connorjward/petsc_raises branch June 25, 2025 15:12
connorjward added a commit that referenced this pull request Jun 26, 2025
* Specialise petsc_raises on Python version (<3.12.11)

Since https://gitlab.com/petsc/petsc/-/commit/4237731afe36b4db0a3147aff0aed51d4657afa2
and the introduction of `petsc_raises`
(c9d3922)
we have been seeing random failures on CI that I have been unable to
reproduce locally.

I was able to reproduce the stochastic failures with a Docker image
so my best guess is that these are caused by differences in the Python
version (since the PETSc error handling touches a *lot* of the Python
internals for handling exceptions).

The best approach to me seems to be to allow the more permissive
exception check until we reach a Python version that we think should
be fine. We can revisit then if the issue continues.

* update comment
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.

3 participants