OrleansContrib / SignalR.Orleans

SignalR backend based on Orleans.
MIT License
295 stars 64 forks source link

Messages are being dispatched multiple times #79

Closed stephenlautier closed 5 years ago

stephenlautier commented 5 years ago

Recently I noticed that some messages are being received multiple times on the client.

After debugging a little bit, I found out that it is actually being dispatched from the server multiple times

Messages being dispatched multiple times

image

Streams initializing multiple times

image

After some digging, I believe this commit introduced the issue https://github.com/OrleansContrib/SignalR.Orleans/commit/66ca0aa8395dd54e05f50ee93d076aa6ddc5fb61

What we can do is either call it again on the ctor, or else we can lock it? Just seen Redis implementation they do both

Redis signalr interest points

I think there's is good because it won't lock if its already initialized.

Another note, to be honest, it's not that easily reproducible, however, on our server it happens pretty much 100% - we have 2 clients (x2 pods) and 1 client (x2 pod) connecting 6 in total

galvesribeiro commented 5 years ago

Oh! That is critical.

The Lock async is the best option. Get Outlook for iOShttps://aka.ms/o0ukef


From: Stephen Lautier notifications@github.com Sent: Monday, June 10, 2019 8:49:41 AM To: OrleansContrib/SignalR.Orleans Cc: Subscribed Subject: [OrleansContrib/SignalR.Orleans] Messages are being dispatched multiple times (#79)

Recently I noticed that some messages are being received multiple times on the client.

After debugging a little bit, I found out that it is actually being dispatched from the server multiple times

Messages being dispatched multiple times

[image]https://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F3908723%2F59192394-8ed76180-8b82-11e9-9270-8f55aaf6fa15.png&data=02%7C01%7C%7Cdc36f4e5b103498a703508d6ed99ba1f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636957641835034365&sdata=pIWa1%2B%2BRMVOW%2Fx92O2iYHTLuNvm9e9vighlnJfeu15c%3D&reserved=0

Streams initializing multiple times

[image]https://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F3908723%2F59192853-1f627180-8b84-11e9-9402-b54b69e5d272.png&data=02%7C01%7C%7Cdc36f4e5b103498a703508d6ed99ba1f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636957641835044377&sdata=aHNwmk8QBcs6Ioo9bO15Pa%2F%2BBYNDoVLi2dchye%2BzNL0%3D&reserved=0

After some digging, I believe this commit introduced the issue 66ca0aahttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FOrleansContrib%2FSignalR.Orleans%2Fcommit%2F66ca0aa8395dd54e05f50ee93d076aa6ddc5fb61&data=02%7C01%7C%7Cdc36f4e5b103498a703508d6ed99ba1f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636957641835044377&sdata=S9I4LF73qSmPcD%2B9CxNxklQ3%2F5wNmMJxsTFRryhXWdg%3D&reserved=0

What we can do is either call it again on the ctor, or else we can lock it? Just seen Redis implementation they do both

Redis signalr interest points

I think there's is good because it won't lock if its already initialized.

Another note, to be honest, it's not that easily reproducible, however, on our server it happens pretty much 100% - we have 2 clients (x2 pods) and 1 client (x2 pod) connecting 6 in total

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FOrleansContrib%2FSignalR.Orleans%2Fissues%2F79%3Femail_source%3Dnotifications%26email_token%3DABD64OFNZWXHLBTN7CUVP5TPZY5VLA5CNFSM4HWS2DAKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GYRQGOA&data=02%7C01%7C%7Cdc36f4e5b103498a703508d6ed99ba1f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636957641835064393&sdata=%2F1bhdCNkdWdOro4Q3ua5LTHiJEOmO8GrnrjytawUEmo%3D&reserved=0, or mute the threadhttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABD64OFCSQVIXDF7SA3AC7LPZY5VLANCNFSM4HWS2DAA&data=02%7C01%7C%7Cdc36f4e5b103498a703508d6ed99ba1f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636957641835074401&sdata=PFvEqvKA7QNp8tRYZ9IlD6WFjNwHJ9ooxAzkZ44k6Tw%3D&reserved=0.

stephenlautier commented 5 years ago

Yes its quite critical, @galvesribeiro want me to open a PR for it?

galvesribeiro commented 5 years ago

If you could I would appreciate that. I’ll review/merge/release right after it.

From: Stephen Lautier notifications@github.com Reply-To: "OrleansContrib/SignalR.Orleans" reply@reply.github.com Date: Monday, 10 June 2019 08:56 To: "OrleansContrib/SignalR.Orleans" SignalR.Orleans@noreply.github.com Cc: Gutemberg Ribeiro gutemberg@outlook.com, Mention mention@noreply.github.com Subject: Re: [OrleansContrib/SignalR.Orleans] Messages are being dispatched multiple times (#79)

Yes its quite critical, @galvesribeirohttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgalvesribeiro&data=02%7C01%7C%7C1e89cc1ba23e4a1dfef308d6ed9ab18c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636957645986498026&sdata=N7CG07osd%2F99Mmy2mimMjn659GSDZslXuG83nAoEXkg%3D&reserved=0 want me to open a PR for it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FOrleansContrib%2FSignalR.Orleans%2Fissues%2F79%3Femail_source%3Dnotifications%26email_token%3DABD64OCPA7GFPBVXSRXZXUDPZY6PLA5CNFSM4HWS2DAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXJVU5A%23issuecomment-500390516&data=02%7C01%7C%7C1e89cc1ba23e4a1dfef308d6ed9ab18c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636957645986508037&sdata=ZLvJbIUm231XBDazmOmDD06G%2BsyvQinbVoLU3x5wYUw%3D&reserved=0, or mute the threadhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABD64OBBMNCS67Y2JMWS5JDPZY6PLANCNFSM4HWS2DAA&data=02%7C01%7C%7C1e89cc1ba23e4a1dfef308d6ed9ab18c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636957645986518048&sdata=QEIjYwyiR7ycymWPWZqzZ3KDl8gEo0tkLGfAlEBbTX8%3D&reserved=0.