Skip to content

Fix/sync listener bug and test improvements - #104

Merged
lubaihua33 merged 4 commits into
microsoft:masterfrom
lokeshmuthuraj:fix/sync-listener-bug-and-test-improvements
Apr 24, 2026
Merged

Fix/sync listener bug and test improvements#104
lubaihua33 merged 4 commits into
microsoft:masterfrom
lokeshmuthuraj:fix/sync-listener-bug-and-test-improvements

Conversation

@lokeshmuthuraj

@lokeshmuthuraj Lokesh Muthuraj (lokeshmuthuraj) commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR fixes a bug in the receiver sync socket code and improves test compatibility with modern pytest versions.

Changes

Bug Fixes

  1. Fixed incorrect variable check in receiver sync socket (endpointsync.c)

    • Issue: Line 309 was checking sync_listener == -1 but the variable sync_listener was initialized to 0 and never updated in the code.
    • Fix: Changed to check ss->listener == -1 (the actual listener socket)
    • Impact: This bug would cause the error check to always evaluate incorrectly, potentially causing the receiver to proceed with an invalid socket when the listen operation fails
  2. Changed epoll_wait timeout from infinite to 1 second (endpointsync.c)

    • Changed from -1 (infinite wait) to 1000 milliseconds
    • Reason: Allows the event loop to periodically check the exit condition when receiver_exit_after_done is enabled
    • Impact: If the ntttcp client's exit message is dropped or not received by server sync thread due to timing issues, it could be left hanging indefinitely without checking for exit criteria.
    • Issue fixed: Intermittent Issue: NTTTCP on server side does not exit after test completes #103

Test Improvements

  1. Updated pytest method names for compatibility (test/functional_test.py)

    • Changed setup()setup_method(self, method)
    • Changed teardown()teardown_method(self, method)
    • Ensures compatibility with modern pytest versions
  2. Fixed typos and improved test reliability

    • Fixed typo: cooldowmcooldown in test name
    • Fixed typo: defualt_threadsdefault_threads
    • Reduced test ports from 200 to 50 in test_mapping_option testcase since the test was getting hung. I faced the same issue and noticed there was already an issue for it: Ntttcp stalling with -P 200 #99
    • Removed duplicate -D flag in receiver command

Testing

  • Functional tests pass with pytest (no warnings)
  • Sender/receiver synchronization works correctly

Checklist

  • Code builds successfully
  • Tests pass
  • No new compiler warnings
  • Tested with different command parameters.

Before fix - got warnings for functional_test.py.

image

After fix - tests pass cleanly

image

@lokeshmuthuraj

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree company="Microsoft"

@lokeshmuthuraj

Copy link
Copy Markdown
Contributor Author

Simon Xiao (@simonxiaoss) Can you please review this PR? I'm unable to add reviewers to the PR.

@lokeshmuthuraj

Copy link
Copy Markdown
Contributor Author

Pratik Bedre (@pratikb2805) Can you review this PR?

@lokeshmuthuraj

Copy link
Copy Markdown
Contributor Author

lubaihua33 Can you please review this PR?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes receiver-side sync socket handling to avoid hanging after tests complete, and updates functional tests for newer pytest compatibility.

Changes:

  • Fix incorrect listener fd error check in receiver sync socket setup.
  • Change sync thread epoll_wait() to a periodic timeout to allow exit-condition polling.
  • Update pytest lifecycle hooks and fix minor test issues (typos, port count, duplicate flags).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/endpointsync.c Corrects sync listener error check and adjusts epoll wait behavior for receiver exit handling.
test/functional_test.py Updates pytest setup/teardown hook names and improves a few functional test cases for reliability/compatibility.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/endpointsync.c Outdated
Comment thread test/functional_test.py Outdated
Comment thread src/endpointsync.c
@lubaihua33

Copy link
Copy Markdown
Collaborator

lubaihua33 Can you please review this PR?

Yes, I have requested copilot to review.

@lubaihua33

Copy link
Copy Markdown
Collaborator

Lokesh Muthuraj (@lokeshmuthuraj) could you have a check the comments that copilot provided?

@lokeshmuthuraj

Copy link
Copy Markdown
Contributor Author

Lokesh Muthuraj (@lokeshmuthuraj) could you have a check the comments that copilot provided?

lubaihua33 Thanks. I have fixed the comments provided by Copilot.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/endpointsync.c
Comment thread test/functional_test.py
@lubaihua33

lubaihua33 commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator

Lokesh Muthuraj (@lokeshmuthuraj) Could you please have a check for the new review comments provided by copilot?

@lokeshmuthuraj

Copy link
Copy Markdown
Contributor Author

Sure, I will check the new review comments and get back. Thanks.

@lokeshmuthuraj

Copy link
Copy Markdown
Contributor Author

lubaihua33 I have created 2 new issues #107 and #108 for the comments provided by copilot. I will take them in a different PR.

Please check and review this PR. I have resolved outstanding comments. Thanks.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lubaihua33
lubaihua33 merged commit c29c695 into microsoft:master Apr 24, 2026
16 of 17 checks passed
Comment thread src/endpointsync.c
Comment thread src/endpointsync.c
Comment thread src/endpointsync.c Outdated
Comment thread src/endpointsync.c Outdated
Comment thread test/functional_test.py Outdated
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.

4 participants