Skip to content

Comments

Fix context manager tracking stack issue causing random 500 errors#9

Merged
dgarciabriseno merged 3 commits intoHelioviewer-Project:mainfrom
dgarciabriseno:context-manager-fix
Feb 4, 2026
Merged

Fix context manager tracking stack issue causing random 500 errors#9
dgarciabriseno merged 3 commits intoHelioviewer-Project:mainfrom
dgarciabriseno:context-manager-fix

Conversation

@dgarciabriseno
Copy link

This was an upstream issue in sunpy where some context managers like transform_with_sun_center were not thread safe, so multiple requests could interfere with each other in this way.

  File "/home/nonroot/.conda/envs/coordinator/lib/python3.13/site-packages/sunpy/coordinates/screens.py", line 42, in __exit__
    raise RuntimeError(f"Cannot remove {self._context_name} from tracking stack because {removed} is last active.")
RuntimeError: Cannot remove sunpy.coordinates.screens.SphericalScreen from tracking stack because sunpy.coordinates._transformations.transform_with_sun_center is last active.
      INFO   172.17.0.1:36796 - "GET
             /hgs2hpc?lat=13&lon=-35&coord_time=2026-02-01T23%3A57Z&target=2026-
             02-02+15%3A43%3A00 HTTP/1.1" 500

@dgarciabriseno dgarciabriseno merged commit 13645c7 into Helioviewer-Project:main Feb 4, 2026
3 checks passed
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.

1 participant