Sometimes on disconnection the presence is not getting updated
vinkalathmin opened this issue · comments
We were facing a bug which happens sometimes for the following scenario
- User1 is connected and subscribed to channel ChannelA
- User2 is listening for presence of channelA
Now when User1 disconnects User2 is notified for subscribe/unsubscribe for this channel which works good, but sometimes when User1 disconnects, User2 doesn't get any updates.
Image above where we were testing with continuous connection and disconnection. See the highlighted part where 2 subscribe are present together which shows there is missing unsubscribe (This happens once in a while), but due to this a person who is currently offline is shown as online.
Above is one part of the bug.
Now taking the second scenario where we are just taking the presence status of this channel where the user is not connected/subscribed to channelA.
Following is the status we are receiving
{"time":1660644892,"event":"status","channel":"chat/aaaa1234-3914-485a-8e7e-61b0c4f5289d/db036a54-bc06-4b2d-8f74-f9d8d23d9c51__db036a54-bc06-4b2d-8f74-f9d8d23d9c51/","who":[{"id":"SKYZXRW5NPBQM3JLFADVFSR5HI"},{"id":"UTWL4TKO34SEEXPV3JRN7JGKJE"},{"id":"6YKKAO6CYZ2APXZ3CW7EIHVUEA"},{"id":"P2AEDYQJODZ4AGZ6AX3Q33W65U"},{"id":"XWDK7GONWQIWJU3JZSTTXTSJSA"},{"id":"443W6SWGU5NXDDARILCG2AJCXY"},{"id":"ZTPDSHKGHAVMYNJH6PQ63YMIQ4"},{"id":"M7FR37A6P6WECN4I5AEGRSVCI4"},{"id":"2F2AA4ACOCYKKEHS53TQDDSWJU"},{"id":"3V3OX7FJUD5K6P2336XUAA2LIY"},{"id":"AZJQGIV2R7DMFUBT2YRP3BJEWA"},{"id":"CRAI5DNWVTQD5C2QPU5KJEPSHM"},{"id":"2XYCIYIU2WTZR54KWHS4RI77P4"},{"id":"US7BZBQXD3YB5TIU2V4XDEJBDM"},{"id":"6IOOM42Z2TSTBXCEPVCJKODHRA"},{"id":"CINXQPABIWE7DCV4GJ6UC5SMOU"},{"id":"YDZNMX2Y5BUFI63SZZS2X2A5GQ"},{"id":"NFHKTZOKFLOIYN65CMGJXYCIVI"},{"id":"TUQH4IP33AO5LLPOIR2MTAACNE"},{"id":"N7ZAVQSD2WIWHSU4OIO5XZKZNA"},{"id":"VLK6CHWNCYYP4CFKFUJOJXJ7UA"},{"id":"G6UO35W7ZSYBGLBN56JKMPQK34"},{"id":"GX5S6EPYX5QDB6YXQ5X6UOYQR4"},{"id":"PDUBZ3JVI6ZJ67D4ESMCK75ZGY"},{"id":"2BOBBVRMATNTTJIO64VGDTMZGA"},{"id":"56IG6VPDU4QBAQ32F5ZHQAUSRE"},{"id":"VWQSGPYF3AU4E5WWFBU5PAZHHM"},{"id":"DK7RI7JFTJNDVIOG2M2VK7GDNE"},{"id":"ONBAYHKFXFPSCM44FYUP3FUGGE"},{"id":"PDLXZ4PRRMSDIONM23USONVKTU"},{"id":"BWLJAMZCTK4OZFHQ7GR43J6UBE"},{"id":"DA4TTXZCM4GBDPZA6N7AIDCACM"},{"id":"DAREAVUVBIXVGTLT3472PC4FAQ"},{"id":"V4X6XBTYMUP5BPYKUFC3RZYMRI"},{"id":"XW3MNXQ7TKHJ2PKQEQOWXFBRBY"},{"id":"7JZKTPCN4ASRI6UZ7ARRQZT2LU"}]}
Though this user(basically no user has subscribed to this channel) is not connected, still the above output shows that this is subscribed by these many connections which basically tells that this user is online, though he is not.
**Observation: By observing both the things we came to know that whenever the unsubscribe event is not received then that connection is also not removed from who list.
It looks like some race condition is causing this issue.**
Seem to have an issue with this too. Any word on this?
@aiithak I don't think @vinkalathmin cares anymore, but this seems to be an important issue, and it's unfortunate that the original report went unnoticed at the time.
I'm going to investigate and will keep you posted.
In the meantime, feel free to provide me with any information about your particular scenario that you think could help narrowing down the issue.
@aiithak Are you able to provide me with a minimal code that would reproduce the issue?
Also, some information like how many Emitter servers do you have in your cluster could be useful to me...
I maybe have a good and a less good news.
-
The good news is that I suspect the bug has actually been resolved on master for a while now, but you might be using an older tagged version of Emitter.
-
The less good news is that I've just realized the master branch is not actually usable for... quite a while now. You can only use Emitter as a single server, but the system initilizing peers in a cluster seems to be broken. I'm currently tracking down that bug, and it WILL be resolved.
Don't hesistate to confirm my suspicion by telling me which version you are using...
Ok, as the ´:latest´ version is now fixed, can you guys check that your issue is still present on that version?