You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Lai Jiang (Jira)" <ji...@apache.org> on 2021/04/23 13:43:00 UTC
[jira] [Created] (BEAM-12215) DirectRunner NullPointerException
Lai Jiang created BEAM-12215:
--------------------------------
Summary: DirectRunner NullPointerException
Key: BEAM-12215
URL: https://issues.apache.org/jira/browse/BEAM-12215
Project: Beam
Issue Type: Bug
Components: runner-direct, sdk-java-core, testing
Affects Versions: 2.28.0
Reporter: Lai Jiang
When using the {{DirectRunner}} in tests I encountered flaky tests due to {{NullPointerException}}.
When the test fails the relevant stack trace is like below:
{code:java}
java.lang.NullPointerException
at org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions.checkNotNull(Preconditions.java:877)
at org.apache.beam.vendor.guava.v26_0_jre.com.google.common.util.concurrent.ThreadFactoryBuilder.setThreadFactory(ThreadFactoryBuilder.java:132)
at org.apache.beam.runners.direct.DirectRunner.run(DirectRunner.java:192)
at org.apache.beam.runners.direct.DirectRunner.run(DirectRunner.java:67)
at org.apache.beam.sdk.Pipeline.run(Pipeline.java:322)
at google.registry.beam.TestPipelineExtension.run(TestPipelineExtension.java:344)
at google.registry.beam.TestPipelineExtension.run(TestPipelineExtension.java:324)
at google.registry.beam.spec11.Spec11PipelineTest.testSuccess_saveToGcs(Spec11PipelineTest.java:185){code}
However the null pointer seems to have come from calling (a repackaged and very innocent looking) guava function to set the {{ThreadFactory}}:
{code:java}
ExecutorService metricsPool =
Executors.newCachedThreadPool(
new ThreadFactoryBuilder()
.setThreadFactory(MoreExecutors.platformThreadFactory())
.setDaemon(false) // otherwise you say you want to leak, please don't!
.setNameFormat("direct-metrics-counter-committer")
.build());{code}
Which in turn is just calling java.util.concurrent.Executors.defaulThreatFactory() when not on App Engine:
{code:java}
@Beta
@GwtIncompatible
public static ThreadFactory platformThreadFactory() {
if (!isAppEngine()) {
return Executors.defaultThreadFactory();
} else {
...
} {code}
I don't understand how this could possibly have failed. The test seems to be only flaky on our CI servers running Ubuntu and I haven't been able to reproduce it locally, making debugging a challenge.
I'd appreciate any input you may have. Thanks!
--
This message was sent by Atlassian Jira
(v8.3.4#803005)