> This fixes a race condition in the CompressionBackend class of the heap dump > code. > > The race happens when the thread iterating the heap wants to write the data > it has collected. If the compression backend has worker threads, the buffer > to write would just be added to a queue and the worker threads would then > compress (if needed) and write the buffer. But if no worker threads are > present, the thread doing the iteration must do this itself. > > The iterating thread checks the _nr_of_threads member under lock protection > and if it is 0, it assume it would have to do the work itself. It then > releases the lock and enters the loop of the worker threads for one round. > But after the lock has been released, a worker thread could be registered and > handle the buffer itself. Then the iterating thread would wait until another > buffer is available, which will never happen. > > The fix is to take the buffer to write out of the queue in the iterating > thread under lock protection and the do the unlocking.
Ralf Schmelter has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision: - Simplify thread_loop() - Merge branch 'master' of https://github.com/openjdk/jdk into JDK-8255661 - Merge branch 'master' of https://github.com/openjdk/jdk into JDK-8255661 - Fix punctuation - Simplify code - Fix race in heap dump compression backend ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/3628/files - new: https://git.openjdk.java.net/jdk/pull/3628/files/fb17cab8..1891197a Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3628&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3628&range=00-01 Stats: 555249 lines in 4988 files changed: 44477 ins; 497699 del; 13073 mod Patch: https://git.openjdk.java.net/jdk/pull/3628.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/3628/head:pull/3628 PR: https://git.openjdk.java.net/jdk/pull/3628
