Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-9399

Possible deadlock between DataflowWorkerLoggingHandler and overridden System.err PrintStream

Details

    • Bug
    • Status: Resolved
    • P0
    • Resolution: Fixed
    • None
    • 2.25.0
    • runner-dataflow
    • None

    Description

      When an exception is encountered in DataflowWorkerLoggingHandler the ErrorManager is used to log the exception. ErrorManager uses System.err which is overridden to be a PrintStream that writes back into DataflowWorkerLoggingHandler.

      This has the lock ordering DataflowWorkerLoggingHandler -> PrintStream.
      Other logging of System.err has the inverse lock ordering PrintStream->DataflowWorkerLoggingHandler so there is potential for deadlock.

      This is one known cause of the inversion, but any other System.err logs from inside DataflowWorkerLoggingHandler could cause the same issue.

      Proposed fix is to address low-hanging fruit of having ErrorManager output to the original System.err. A full fix would be to improve our override of System.err to a PrintStream that can detect the locking inversion or possibly we could use the PrintStream mutex in both cases.

      Attachments

        Activity

          People

            scwhittle Sam Whittle
            scwhittle Sam Whittle
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 12h 10m
                12h 10m