Skip to content

Commit

Permalink
Fix overflow in kqueue backend (#115)
Browse files Browse the repository at this point in the history
Closes #111

@mitchellh I managed to write a test to avoid regressions but I'm not
sure it's deterministic, should I still add it?
  • Loading branch information
mitchellh authored Nov 19, 2024
2 parents 6afcde9 + a2d9b31 commit 690c76f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/backend/kqueue.zig
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,9 @@ pub const Loop = struct {
// Only resubmit if we aren't already active (in the queue)
.rearm => if (!c_active) self.submissions.push(c),
}

// If we filled the events slice, we break to avoid overflow.
if (changes == events.len) break;
}

// Determine our next timeout based on the timers
Expand Down

0 comments on commit 690c76f

Please sign in to comment.