Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to re-subscribe to chatroom channel after update #2128

Closed
taoeffect opened this issue Jun 27, 2024 · 0 comments
Closed

Failure to re-subscribe to chatroom channel after update #2128

taoeffect opened this issue Jun 27, 2024 · 0 comments
Assignees
Labels
App:Backend App:Frontend Kind:Bug Kind:Core Anything that changes or affects the fundamental core data structures & design of the application. Priority:High

Comments

@taoeffect
Copy link
Member

taoeffect commented Jun 27, 2024

Problem

After deploying v0.5.6 to the testing site, the tab I had open in Brave reloaded and refreshed, and showed that for some reason a whole bunch of pubsub channels couldn't be joined:

bug.compressed.mov

Screenshot 2024-06-27 at 12 14 30 PM

The channel I was in at the moment (#new-private) was one of those channels.

On my phone I logged in and posted messages to that channel:

tmp-1719515424058

You can see that the bug #2061 got triggered again too.

But these messages did not appear on desktop! Meaning it really had stopped receiving updates and was no longer subscribed!

So I refreshed the page then to see what would happen.

After refreshing the page, I saw that these pubsub errors were still going on:

Screenshot 2024-06-27 at 12 23 34 PM

So in the screenshot above, you can see that the #general chatroom has been not been subscribed to, and that posting a message to it leaves it as pending, per #2061.

In the screenshot below, you can see that this really is the #general chatroom, as it has the right users in it:

Screenshot 2024-06-27 at 12 27 23 PM

Posting another message reproduces the behavior of #2061 with the previous message shown as no longer pending:

Screenshot 2024-06-27 at 12 27 57 PM

Also, when debugging and running sync with force:true on the #general chatroom to fetch new messages, when they got fetched the chatroom didn't scroll to the bottom as it's supposed to.

sbp('chelonia/contract/sync', chatroomID, { force: true })

Solution

Fix this failure to subscribe problem, and #2061 as well. They might be the same issue, or related issues.

One issue is that on the server we aren't adding all known contractIDs to the pubsub channels.

The only place they're added is here:

  'backend/server/handleEntry': async function (deserializedHEAD: Object, entry: string) {
    const contractID = deserializedHEAD.contractID
    sbp('okTurtles.data/get', PUBSUB_INSTANCE).channels.add(contractID)

We need to add all contractIDs on boot to the pubsub channels.

@taoeffect taoeffect added Kind:Bug App:Frontend App:Backend Priority:High Kind:Core Anything that changes or affects the fundamental core data structures & design of the application. labels Jun 27, 2024
corrideat added a commit that referenced this issue Jun 28, 2024
corrideat added a commit that referenced this issue Jun 28, 2024
* Add check for OP_CONTRACT on handleEntry for efficiency
* Add existing contracts to channels on startup
corrideat added a commit that referenced this issue Jun 28, 2024
* Add check for OP_CONTRACT on handleEntry for efficiency
* Add existing contracts to channels on startup
corrideat added a commit that referenced this issue Jun 28, 2024
* Add check for OP_CONTRACT on handleEntry for efficiency
* Add existing contracts to channels on startup
* Better document contract partitions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App:Backend App:Frontend Kind:Bug Kind:Core Anything that changes or affects the fundamental core data structures & design of the application. Priority:High
Projects
None yet
Development

No branches or pull requests

2 participants