Skip to content

Conversation

@scwhittle
Copy link
Contributor

Fix an issue introduced by
#11096
where empty messages could end up being published to the handler if the PrintStream was flushed when empty. Added a unit test ensuring no empty messages are published.

Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

Post-Commit Tests Status (on master branch)

Lang SDK Apex Dataflow Flink Gearpump Samza Spark
Go Build Status --- --- Build Status --- --- Build Status
Java Build Status Build Status Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status Build Status
Build Status
Build Status
Python Build Status
Build Status
Build Status
Build Status
--- Build Status
Build Status
Build Status
Build Status
Build Status
--- --- Build Status
XLang --- --- --- Build Status --- --- Build Status

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website
Non-portable Build Status Build Status
Build Status
Build Status Build Status
Portable --- Build Status --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

@scwhittle
Copy link
Contributor Author

R: @lukecwik

@lukecwik lukecwik changed the title Ensure that empty messages are not flushed to handler. [BEAM-9399] Ensure that empty messages are not flushed to handler. Apr 8, 2020
@lukecwik
Copy link
Member

lukecwik commented Apr 8, 2020

retest this please

@lukecwik
Copy link
Member

lukecwik commented Apr 8, 2020

Run Java PreCommit

@lukecwik lukecwik merged commit 9280e68 into apache:master Apr 9, 2020
@scwhittle scwhittle deleted the fix_log branch May 6, 2020 22:28
@kplanes
Copy link

kplanes commented Oct 13, 2020

Hi -
I think we have been affected by this issue - do you know which version has the fix, we might have periods where part of the data pushed is empty and it is deadlocking our code - Happy to provide more details if needed. We work with gcp/java/maven+ dataflow runner - Please let me know if this isn't the right space to comment on this bug

@lukecwik
Copy link
Member

This was only part of the fix and this change appeared in the 2.21 release. The last part of the fix appears in the 2.25 release.

@kplanes
Copy link

kplanes commented Oct 14, 2020

Hi @lukecwik - Interestingly enough, I'm having it failing on the 2.23.0 version ?

Code : catch (Exception e) {
System.out.println("Failed to filter user data " + c.element());
e.printStackTrace();

I assume to work around would be to change it from send it to StackTrace to another print out ?

Errror :
java.lang.IllegalStateException: BEAM-9399: publish should not be called with the lock as it may cause deadlock
at org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions.checkState(Preconditions.java:507)
at org.apache.beam.runners.dataflow.worker.logging.JulHandlerPrintStreamAdapterFactory$JulHandlerPrintStream.publishIfNonEmpty(JulHandlerPrintStreamAdapterFactory.java:380)
at org.apache.beam.runners.dataflow.worker.logging.JulHandlerPrintStreamAdapterFactory$JulHandlerPrintStream.println(JulHandlerPrintStreamAdapterFactory.java:332)
at java.lang.Throwable$WrappedPrintStream.println(Throwable.java:748)
at java.lang.Throwable.printStackTrace(Throwable.java:655)
at java.lang.Throwable.printStackTrace(Throwable.java:643)
at java.lang.Throwable.printStackTrace(Throwable.java:634)
at com.metix.historic.transforms.FilterAndMapPatientsByAge.processElement(FilterAndMapPatientsByAge.java:25)

@lukecwik
Copy link
Member

That would work.

Hi @lukecwik - Interestingly enough, I'm having it failing on the 2.23.0 version ?

Code : catch (Exception e) {
System.out.println("Failed to filter user data " + c.element());
e.printStackTrace();

I assume to work around would be to change it from send it to StackTrace to another print out ?

Errror :
java.lang.IllegalStateException: BEAM-9399: publish should not be called with the lock as it may cause deadlock
at org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions.checkState(Preconditions.java:507)
at org.apache.beam.runners.dataflow.worker.logging.JulHandlerPrintStreamAdapterFactory$JulHandlerPrintStream.publishIfNonEmpty(JulHandlerPrintStreamAdapterFactory.java:380)
at org.apache.beam.runners.dataflow.worker.logging.JulHandlerPrintStreamAdapterFactory$JulHandlerPrintStream.println(JulHandlerPrintStreamAdapterFactory.java:332)
at java.lang.Throwable$WrappedPrintStream.println(Throwable.java:748)
at java.lang.Throwable.printStackTrace(Throwable.java:655)
at java.lang.Throwable.printStackTrace(Throwable.java:643)
at java.lang.Throwable.printStackTrace(Throwable.java:634)
at com.metix.historic.transforms.FilterAndMapPatientsByAge.processElement(FilterAndMapPatientsByAge.java:25)

Yes, using another printstream would work around the issue.

@scwhittle Any ideas as to why it would be broken in 2.23?

@scwhittle
Copy link
Contributor Author

scwhittle commented Oct 14, 2020 via email

@wclaralee
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants