Skip to content

Commit

Permalink
logging module has handled this condition for some time
Browse files Browse the repository at this point in the history
This code was originally added to address
https://trac.openmicroscopy.org/ome/ticket/3260 where an exception was
being raised:

    Traceback (most recent call last):
      File "/usr/lib/python2.4/logging/__init__.py", line 737, in emit
        self.stream.write(fs % msg)
    ValueError: I/O operation on closed file

Due to the many changes in interpreter behaviour since Python 2.4,
including those surrounding sys.exit in the ~2.6.5 era [^1], as well as
improvements to the logging module itself this is no longer an issue.

In the referenced Python issue 9501, the related code changes were
originally committed in Subversion r84282, Mercurial changeset
42c70f17c2fede6116108568a75b0eec08b3c73a, Git commit
1ddd51fc71c6a6d255eee8e7e54d1bf7e05c5841.  Found by tracing the
Mercurial changeset via `Misc/svnmap.txt` in the cython repository.

At a future date `omero.util.concurrency.AtExitEvent` and
`omero.util.concurrency.get_event()` should likely be deprecated and
their use discontinued.  They attempt to handle issues that no longer
exist and add complexity and maintenance overhead to our runtime.

See also:
 * https://bugs.python.org/issue6333
 * https://bugs.python.org/issue13807

[^1]: https://stackoverflow.com/questions/3713360/python-2-6-x-theading-signals-atexit-fail-on-some-versions/3765160#3765160
  • Loading branch information
chris-allan committed Aug 5, 2024
1 parent 5891208 commit 0f8fe1c
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/omero/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,12 +666,6 @@ def run(self):
ctx.stop_event.wait(ctx.sleeptime)
except ValueError:
pass

if isinstance(ctx.stop_event,
omero.util.concurrency.AtExitEvent):
if ctx.stop_event.atexit:
return # Skipping log. See #3260

ctx.logger.info("Halted")

self.thread = Task(daemon=True)
Expand Down

0 comments on commit 0f8fe1c

Please sign in to comment.