You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Beam JIRA Bot (Jira)" <ji...@apache.org> on 2021/07/06 17:21:01 UTC
[jira] [Commented] (BEAM-12215) DirectRunner NullPointerException
[ https://issues.apache.org/jira/browse/BEAM-12215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17375877#comment-17375877 ]
Beam JIRA Bot commented on BEAM-12215:
--------------------------------------
This issue was marked "stale-P2" and has not received a public comment in 14 days. It is now automatically moved to P3. If you are still affected by it, you can comment and move it back to P2.
> 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
> Priority: P3
>
> 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)