Skip to content

Commit

Permalink
Prevent a reentrancy bug
Browse files Browse the repository at this point in the history
  • Loading branch information
amadanmath committed Oct 4, 2021
1 parent 0060ce7 commit c667cd1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/src/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1240,13 +1240,14 @@ def save(self, document=None):
tmp_file.flush()

try:
with Annotations(tmp_file.name) as ann:
# read only, because we write manually using copyfile; this prevents certain reentrant errors
with Annotations(tmp_file.name, read_only=True) as ann:
# Move the temporary file onto the old file
copyfile(tmp_file.name, self._input_files[0])
# As a matter of convention we adjust the modified
# time of the data dir when we write to it. This
# helps us to make back-ups
time()
# time()
# XXX: Disabled for now!
#utime(DATA_DIR, (now, now))
except Exception as e:
Expand Down

0 comments on commit c667cd1

Please sign in to comment.