Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: FnHarness.main not thread-safe on JvmInitializer calls #32990

Open
17 tasks
Abacn opened this issue Oct 31, 2024 · 0 comments
Open
17 tasks

[Bug]: FnHarness.main not thread-safe on JvmInitializer calls #32990

Abacn opened this issue Oct 31, 2024 · 0 comments

Comments

@Abacn
Copy link
Contributor

Abacn commented Oct 31, 2024

What happened?

FnHarness.main usually started from a fresh jvm on worker. However, there is also an EmbeddedEnvironmentFactory that creates an environment where FnHarness is embedded, as a result a single JVM is used. This becomes a problem when running various pipelines at the same time, like in a gradle test task:

A suspected racing condition:

  • Pipeline A loaded some java class at runtime

  • Pipeline B execution startup, in JvmInitializers.beforeProcessing, gathered all JvmInitializers implementations

JvmInitializers.runBeforeProcessing(options);

ServiceLoader<T> loader = ServiceLoader.load(iface, classLoader);

  • Pipeline A clean up, removed those classes from temp dir

  • Pipeline B trying to fetch those class instances from ServiceLoader, however they are gone

In general, the JvmInitializer mechanism did not consider the scenario of embedded FnHarness. Running multiple tests in parallel using portable runner "initializes" jvm each time a FnHarness started.

This causes #30512 (comment)

Issue Priority

Priority: 2 (default / most bugs should be filed as P2)

Issue Components

  • Component: Python SDK
  • Component: Java SDK
  • Component: Go SDK
  • Component: Typescript SDK
  • Component: IO connector
  • Component: Beam YAML
  • Component: Beam examples
  • Component: Beam playground
  • Component: Beam katas
  • Component: Website
  • Component: Infrastructure
  • Component: Spark Runner
  • Component: Flink Runner
  • Component: Samza Runner
  • Component: Twister2 Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant