Resolve "`RuntimeError: Unable to release an unacquired lock` error"
Merge Request Checklist
-
Link to an issue -
Include the proposed fix or feature -
Include and update tests for the modified code -
Include a documentation change -
Add a CHANGELOG.md entry in the Unreleased section
Once your merge request is complete, please assign it a Meltano maintainer for review cycle. Once the review cycle finished, the reviewer shall approve the merge request so it can be merged by any Meltano maintainer.
Closes #1120 (closed)
This MR fixes a bug where trying to read the meltano.yml
inside an meltano_update
would cause an error. This approach was bad, because it forced the read to use the same lock as the write process, and that lock is not re-entry safe.
Instead, the solution here is to make sure to always read and update inside the meltano_update
critical section.
Before
plugin = config_service.find_plugin(…)
… (update the plugin)
with project.meltano_update() as meltano:
meltano[…] = plugin
After
with project.meltano_update() as meltano:
# we are sure nobody can update the `meltano.yml` at this point
plugin = config_service.find_plugin(…)
… (update the plugin)
meltano[…] = plugin
This also fixes an issue with the json serializer that caused me not to be able to load the UI at all.
Edited by Melty Bot