-
Notifications
You must be signed in to change notification settings - Fork 36
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
fix(r2dbc): Leak of in-flight offsets #1300
Conversation
patriknw
commented
Jan 17, 2025
- concurrency issue in R2dbcOffsetStore when saving offsets in case of concurrent modifications
- map vs flatMap
- DynamoDB was correct
- added some more logging
* concurrency issue in R2dbcOffsetStore when saving offsets in case of concurrent modifications * map vs flatMap * DynamoDB was correct * added some more logging
@@ -630,15 +652,19 @@ private[projection] class R2dbcOffsetStore( | |||
|
|||
val offsetInserts = dao.insertTimestampOffsetInTx(conn, filteredRecords) | |||
|
|||
offsetInserts.map { _ => | |||
offsetInserts.flatMap { _ => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the bug. I think it was introduced in a recent version when the lazy loading of offsets was added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼 Not noticed in #1255
@@ -656,8 +682,9 @@ private[projection] class R2dbcOffsetStore( | |||
} | |||
if (newInflight.size >= 10000) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have also tested this in a real service where I logged the inFlight size and could see that it was increasing over time. After the fix it is 0 after each save offsets, as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -630,15 +652,19 @@ private[projection] class R2dbcOffsetStore( | |||
|
|||
val offsetInserts = dao.insertTimestampOffsetInTx(conn, filteredRecords) | |||
|
|||
offsetInserts.map { _ => | |||
offsetInserts.flatMap { _ => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼 Not noticed in #1255