Skip to content

Fix: zero division crashes when task realtime is 0#385

Merged
nadnein merged 2 commits intonextflow-io:devfrom
nadnein:fix/zero_div_error
May 4, 2026
Merged

Fix: zero division crashes when task realtime is 0#385
nadnein merged 2 commits intonextflow-io:devfrom
nadnein:fix/zero_div_error

Conversation

@nadnein
Copy link
Copy Markdown
Collaborator

@nadnein nadnein commented May 4, 2026

When a Nextflow task reports realtime = 0, two separate code paths crash with ArithmeticException:

  • Calculator.weightedAverage() divides by the sum of weights, which is 0 when all realtime values are 0 — added a norm == 0 guard returning null early.
  • CiRecordCollector.getWeightedCI() divides by duration (= complete - start), which is 0 when both timestamps are identical — added an early return of the CI at the start timestamp.

nadnein added 2 commits May 4, 2026 14:51
Signed-off-by: nadnein <nadjav.18@gmail.com>
Signed-off-by: nadnein <nadjav.18@gmail.com>
@nadnein nadnein requested a review from JosuaCarl May 4, 2026 13:12
Copy link
Copy Markdown
Collaborator

@JosuaCarl JosuaCarl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@nadnein nadnein merged commit dacf37b into nextflow-io:dev May 4, 2026
3 checks passed
@nadnein nadnein deleted the fix/zero_div_error branch May 4, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants