Skip to content

Conversation

kozlovic
Copy link
Member

If the user destroys the connection while the read event was in progress it could be possible for the library to crash trying to process a read event.

We need to immediately stop polling when the read event is removed.

Changing also the way we retain the connection: we will now retain on the very first attach, and the adapters will have to call natsConnection_Destroy() when the event loop is fully detached.

Resolves #888

Signed-off-by: Ivan Kozlovic ivan@synadia.com

Copy link

codecov bot commented Jul 22, 2025

Codecov Report

Attention: Patch coverage is 40.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 70.28%. Comparing base (5b12f90) to head (b89b44d).
Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
src/conn.c 40.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #889      +/-   ##
==========================================
+ Coverage   70.26%   70.28%   +0.01%     
==========================================
  Files          47       47              
  Lines       15560    15576      +16     
  Branches     3203     3209       +6     
==========================================
+ Hits        10934    10948      +14     
+ Misses       1547     1541       -6     
- Partials     3079     3087       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…uming

If the user destroys the connection while the read event was in progress
it could be possible for the library to crash trying to process a read
event.

We need to immediately stop polling when the read event is removed.

Changing also the way we retain the connection: we will now retain
on the very first attach, and the adapters will have to call
`natsConnection_Destroy()` when the event loop is fully detached.

Resolves #888

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

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

LGTM

@kozlovic kozlovic merged commit 665febe into main Jul 22, 2025
29 checks passed
@kozlovic kozlovic deleted the fix_888 branch July 22, 2025 23:53
github-actions bot pushed a commit that referenced this pull request Jul 22, 2025
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.

Why is there no retain(nc) in the natsLibevent_Attach() function, and then a corresponding decrement in natsLibevent_Detach()?
2 participants