# RpcProxy Timeout

**URL:** <https://discourse.nameko.io/t/rpcproxy-timeout/120>\
**Category:** googlegroup\
**Created:** [February 11, 2016, 2:41pm UTC](https://discourse.nameko.io/t/rpcproxy-timeout/120 "2016-02-11T14:41:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Conor\_Seabrook](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.nameko.io/conor_seabrook/32/85_2.png) [@Conor\_Seabrook](https://discourse.nameko.io/u/Conor_Seabrook)\
**Post date:** [February 11, 2016, 2:41pm UTC](https://discourse.nameko.io/t/rpcproxy-timeout/120/1 "2016-02-11T14:41:50Z")

</div>

Hello,

Is there a way to set a timeout on a RpcProxy call? I'd like to send a  
sentry error if a timeout happens, as well as cancel the request so it is  
not processed when the service comes back online.

Regards,  
Conor

---

<div class="post-metadata">

**Author:** ![David\_Szotten](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.nameko.io/david_szotten/32/6_2.png) [@David\_Szotten](https://discourse.nameko.io/u/David_Szotten)\
**Post date:** [February 11, 2016, 3:19pm UTC](https://discourse.nameko.io/t/rpcproxy-timeout/120/2 "2016-02-11T15:19:34Z")

</div>

Hi Conor,

There's no timeout built in to the proxy, but you can always use  
[eventlet.timeout] [1]

Due to the way rpc calls are implemented with messages are implemented,  
there's no way to "cancel" a call. One option is to add a "ttl" header,  
after which the messages can be discarded when picked up, before  
processing. There is also a rabbitmq ttl extension that might be an option.  
However, neither are currently implemented in nameko

Best,  
David

[1] [timeout – Universal Timeouts — Eventlet 0.33.0 documentation](http://eventlet.net/doc/modules/timeout.html)

> **···**
>
> On Thursday, 11 February 2016 14:41:50 UTC, conor.s...@gmail.com wrote:
> 
> > Hello,
> > 
> > Is there a way to set a timeout on a RpcProxy call? I'd like to send a  
> > sentry error if a timeout happens, as well as cancel the request so it is  
> > not processed when the service comes back online.
> > 
> > Regards,  
> > Conor

---

<div class="post-metadata">

**Author:** ![Conor\_Seabrook](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.nameko.io/conor_seabrook/32/85_2.png) [@Conor\_Seabrook](https://discourse.nameko.io/u/Conor_Seabrook)\
**Post date:** [February 11, 2016, 4:05pm UTC](https://discourse.nameko.io/t/rpcproxy-timeout/120/3 "2016-02-11T16:05:46Z")

</div>

Thanks for the info David!

> **···**
>
> On Thursday, February 11, 2016 at 10:19:35 AM UTC-5, David Szotten wrote:
> 
> > Hi Conor,
> > 
> > There's no timeout built in to the proxy, but you can always use  
> > [eventlet.timeout] [1]
> > 
> > Due to the way rpc calls are implemented with messages are implemented,  
> > there's no way to "cancel" a call. One option is to add a "ttl" header,  
> > after which the messages can be discarded when picked up, before  
> > processing. There is also a rabbitmq ttl extension that might be an option.  
> > However, neither are currently implemented in nameko
> > 
> > Best,  
> > David
> > 
> > [1] [timeout – Universal Timeouts — Eventlet 0.33.0 documentation](http://eventlet.net/doc/modules/timeout.html)
> > 
> > On Thursday, 11 February 2016 14:41:50 UTC, conor.s...@gmail.com wrote:
> > 
> > > Hello,
> > > 
> > > Is there a way to set a timeout on a RpcProxy call? I'd like to send a  
> > > sentry error if a timeout happens, as well as cancel the request so it is  
> > > not processed when the service comes back online.
> > > 
> > > Regards,  
> > > Conor

---

<div class="post-metadata">

**Author:** ![Jesse\_Pollak](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@Jesse\_Pollak](https://discourse.nameko.io/u/Jesse_Pollak)\
**Post date:** [September 14, 2016, 5:58pm UTC](https://discourse.nameko.io/t/rpcproxy-timeout/120/4 "2016-09-14T17:58:18Z")

</div>

I wanted to follow up on this thread. Conor, did you find a reliable way to  
do timeouts with RpcProxy calls?

How do other people handle issues where services go offline and then  
RpcProxy calls to them just hang?

> **···**
>
> On Thursday, February 11, 2016 at 8:05:46 AM UTC-8, Conor Seabrook wrote:
> 
> > Thanks for the info David!
> > 
> > On Thursday, February 11, 2016 at 10:19:35 AM UTC-5, David Szotten wrote:
> > 
> > > Hi Conor,
> > > 
> > > There's no timeout built in to the proxy, but you can always use  
> > > [eventlet.timeout] [1]
> > > 
> > > Due to the way rpc calls are implemented with messages are implemented,  
> > > there's no way to "cancel" a call. One option is to add a "ttl" header,  
> > > after which the messages can be discarded when picked up, before  
> > > processing. There is also a rabbitmq ttl extension that might be an option.  
> > > However, neither are currently implemented in nameko
> > > 
> > > Best,  
> > > David
> > > 
> > > [1] [timeout – Universal Timeouts — Eventlet 0.33.0 documentation](http://eventlet.net/doc/modules/timeout.html)
> > > 
> > > On Thursday, 11 February 2016 14:41:50 UTC, conor.s...@gmail.com wrote:
> > > 
> > > > Hello,
> > > > 
> > > > Is there a way to set a timeout on a RpcProxy call? I'd like to send a  
> > > > sentry error if a timeout happens, as well as cancel the request so it is  
> > > > not processed when the service comes back online.
> > > > 
> > > > Regards,  
> > > > Conor

---

<div class="post-metadata">

**Author:** ![Jesse\_Pollak](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@Jesse\_Pollak](https://discourse.nameko.io/u/Jesse_Pollak)\
**Post date:** [September 15, 2016, 1:07am UTC](https://discourse.nameko.io/t/rpcproxy-timeout/120/5 "2016-09-15T01:07:56Z")

</div>

Just to explore the possibility of this, I opened up a PR on nameko here  
\<[Add support for timeouts in ServiceProxy by jessepollak · Pull Request #360 · nameko/nameko · GitHub](https://github.com/onefinestay/nameko/pull/360/files&gt); that adds timeouts  
to RpcProxy using eventlet.timeout and the x-message-ttl header. Would love  
any and all feedback!

> **···**
>
> On Wednesday, September 14, 2016 at 10:58:19 AM UTC-7, Jesse Pollak wrote:
> 
> > I wanted to follow up on this thread. Conor, did you find a reliable way  
> > to do timeouts with RpcProxy calls?
> > 
> > How do other people handle issues where services go offline and then  
> > RpcProxy calls to them just hang?
> > 
> > On Thursday, February 11, 2016 at 8:05:46 AM UTC-8, Conor Seabrook wrote:
> > 
> > > Thanks for the info David!
> > > 
> > > On Thursday, February 11, 2016 at 10:19:35 AM UTC-5, David Szotten wrote:
> > > 
> > > > Hi Conor,
> > > > 
> > > > There's no timeout built in to the proxy, but you can always use  
> > > > [eventlet.timeout] [1]
> > > > 
> > > > Due to the way rpc calls are implemented with messages are implemented,  
> > > > there's no way to "cancel" a call. One option is to add a "ttl" header,  
> > > > after which the messages can be discarded when picked up, before  
> > > > processing. There is also a rabbitmq ttl extension that might be an option.  
> > > > However, neither are currently implemented in nameko
> > > > 
> > > > Best,  
> > > > David
> > > > 
> > > > [1] [timeout – Universal Timeouts — Eventlet 0.33.0 documentation](http://eventlet.net/doc/modules/timeout.html)
> > > > 
> > > > On Thursday, 11 February 2016 14:41:50 UTC, conor.s...@gmail.com wrote:
> > > > 
> > > > > Hello,
> > > > > 
> > > > > Is there a way to set a timeout on a RpcProxy call? I'd like to send a  
> > > > > sentry error if a timeout happens, as well as cancel the request so it is  
> > > > > not processed when the service comes back online.
> > > > > 
> > > > > Regards,  
> > > > > Conor

---

<div class="post-metadata">

**Author:** ![Conor\_Seabrook](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.nameko.io/conor_seabrook/32/85_2.png) [@Conor\_Seabrook](https://discourse.nameko.io/u/Conor_Seabrook)\
**Post date:** [September 28, 2016, 1:45pm UTC](https://discourse.nameko.io/t/rpcproxy-timeout/120/6 "2016-09-28T13:45:41Z")

</div>

We ended up creating a monitoring dependency which keeps an eye on worker  
execution times. Not a timeout, but this way we are notified when rpc calls  
are hanging.

> **···**
>
> On Wednesday, September 14, 2016 at 1:58:19 PM UTC-4, Jesse Pollak wrote:
> 
> > I wanted to follow up on this thread. Conor, did you find a reliable way  
> > to do timeouts with RpcProxy calls?
> > 
> > How do other people handle issues where services go offline and then  
> > RpcProxy calls to them just hang?
> > 
> > On Thursday, February 11, 2016 at 8:05:46 AM UTC-8, Conor Seabrook wrote:
> > 
> > > Thanks for the info David!
> > > 
> > > On Thursday, February 11, 2016 at 10:19:35 AM UTC-5, David Szotten wrote:
> > > 
> > > > Hi Conor,
> > > > 
> > > > There's no timeout built in to the proxy, but you can always use  
> > > > [eventlet.timeout] [1]
> > > > 
> > > > Due to the way rpc calls are implemented with messages are implemented,  
> > > > there's no way to "cancel" a call. One option is to add a "ttl" header,  
> > > > after which the messages can be discarded when picked up, before  
> > > > processing. There is also a rabbitmq ttl extension that might be an option.  
> > > > However, neither are currently implemented in nameko
> > > > 
> > > > Best,  
> > > > David
> > > > 
> > > > [1] [timeout – Universal Timeouts — Eventlet 0.33.0 documentation](http://eventlet.net/doc/modules/timeout.html)
> > > > 
> > > > On Thursday, 11 February 2016 14:41:50 UTC, conor.s...@gmail.com wrote:
> > > > 
> > > > > Hello,
> > > > > 
> > > > > Is there a way to set a timeout on a RpcProxy call? I'd like to send a  
> > > > > sentry error if a timeout happens, as well as cancel the request so it is  
> > > > > not processed when the service comes back online.
> > > > > 
> > > > > Regards,  
> > > > > Conor
