retry kicking in for rpc with heavy computations - how to avoid?

#1

Autobahn js.

I am publishing an RPC method that takes quite some time to compute on nodejs. When the client (browser) issues multiple calls to that RPC method, it is leading to connection lost:

connection::onClose: lost { reason: null,

message: null,

retry_delay: 1.5214524045564979,

retry_count: 1,

will_retry: true }

retrying in 1.5214524045564979 s

trying to create WAMP transport of type: websocket

I am trying to implement background workers to avoid this situation, but would like to understand first: what is making the Autobahn system “think” that the connection is lost?

Does it have some kind of heart-beat thing going on (on the same thread where the RPC method gets invoked)? Is there any configuration / setting, Autobahn can be instructed to use a low-priory secondary thread for such heart-beats?

0 Likes

#2

What’s happening in your case is your long running code is blocking the event loop and Crossbar can’t heartbeat and therefor the connection dies.

You will need to use background workers for the platform you are on, either async/await if on python 3.5, asyncio if on python 3, twisted library if on python 2.

As far as node JS is concerned, I have no idea how to create “background workers”, maybe try researching promises?

There is other documentation here on the group about your issue:

https://groups.google.com/forum/#!searchin/autobahnws/timeout/autobahnws/mjqzKuEYIso/oPiFNMhQAwAJ

-Dave

0 Likes

#3

Thanks Dave.

I have the Nodejs code done with workers fine, but the challenge is using it with the session.register()

Came across this https://github.com/crossbario/autobahn-js/issues/172 Will try to convert the return value to be a promise and see if it works.

···

On Tuesday, January 12, 2016 at 8:23:15 PM UTC+5:30, Dave Thomas wrote:

What’s happening in your case is your long running code is blocking the event loop and Crossbar can’t heartbeat and therefor the connection dies.

You will need to use background workers for the platform you are on, either async/await if on python 3.5, asyncio if on python 3, twisted library if on python 2.

As far as node JS is concerned, I have no idea how to create “background workers”, maybe try researching promises?

There is other documentation here on the group about your issue:

https://groups.google.com/forum/#!searchin/autobahnws/timeout/autobahnws/mjqzKuEYIso/oPiFNMhQAwAJ

-Dave

0 Likes