Donny9 opened a new pull request, #17741:
URL: https://github.com/apache/nuttx/pull/17741

   *Note: Please adhere to [Contributing 
Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
   
   ## Summary
   
   ### patch 1:
   When an epoll fd is closed, the file descriptors in the teardown and
   oneshot lists were not being properly dereferenced, leading to fd leaks.
   
   This fix ensures that all fds in the teardown and oneshot lists are
   properly released via file_put() during epoll_do_close(), matching the
   behavior for fds in the setup list.
   
   ### patch 2
   When a thread is terminated via pthread_exit() while blocked in epoll_wait(),
   the file reference taken at the beginning of epoll_wait() is not properly
   released, leading to resource leaks.
   
   ## Impact
   
   ### patch1
   - Prevents fd leaks when epoll fd is closed
   - Ensures proper cleanup of all tracked file descriptors
   - Critical for applications using EPOLLONESHOT or fd removal operations
   
   ### patch2
   - Prevents epoll fd reference count leaks on thread cancellation
   - Ensures proper cleanup even when epoll_wait() is interrupted by 
pthread_exit
   - Critical for multi-threaded applications using signals and thread 
termination
   - Works together with previous fix for teardown/oneshot list cleanup
   
   ## Testing
   
   uv_run_test tcp_ping_pong
   <img width="1212" height="1662" alt="image" 
src="https://github.com/user-attachments/assets/ca24ea6d-2f5c-4dae-ae72-b6d407700383";
 />
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to