dlmarion commented on PR #5375:
URL: https://github.com/apache/accumulo/pull/5375#issuecomment-2695138643

   Looking at the Thrift code for our default server type 
(CustomNonBlockingServer extends THsHaServer extends TNonblockingServer), I 
think our `oneway` RPC methods are not asynchronous.
   In 
[TNonblockingServer.SelectAcceptThread.select](https://github.com/apache/thrift/blob/0.17.0/lib/java/src/main/java/org/apache/thrift/server/TNonblockingServer.java#L166),
 
[handleAccept](https://github.com/apache/thrift/blob/0.17.0/lib/java/src/main/java/org/apache/thrift/server/TNonblockingServer.java#L213)
 is called which creates either a synchronous or asynchronous FrameBuffer. Then 
[handleRead](https://github.com/apache/thrift/blob/0.17.0/lib/java/src/main/java/org/apache/thrift/server/AbstractNonblockingServer.java#L185)
 is called which ends up calling 
[requestInvoke](https://github.com/apache/thrift/blob/0.17.0/lib/java/src/main/java/org/apache/thrift/server/TNonblockingServer.java#L102)
 which just calls `invoke` on the created FrameBuffer.
   
   The 
[createFrameBuffer](https://github.com/apache/thrift/blob/0.17.0/lib/java/src/main/java/org/apache/thrift/server/TNonblockingServer.java#L202)
 method that is called from `handleAccept` creates either a AsyncFrameBuffer or 
FrameBuffer depending on the whether or not the Processor is asynchronous (see 
https://github.com/apache/thrift/blob/0.17.0/lib/java/src/main/java/org/apache/thrift/TProcessorFactory.java#L37).
 We 
[wrap](https://github.com/apache/accumulo/blob/2.1/server/base/src/main/java/org/apache/accumulo/server/rpc/TServerUtils.java#L178)
 all of our Processors with the TimedProcessor class, which does not implement 
AsyncProcessor.
   
   You can see in 
[FrameBuffer.invoke](https://github.com/apache/thrift/blob/0.17.0/lib/java/src/main/java/org/apache/thrift/server/AbstractNonblockingServer.java#L493)
 that the RPC method is called, then the responseReady method. Conversely, in 
[AsyncFrameBuffer.invoke](https://github.com/apache/thrift/blob/0.17.0/lib/java/src/main/java/org/apache/thrift/server/AbstractNonblockingServer.java#L559)
 you can see that the Processor is cast to a TAsyncProcessor, then the 
`process` method is called. Looking at TBaseAsyncProcessor.process snippet 
below you can see that responseReady is called, then the method is invoked.
   
   
https://github.com/apache/thrift/blob/60655d2de79e973b89fab52af82f9628d4843b0f/lib/java/src/main/java/org/apache/thrift/TBaseAsyncProcessor.java#L96-L108
   
   I'm not sure what `oneway` with synchronous processing on the worker thread 
buys us. I don't see how it's any different than a method that returns `void`. 
I assume that this pattern is in use with the other Thrift server types. I 
think this is consistent with your observation about using multiple clients 
above, except that you may not have been aware that each client won't return 
until the method is done processing on the server side.


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