jnordstrom-iar opened a new pull request, #3878:
URL: https://github.com/apache/thrift/pull/3878

   <!-- Explain the changes in the pull request below: -->
   
   This another (old) patch we've had inhouse. The test is completely written 
by AI.
   
   On Windows there is no supported way to stop a pipe server while clients are 
still connected: `TPipeServer` does not implement `interruptChildren()`, and 
`TPipe` has neither an `interrupt()` nor a read timeout, so `TServer::stop()` 
cannot wake a worker blocked in `read()`. See: 
https://issues.apache.org/jira/browse/THRIFT-3590
   
   A workaround we've had is to track connected clients through 
`TServerEventHandler` and then `close()` their transports from the thread that 
stops the server. That is not safe on master. `close()` destroys the 
implementation object a concurrent `read()` is still using. This change guards 
the implementation pointer with a critical section and hands each caller its 
own reference, so the implementation stays alive for the duration of the call. 
`close()` now also detaches the implementation before releasing it and then 
cancels its outstanding I/O, so a reader waiting for data returns instead of 
waiting on an implementation that is already gone.
   
   `stress_pipe_close_during_use` dies inside the transport in 19 of 20 runs 
without the change and passes 20 of 20 with it (MSVC, RelWithDebInfo).
   
     
   
   <!-- We recommend you review the checklist/tips before submitting a pull 
request. -->
   
   - [ ] ~~Did you create an [Apache 
Jira](https://issues.apache.org/jira/projects/THRIFT/issues/) ticket?  
([Request account here](https://selfserve.apache.org/jira-account.html), not 
required for trivial changes)~~
   - [ ] ~~If a ticket exists: Does your pull request title follow the pattern 
"THRIFT-NNNN: describe my issue"?~~
   - [X] Did you squash your changes to a single commit?  (not required, but 
preferred)
   - [X] ~~Did you do your best to avoid breaking changes?  If one was needed, 
did you label the Jira ticket with "Breaking-Change"~~
   - [ ] ~~If your change does not involve any code, include `[skip ci]` 
anywhere in the commit message to free up build resources.~~
   
   <!--
     The Contributing Guide at:
     https://github.com/apache/thrift/blob/master/CONTRIBUTING.md
     has more details and tips for committing properly.
   -->
   


-- 
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