Rationale for making ParrotServerService.shutdown() async

27 views
Skip to first unread message

Michael Diamant

unread,
Jun 26, 2013, 9:36:07 AM6/26/13
to iago-...@googlegroups.com
In my RecordProcessor implementation, I override shutdown() to capture stats from local Ostrich webserver.  I discovered that at times, seemingly haphazardly, statistics were not captured.  I traced the root cause of the issue to be the 'oneway' modifier on the ParrotServerService.shutdown() definition.  I understand the 'oneway' Thrift modifier causes an RPC call to be async.  For my use case, I believe the parrot-server is shutdown before the stats logic can be captured because the invoker of shutdown() does not await a response.

I changed the Thrift definition from:  
oneway void shutdown()
to:
void shutdown()

This makes shutdown() invocations synchronous and addresses my problem (i.e. stats are captured via shutdown hook).  This change results in a parrot-feeder exception at shutdown.  It appears the exception is harmless and I haven't had time to investigate further.  Here is the exception:
ERR [20130626-13:18:12.682] util: Error shutting down Parrot: com.twitter.finagle.ChannelClosedException
ERR [20130626-13:18:12.682] util: com.twitter.finagle.ChannelClosedException: ChannelException at remote address: localhost/127.0.0.1:9999
ERR [20130626-13:18:12.682] util:     at com.twitter.finagle.NoStacktrace(Unknown Source) 

What was the rationale behind marking shutdown() 'oneway'?  The justification that comes to mind is to ensure nothing blocks during shutdown (i.e. parrot-server shutdown() is not intended to be long-running).  If that's the case, is there a better way to instrument capturing stats at shutdown?

If making the shutdown() call synchronous is the way to go, I can clean up the exception I show above and send a pull request.  I appreciate the team's responsiveness. 

Michael

James Waldrop

unread,
Jun 26, 2013, 10:34:06 AM6/26/13
to iago-...@googlegroups.com, iago-...@googlegroups.com
We (I) shouldn't have used oneway. It's an artifact of my newness to Thrift. That said we (Tom) have some changes coming Real Soon Now that should be integrated. It improves shutdown behavior a lot. 


--
 
---
You received this message because you are subscribed to the Google Groups "Iago Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iago-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Michael Diamant

unread,
Jun 26, 2013, 10:41:26 AM6/26/13
to iago-...@googlegroups.com
Sounds good.  I'll use my fork until the changes are released.  Thank you for the quick reply.
Reply all
Reply to author
Forward
0 new messages