Repository navigation
Don't retain a message that max_active_messages rejected - #164
Merged
Merged
Conversation
SetActiveMessage() retained the ActiveMessage for subscribers that keep their current message (reliable or keep_active_message) even when Set() had already cleared it because max_active_messages was reached. The retained reference left refs == 1 with length == 0. The next read then found the slot in HoldExistingMessage, saw length == 0, set rejected, and returned before ClearActiveMessage could drop that reference. The subscriber could not read again. Retain only a message that was actually taken (length > 0). ClientTest.RetainedSubscriberRecoversAfterMaxActiveMessages covers the reliable and keep_active_message cases: hold the first message, see the second read come back empty, release the first, then read the second. It fails on the old code and passes with this change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a subscriber keeps its current message (
reliableorkeep_active_message) andSetActiveMessage()is called while the subscriber is already atmax_active_messages,ActiveMessage::Set()clears the message (length == 0) butSetActiveMessage()still retained it and took a reference.That leaves
refs == 1withlength == 0. On the nextReadMessage(),HoldExistingMessage()finds the slot, seeslength == 0, setsrejected, and returns beforeClearActiveMessage()can drop the reference. The subscriber never reads again.Change
SubscriberImpl::SetActiveMessage()retains only a message that was actually taken (m->length > 0).ClientTest.RetainedSubscriberRecoversAfterMaxActiveMessages, which covers the reliable andkeep_active_messagecases: hold the first message, see the second read come back empty, release the first, then read the second.MODULE.bazelmicro version bumped to 3.4.3.Testing
subscriber.h(second->lengthis 0) and passes with the fix.bazelisk test //client:client_test --config=macos_arm64(withUSE_BAZEL_VERSION=9.3.2): full suite passes.Base branch is
main; there is nodevelopbranch on the remote.