mirror of https://github.com/grpc/grpc.git
Fix a race on vptr for UnimplementedAsyncRequest (#32547)
It is reported in https://github.com/grpc/grpc/issues/32356 that there is a race on vptr for `UnimplementedAsyncRequest` which would cause crashes for multi-threaded server if clients send unimplemented RPC request to the server. The cause is that the server requests a call for `UnimplementedAsyncRequest` in its base class `GenericAsyncRequest` when the `vptr` still points to the base class's `vtable`. If the call went in and another server thread picks up the tag before the `vptr` points back to the derived class's `vtable`, it would call the wrong virtual function and also this is a data race. This fix makes the request of the call inside the derived class's constructor. <!-- If you know who should review your pull request, please assign it to that person, otherwise the pull request would get assigned randomly. If your pull request is for a specific language, please add the appropriate lang label. -->pull/32605/head
parent
40ccf97217
commit
ac7faf75ba
3 changed files with 105 additions and 9 deletions
Loading…
Reference in new issue