Skip to content

Conversation

@13627105546
Copy link
Contributor

@13627105546 13627105546 commented Jan 17, 2026

This assertion should be removed because the POLLIN event is now only raised when there is data pending to be received. Previously, POLLIN was incorrectly set as soon as the connection was established, even when no data was available, which was not consistent with the expected behavior.

Note: Please adhere to Contributing Guidelines.

Summary

usrsocktest: fix TEST_ASSERT_EQUAL fail for POLLIN

This PR removes a specific POLLIN assertion in usrsocktest to align with the kernel changes introduced in apache/nuttx#17877.

The kernel change prevents POLLIN from being set when a remote connection is closed (POLLHUP) unless there is actual data available to read (USRSOCK_EVENT_RECVFROM_AVAIL). This was done to fix an issue where usrsock would repeatedly report POLLIN in a loop, causing high CPU usage or system hangs under certain conditions (e.g., interface down during connection).

Since the kernel logic now conditionally filters POLLIN in this scenario, the test case expectation must be updated to reflect that POLLIN is no longer guaranteed to be set alongside POLLHUP when no data is buffered.

Impact

  • Users: Users running usrsocktest to verify user socket implementations.
  • Build: No impact on build configuration.
  • Compatibility: Updates test expectations to match the corrected kernel behavior where POLLIN is only set when data is actually available.

Testing

  • Verification: Verified that usrsocktest now passes with the updated kernel changes.
  • Target: Sim/QEMU with usrsock enabled.

This assertion should be removed because the POLLIN event is now only
raised when there is data pending to be received. Previously, POLLIN
was incorrectly set as soon as the connection was established, even
when no data was available, which was not consistent with the expected
behavior.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
@xiaoxiang781216
Copy link
Contributor

This assertion should be removed because the POLLIN event is now only raised when there is data pending to be received. Previously, POLLIN was incorrectly set as soon as the connection was established, even when no data was available, which was not consistent with the expected behavior.

but return POLLIN is right behaviour after the connection established even without data.

@13627105546
Copy link
Contributor Author

This assertion should be removed because the POLLIN event is now only raised when there is data pending to be received. Previously, POLLIN was incorrectly set as soon as the connection was established, even when no data was available, which was not consistent with the expected behavior.

but return POLLIN is right behaviour after the connection established even without data.

I have revised the inappropriate descriptions. Could you kindly review them again?

@Donny9 Donny9 merged commit a75fa37 into apache:master Jan 19, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants