-
Notifications
You must be signed in to change notification settings - Fork 759
Open
Labels
Description
Bug report
Expected behavior and actual behavior
Expected: Any registered TraceObserverV2::onFlowComplete triggers only once, even if a task is retried.
Actual: If a task is retried, then it seems to trigger twice. This will then result in, for example, java.nio.file.FileAlreadyExistsException for reports. This can be seen in the logs easily as the log messages from observers are duplicated, but on different threads.
Steps to reproduce the problem
- Download a nextflow 25.10.x version (doesn't seem to happen in other versions)
- Create a simple workflow like this:
process HELLO_WORLD {
script: '''
echo hello world
'''
}
process HELLO_WORLD_2 {
errorStrategy 'retry'
script: '''
exit 1
'''
}
workflow {
HELLO_WORLD()
HELLO_WORLD_2()
}
- Run
./nextflow-25.10.0 run example.nf -with-report
Program output
Dec-30 00:38:37.674 [TaskFinalizer-2] DEBUG n.trace.WorkflowStatsObserver - Workflow completed > WorkflowStats[succeededCount=0; failedCount=2; ignoredCount=0; cachedCount=0; pendingCount=0; submittedCount=0; runningCount=0; retriesCount=1; abortedCount=1; succeedDuration=0ms; failedDuration=6ms; cachedDuration=0ms;loadCpus=0; loadMemory=0; peakRunning=2; peakCpus=2; peakMemory=0; ]
Dec-30 00:38:37.695 [Task monitor] DEBUG n.processor.TaskPollingMonitor - <<< barrier arrives (monitor: local) - terminating tasks monitor poll loop
Dec-30 00:38:37.830 [TaskFinalizer-2] DEBUG nextflow.trace.ReportObserver - Workflow completed -- rendering execution report
Dec-30 00:38:38.680 [main] DEBUG nextflow.Session - Session await > all processes finished
Dec-30 00:38:38.681 [main] DEBUG nextflow.Session - Session await > all barriers passed
Dec-30 00:38:38.682 [main] DEBUG n.trace.WorkflowStatsObserver - Workflow completed > WorkflowStats[succeededCount=0; failedCount=2; ignoredCount=0; cachedCount=0; pendingCount=0; submittedCount=0; runningCount=0; retriesCount=1; abortedCount=1; succeedDuration=0ms; failedDuration=6ms; cachedDuration=0ms;loadCpus=0; loadMemory=0; peakRunning=2; peakCpus=2; peakMemory=0; ]
Dec-30 00:38:38.682 [main] DEBUG nextflow.trace.ReportObserver - Workflow completed -- rendering execution report
Dec-30 00:38:39.325 [main] WARN nextflow.trace.ReportObserver - Failed to render execution report -- see the log file for details
nextflow.exception.AbortOperationException: Report file already exists: report-20251230-2316430.html -- enable the 'report.overwrite' option in your config file to overwrite existing files
at nextflow.trace.TraceHelper.newFileWriter(TraceHelper.groovy:67)
at nextflow.trace.ReportObserver.renderHtml(ReportObserver.groovy:243)
at nextflow.trace.ReportObserver.onFlowComplete(ReportObserver.groovy:129)
at nextflow.Session$_notifyFlowComplete_lambda39.doCall(Session.groovy:1121)
at nextflow.Session.notifyEvent(Session.groovy:1151)
at nextflow.Session.notifyFlowComplete(Session.groovy:1121)
at nextflow.Session.shutdown0(Session.groovy:779)
at nextflow.Session.destroy(Session.groovy:724)
at nextflow.script.ScriptRunner.shutdown(ScriptRunner.groovy:263)
at nextflow.script.ScriptRunner.execute(ScriptRunner.groovy:147)
at nextflow.cli.CmdRun.run(CmdRun.groovy:428)
at nextflow.cli.Launcher.run(Launcher.groovy:515)
at nextflow.cli.Launcher.main(Launcher.groovy:675)
Caused by: java.nio.file.FileAlreadyExistsException: report-20251230-2316430.html
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:94)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:261)
at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:482)
at java.base/java.nio.file.Files.newOutputStream(Files.java:228)
at java.base/java.nio.file.Files.newBufferedWriter(Files.java:3001)
at nextflow.trace.TraceHelper.newFileWriter(TraceHelper.groovy:64)
... 12 common frames omitted
Environment
- Nextflow version: 25.10.0
- Java version: 17
- Operating system: Linux
- Bash version: 5.2.21(1)-release