Skip to content

Conversation

mudit-saxena
Copy link

@mudit-saxena mudit-saxena commented Oct 13, 2025

Description

Summary - Tests that the packet queue can grow during a slow/blocked shutdown process.

This test verifies a specific race condition scenario:

  1. A background thread continuously adds packets to the learner's queue
  2. Shutdown is initiated, which clears the queue and adds proposalOfDeath
  3. Shutdown then blocks on socket.close() (mocked to take 5 seconds)
  4. During the socket close wait, the background thread continues adding packets
  5. The queue grows even though shutdown has been initiated

This simulates real-world scenarios where:

  • Network I/O is slow during shutdown
  • The leader continues sending packets while learner is shutting down
  • The queue can unexpectedly grow during the shutdown process

Tests

The following tests are written for this issue:
(List the names of added unit/integration tests)
Added test

The following is the result of the "mvn test" command on the appropriate module:
(If CI test fails due to known issue, please specify the issue and test PR locally. Then copy & paste the result of "mvn test" to here.)

Changes that Break Backward Compatibility (Optional)

My PR contains changes that break backward compatibility or previous assumptions for certain methods or API. They include:
(Consider including all behavior changes for public methods or API. Also include these changes in merge description so that other developers are aware of these changes. This allows them to make relevant code changes in feature branches accounting for the new method/API behavior.)
NA

Documentation (Optional)

In case of new functionality, my PR adds documentation in the following wiki page:
(Link the GitHub wiki you added)
NA

@mudit-saxena mudit-saxena changed the title Mudit/learner handler test Added test for increase in LearnerHandler Queue despite shutdown invocation Oct 13, 2025
@mudit-saxena mudit-saxena force-pushed the mudit/learner_handler_test branch from 9c11e0e to a2e07c8 Compare October 14, 2025 10:52
adityaagg09
adityaagg09 previously approved these changes Oct 14, 2025
Copy link
Collaborator

@adityaagg09 adityaagg09 left a comment

Choose a reason for hiding this comment

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

LGTM,

We should also attach the jira ticket in the description

* 1. A background thread continuously adds packets to the learner's queue
 * 2. Shutdown is initiated, which clears the queue and adds proposalOfDeath
* 3. Shutdown then blocks on socket.close() (mocked to take 5 seconds)
 * 4. During the socket close wait, the background thread continues adding packets
* 5. The queue grows even though shutdown has been initiated
@mudit-saxena mudit-saxena force-pushed the mudit/learner_handler_test branch from a2e07c8 to 0d9ade3 Compare October 15, 2025 14:43
@mudit-saxena mudit-saxena changed the base branch from master to li-dev/base-3.8.4 October 17, 2025 05:42
@mudit-saxena mudit-saxena changed the base branch from li-dev/base-3.8.4 to master October 17, 2025 05:42
@mudit-saxena mudit-saxena dismissed adityaagg09’s stale review October 17, 2025 05:42

The base branch was changed.

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