Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive call in Pushsubscription leads to stack overflow #446

Closed
segfaultdoc opened this issue May 19, 2022 · 3 comments
Closed

Recursive call in Pushsubscription leads to stack overflow #446

segfaultdoc opened this issue May 19, 2022 · 3 comments
Labels
bug Confirmed reproducible bug

Comments

@segfaultdoc
Copy link
Contributor

While using the Watch client to subscribe to new msgs I would notice that one of our threads would overflow its stack. This was specific to a bucket and wouldn’t happen with the other bucket Watches. After some digging I found this recursive call:
https://github.com/nats-io/nats.rs/blob/main/nats/src/jetstream/push_subscription.rs#L133

The reason why it happened with one of our buckets was due to the entry write/remove cadence, every few days as opposed to the other buckets being every few seconds. This means the call recurses on every heartbeat msg (5000ms) until it overflows its stack or an entry is modified/removed.

Although the function looks tail call optimized, rust does not guarantee TCO.

Next steps, we’ll fork and make a PR upstream that removes this recursive call.

@segfaultdoc segfaultdoc added the bug Confirmed reproducible bug label May 19, 2022
@Jarema
Copy link
Member

Jarema commented May 19, 2022

@segfaultdoc thanks for reporting that.

Did I understand correctly, that you want to contribute and fix this issue?

This was referenced May 19, 2022
@segfaultdoc
Copy link
Contributor Author

@segfaultdoc thanks for reporting that.

Did I understand correctly, that you want to contribute and fix this issue?

correct just created a PR into main: #448

@Jarema
Copy link
Member

Jarema commented May 21, 2022

fixed by #448

@Jarema Jarema closed this as completed May 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed reproducible bug
Projects
None yet
Development

No branches or pull requests

2 participants