> Running two or more `jlink` invocations concurrently in the same JVM through 
> the `ToolProvider` API causes the simultaneous `run` calls to interfere with 
> one another, even when each invocation targets a distinct `--output` 
> directory and the invocations share no inputs. They may fail with errors such 
> as:
> 
> Error: java.lang.IllegalStateException: stream has already been operated upon 
> or closed
> Error: Resource XYZ already present
> 
> The problem is that Main.run(...) correctly creates a new `JlinkTask` for 
> each call, but `JlinkTask` defeats this isolation by sharing static 
> `TaskHelper` and `OptionsHelper` instances. Concurrent invocations can 
> therefore overwrite one another’s parsed options and plugin pipelines.
> 
> The proposed solution is to make `taskHelper` and `optionsHelper` instance 
> fields of `JlinkTask`. This preserves actual concurrency. Synchronizing the 
> provider would unnecessarily serialize image creation and would not protect 
> separate provider instances or direct calls to `Main.run(...)`.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Dušan Bálek has updated the pull request incrementally with one additional 
commit since the last revision:

  Test updated.

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/32469/files
  - new: https://git.openjdk.org/jdk/pull/32469/files/3760ab3b..9dc20ac2

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=32469&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=32469&range=00-01

  Stats: 12 lines in 1 file changed: 0 ins; 8 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/32469.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/32469/head:pull/32469

PR: https://git.openjdk.org/jdk/pull/32469

Reply via email to