Skip to content

fix: ensure NatsConnectionPool cannot overflow#1005

Merged
mtmk merged 1 commit into
nats-io:mainfrom
MiloszKrajewski:NatsConnectionPool-overflow
Nov 26, 2025
Merged

fix: ensure NatsConnectionPool cannot overflow#1005
mtmk merged 1 commit into
nats-io:mainfrom
MiloszKrajewski:NatsConnectionPool-overflow

Conversation

@MiloszKrajewski

Copy link
Copy Markdown
Contributor

Call me paranoid but assuming someone can try to send 5000 messages per second (which is not insane) by taking connection from pool every time (which is not insane either) it gives service 5 days before crash (2**31/5000/60/60/24 = 4.97).

This is just about ensuring division returns positive number.

@mtmk

mtmk commented Nov 24, 2025

Copy link
Copy Markdown
Member

thanks for the fix @MiloszKrajewski it sounds like a long shot but nevertheless it was a bug.

Can you also sign the commit please? CNCF policy we must have all commits signed in a PR.

@MiloszKrajewski
MiloszKrajewski force-pushed the NatsConnectionPool-overflow branch from ee9adce to d86e893 Compare November 25, 2025 20:04
@MiloszKrajewski

Copy link
Copy Markdown
Contributor Author

Can you also sign the commit please? CNCF policy we must have all commits signed in a PR.

I think it should be fine now.

@mtmk mtmk left a comment

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.

LGTM thanks @MiloszKrajewski

@mtmk mtmk self-assigned this Nov 26, 2025
@mtmk
mtmk merged commit b06ba3a into nats-io:main Nov 26, 2025
20 of 21 checks passed
mtmk added a commit that referenced this pull request Dec 11, 2025
* Add prioritized mode (#1011)
* Add Publish Timeout on Disconnect (#1001)
* Fix test flap (#1012)
* Add test to promote mirrored to regular stream (#1008)
* Add Nats-Expected-Last-Subject-Sequence-Subject (#1007)
* Fix keyed NATS clients with configurations (#1006)
* ensure NatsConnectionPool cannot overflow (#1005)
* Fix stream config adjustments on update (#995)
* Handel Unobserved Exceptions During Connection State Transitions (#999)
* Added verification of the consumer sequence number for pull ordered consumers (#981)
* Fix build warnings (#991)
* Reduce closure allocations (#988)
@mtmk mtmk mentioned this pull request Dec 11, 2025
mtmk added a commit that referenced this pull request Dec 11, 2025
* Add prioritized mode (#1011)
* Add Publish Timeout on Disconnect (#1001)
* Fix test flap (#1012)
* Add test to promote mirrored to regular stream (#1008)
* Add Nats-Expected-Last-Subject-Sequence-Subject (#1007)
* Fix keyed NATS clients with configurations (#1006)
* ensure NatsConnectionPool cannot overflow (#1005)
* Fix stream config adjustments on update (#995)
* Handel Unobserved Exceptions During Connection State Transitions (#999)
* Added verification of the consumer sequence number for pull ordered consumers (#981)
* Fix build warnings (#991)
* Reduce closure allocations (#988)
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