orleans icon indicating copy to clipboard operation
orleans copied to clipboard

Observers don't recover after host restart

Open nidu opened this issue 9 years ago • 6 comments

Hello.

Orleans 1.3.1.

I have asp net MVC web app which subscribes to Orleans grain via observers. If i restart host - grain becomes accessible and methods can be invoked but observers are not notified anymore.

Should they recover automatically or should some configuration be done or is there some easy way to track grain availability to manually refresh subscriptions?

nidu avatar Apr 26 '17 11:04 nidu

seems like the subscription map in the observed grain didn't persist through host restart. If you just store the subscription map in memory, the map will be lost after observed grain deactivate.

I think you can persist subscription map through grain state using persistence, so that the subscription map can be preserved between observed grain activation and deactivation.

xiazen avatar Apr 27 '17 22:04 xiazen

If i restart host

Do you mean you restart silos?

If you restart the whole cluster, then the registration of client observers will be lost. Unlike grains, client observers aren't virtual, and cannot be automatically reactivated after a restart.

sergeybykov avatar May 01 '17 15:05 sergeybykov

Yes, restart host. What would you recommend them? I'd like observers to just keep on working after silo restart. Should I switch to streams or track silo availability somehow and resub?

On 1 May 2017 18:10, "Sergey Bykov" [email protected] wrote:

If i restart host

Do you mean you restart silos?

If you restart the whole cluster, then the registration of client observers will be lost. Unlike grains, client observers aren't virtual, and cannot be automatically reactivated after a restart.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dotnet/orleans/issues/2977#issuecomment-298351002, or mute the thread https://github.com/notifications/unsubscribe-auth/AAagySgUOWwpSQpm9v1nd8vL8HulK9fNks5r1fXdgaJpZM4NIv0G .

nidu avatar May 01 '17 16:05 nidu

The general recommendation is for client to periodically, e.g. once a minute, to re-subscribe, and for producers (grains) to detect and drop observers that haven't re-subscribed for a long enough period of time, e.g. 5 minutes.

The fundamental challenge here is that silos/grains can never be sure if a client/observer disappeared temporarily or for good. We don't want them to indefinitely try to send messages to clients that will never come back. Streams also give up on unresponsive client subscribers after a while.

sergeybykov avatar May 01 '17 16:05 sergeybykov

Then if I wanna be sure each event is delivered observers is not an option?

Is there an easy way to detect dropped observers and grains? Or can it be done automatically?

On 1 May 2017 19:43, "Sergey Bykov" [email protected] wrote:

The general recommendation is for client to periodically, e.g. once a minute, to re-subscribe, and for producers (grains) to detect and drop observers that haven't re-subscribed for a long enough period of time, e.g. 5 minutes.

The fundamental challenge here is that silos/grains can never be sure if a client/observer disappeared temporarily or for good. We don't want them to indefinitely try to send messages to clients that will never come back. Streams also give up on unresponsive client subscribers after a while.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dotnet/orleans/issues/2977#issuecomment-298370613, or mute the thread https://github.com/notifications/unsubscribe-auth/AAagySr_NtglONZych6eVqio0ajiPRaAks5r1gu4gaJpZM4NIv0G .

nidu avatar May 01 '17 16:05 nidu

Then if I wanna be sure each event is delivered observers is not an option?

Correct. Observers are a best effort mechanism. To ensure delivery, a higher level protocol is needed.

Is there an easy way to detect dropped observers and grains? Or can it be done automatically?

Grains are eternal. They are never dropped, as they get automatically reactivated upon a new message to them. With streams, there's a configurable corner case where we give up on a 'poison' message after a few unsuccessful attempts to deliver it. But there is a notification interface for that.

Observers are inherently unreliable (because they are usually on web frontends that can reboot), and a higher level protocol, e.g. with periodic re-subscriptions like I mentioned above, is needed to detect their disappearance.

sergeybykov avatar May 01 '17 18:05 sergeybykov