Skip to content

Kqueue: Delay removal from registration map to fix noisy warnings#15279

Merged
normanmaurer merged 1 commit into4.2from
kqueue_not_found
May 29, 2025
Merged

Kqueue: Delay removal from registration map to fix noisy warnings#15279
normanmaurer merged 1 commit into4.2from
kqueue_not_found

Conversation

@normanmaurer
Copy link
Copy Markdown
Member

Motivation:

In Kqueue it sometimes happened that we did see a WARN that the registration for a given id could not be found. The reason for this was that it is possible that the registration was already be cancelled by the user and so not present anymore. In this case the logs are harmless but still confusing. We should better ensure we handle it better.

Modifications:

When the user cancels a registration just mark it as cancelled and remove it from the map one all events are processed.

Result:

Less confusing logging and more correct handling of cancelled registrations

@normanmaurer
Copy link
Copy Markdown
Member Author

This could also be observed when running the Kqueue tests.

@normanmaurer normanmaurer requested a review from chrisvest May 28, 2025 14:09
@normanmaurer
Copy link
Copy Markdown
Member Author

We also need a variant of this in 4.1

@normanmaurer
Copy link
Copy Markdown
Member Author

/cc @daschl

@normanmaurer normanmaurer changed the title Kqueue: Delete removal from registration map to fix noisy warnings Kqueue: Delay removal from registration map to fix noisy warnings May 28, 2025
Motivation:

In Kqueue it sometimes happened that we did see a WARN that the registration for a given id could not be found. The reason for this was that it is possible that the registration was already be cancelled by the user and so not present anymore.
In this case the logs are harmless but still confusing. We should better ensure we handle it better.

Modifications:

When the user cancels a registration just mark it as cancelled and remove it from the map one all events are processed.

Result:

Less confusing logging and more correct handling of cancelled registrations
@normanmaurer normanmaurer added this to the 4.2.2.Final milestone May 28, 2025
Comment on lines +280 to +284
for (;;) {
DefaultKqueueIoRegistration cancelledRegistration = cancelledRegistrations.poll();
if (cancelledRegistration == null) {
return;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can also be written like this

Suggested change
for (;;) {
DefaultKqueueIoRegistration cancelledRegistration = cancelledRegistrations.poll();
if (cancelledRegistration == null) {
return;
}
DefaultKqueueIoRegistration cancelledRegistration;
while ((cancelledRegistration = cancelledRegistrations.poll()) != null) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I actually prefer the other style and it's also what we use in other places.

@normanmaurer normanmaurer merged commit 0e74575 into 4.2 May 29, 2025
14 of 16 checks passed
@normanmaurer normanmaurer deleted the kqueue_not_found branch May 29, 2025 10:48
@normanmaurer
Copy link
Copy Markdown
Member Author

Will work on a port to 4.1

normanmaurer added a commit that referenced this pull request May 30, 2025
…5279)

Motivation:

In Kqueue it sometimes happened that we did see a WARN that the
registration for a given id could not be found. The reason for this was
that it is possible that the registration was already be cancelled by
the user and so not present anymore. In this case the logs are harmless
but still confusing. We should better ensure we handle it better.

Modifications:

When the user cancels a registration just mark it as cancelled and
remove it from the map one all events are processed.

Result:

Less confusing logging and more correct handling of cancelled
registrations
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