Skip to content

Commit f23deb6

Browse files
committed
TS-45056 Comments with more details on the "why"
1 parent 10806f8 commit f23deb6

File tree

1 file changed

+5
-0
lines changed
  • agent/src/main/java/com/teamscale/jacoco/agent

1 file changed

+5
-0
lines changed

agent/src/main/java/com/teamscale/jacoco/agent/Agent.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ private static void deleteDirectoryIfEmpty(Path directory) throws IOException {
159159
/**
160160
* Dumps the current execution data, converts it, writes it to the output directory defined in {@link #options} and
161161
* uploads it if an uploader is configured. Logs any errors, never throws an exception.
162+
* <p>
163+
* Synchronized because this can be triggered concurrently by the timer and by the HTTP /dump endpoint.
162164
*/
163165
@Override
164166
public synchronized void dumpReport() {
@@ -182,6 +184,9 @@ private void dumpReportUnsafe() {
182184
return;
183185
}
184186

187+
// Created fresh per dump so its CoverageBuilder does not carry class IDs from previous dumps.
188+
// Without this, application server reloads (for example, JBoss) cause an IllegalStateException
189+
// because the reloaded class has a different CRC64 than what CoverageBuilder stored earlier.
185190
JaCoCoXmlReportGenerator generator = new JaCoCoXmlReportGenerator(
186191
options.getClassDirectoriesOrZips(), options.getLocationIncludeFilter(),
187192
options.getDuplicateClassFileBehavior(), options.shouldIgnoreUncoveredClasses(), wrap(logger));

0 commit comments

Comments
 (0)