[ 
https://issues.apache.org/jira/browse/BEAM-9399?focusedWorklogId=503377&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-503377
 ]

ASF GitHub Bot logged work on BEAM-9399:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 21/Oct/20 20:10
            Start Date: 21/Oct/20 20:10
    Worklog Time Spent: 10m 
      Work Description: wclaralee commented on pull request #11351:
URL: https://github.com/apache/beam/pull/11351#issuecomment-713845148


   Hello, I am now getting this error since adding usage of BigQuery Storage 
API when reading from a table using `.withMethod(Method.DIRECT_READ)` using 
beam 2.21.0. The error stack trace I get is similar to the one above: 
   `Error message from worker: java.lang.IllegalStateException: BEAM-9399: 
publish should not be called with the lock as it may cause deadlock 
org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions.checkState(Preconditions.java:507)
 
org.apache.beam.runners.dataflow.worker.logging.JulHandlerPrintStreamAdapterFactory$JulHandlerPrintStream.publishIfNonEmpty(JulHandlerPrintStreamAdapterFactory.java:380)
 
org.apache.beam.runners.dataflow.worker.logging.JulHandlerPrintStreamAdapterFactory$JulHandlerPrintStream.println(JulHandlerPrintStreamAdapterFactory.java:332)
 java.lang.Throwable$WrappedPrintStream.println(Throwable.java:748) 
java.lang.Throwable.printStackTrace(Throwable.java:655) 
java.lang.Throwable.printStackTrace(Throwable.java:643) 
java.lang.Throwable.printStackTrace(Throwable.java:634) 
org.slf4j.helpers.Util.report(Util.java:124) `
   (^truncated a bit.)
   Please let me know. Thank you. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 503377)
    Time Spent: 12h 10m  (was: 12h)

> Possible deadlock between DataflowWorkerLoggingHandler and overridden 
> System.err PrintStream
> --------------------------------------------------------------------------------------------
>
>                 Key: BEAM-9399
>                 URL: https://issues.apache.org/jira/browse/BEAM-9399
>             Project: Beam
>          Issue Type: Bug
>          Components: runner-dataflow
>            Reporter: Sam Whittle
>            Assignee: Sam Whittle
>            Priority: P0
>             Fix For: 2.25.0
>
>          Time Spent: 12h 10m
>  Remaining Estimate: 0h
>
> 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to