arj03 / ssb-browser-demo

A secure scuttlebutt client interface running in the browser
Other
58 stars 11 forks source link

Loading messages is stuck #274

Closed KyleMaas closed 3 years ago

KyleMaas commented 3 years ago

My main account is in a weird state. For some reason, I can't seem to load messages. Neither Public nor Threads are showing data. They just get stuck with the loading indicator active and do not actually show any messages.

(This is on a revision of ssb-browser-demo from a few days ago - probably around Saturday. Don't know what all you've updated since then. But I doubt I'll be able to reproduce this, so I wanted to at least document it before changing anything.)

So far, what I've been able to figure out is that they are calling SSB.db.query(), but the callback in toCallback() is not actually called. The query() call is setting up a deferred task, sbot.db2migrate is undefined, so it immediately calls log.onDrain(cb). But that never gets passed back through to the toCallback() callback. Past that...I'm not well-versed enough in how db2 behaves internally that I have any idea what's going on.

Not sure how to debug this or even where to file this bug. But I did want to report it. I'm too busy right now to care too much that this tab is in a non-functioning state, so I can leave it like this for the next few days until we can figure out what's going on. But I'll need some direction on how to figure out where this is failing.

What should my next steps be?

arj03 commented 3 years ago

I just merged in some minor updates, replaced ssb-room-client for a smaller bundle. Shouldn't have anything to do with your issue.

It is good debugging you did. log.onDrain means that async-append-only-log for some reason still has data that is waiting to be written. I'm assuming this is still the case if you reload. Maybe it's full somehow. Like the browser is not allowing it write for some reason?

KyleMaas commented 3 years ago

So should my next step be to refresh the tab and see if it flushes the log, or is there more data I can collect to help you figure out why it got stuck?

Thinking if it's not possible to prevent it from getting stuck, it would at least be helpful if there was a way to detect this kind of condition and warn the user. As it is right now, nothing is logged, nothing happens. It just silently fails.

arj03 commented 3 years ago

Try the reload. It's pretty natural for people to do that if something is funny.

KyleMaas commented 3 years ago

Reloading unstuck it.

Is there any good way to detect/prevent that? Refreshing might be natural for a web page, but I can't say I like Windows-style "oh, it probably needs a reboot" thinking. It'd be better if we could figure out why it would do that.

Thinking maybe if we can't prevent that, it might be a good idea to put a timer on queries like that and if they take more than 10 seconds or so, warn the user that they might need to refresh? At least that way the user has some feedback for their actions.

KyleMaas commented 3 years ago

Stuck again.

KyleMaas commented 3 years ago

Refreshed and it unstuck.

KyleMaas commented 3 years ago

This one is stale enough at this point, and enough stuff has happened with replication, that I think I'm going to close this for now. If it happens again, it can be reopened or filed as a new issue.