arj03 / ssb-browser-demo

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

Replication errors #20

Closed KyleMaas closed 3 years ago

KyleMaas commented 3 years ago

I'm getting the following error logged to the console quite frequently:

{ message: "unexpected end of parent stream" name: "Error" stack: "Error: unexpected end of parent stream at PacketStream.destroy (/home/node/ssb-room/node_modules/packet-stream/index.js:71:7) at Object.ws.close (/home/node/ssb-room/node_modules/muxrpc/stream.js:127:23) at EventEmitter.emitter.close (/home/node/ssb-room/node_modules/muxrpc/index.js:77:8) at disconnect (/home/node/ssb-room/node_modules/ssb-conn-hub/lib/index.js:141:57) at /home/node/ssb-room/node_modules/promisify-tuple/index.js:4:13 at new Promise (<anonymous>) at /home/node/ssb-room/node_modules/promisify-tuple/index.js:3:5 at ConnHub.<anonymous> (/home/node/ssb-room/node_modules/ssb-conn-hub/lib/index.js:306:56) at step (/home/node/ssb-room/node_modules/ssb-conn-hub/lib/index.js:44:23) at Object.next (/home/node/ssb-room/node_modules/ssb-conn-hub/lib/index.js:25:53)" }

This seems to happen in the general vicinity of "finished ebt replicate" messages. I'm also getting the following exceptions sometimes:

bundle-core.js:1578 Exception thrown by PacketStream substream end handler Error: unexpected end of parent stream at PacketStream.destroy (bundle-core.js:1578) at PacketStream.write (bundle-core.js:1578) at bundle-core.js:1526 at bundle-core.js:1922 at bundle-core.js:1815 at bundle-core.js:1574 at e (bundle-core.js:1815) at bundle-core.js:1815 at Object.cb (bundle-core.js:1574) at o (bundle-core.js:1902) Error: unexpected end of parent stream at PacketStream.destroy (bundle-core.js:1578) at PacketStream.write (bundle-core.js:1578) at bundle-core.js:1526 at bundle-core.js:1922 at bundle-core.js:1815 at bundle-core.js:1574 at e (bundle-core.js:1815) at bundle-core.js:1815 at Object.cb (bundle-core.js:1574) at o (bundle-core.js:1902)`

arj03 commented 3 years ago

That is against the room server, right? The default one I mean. I started up the pub again, it was down because I was tested the go server :-)

The error doesn't really anything except that the other end is unstable.

KyleMaas commented 3 years ago

It was actually against the default pub, I believe. But during the process of debugging this, I also tried connecting to Hermies along with some "Possible Connections", so at this point I'm not sure which is which.

This has resulted in another problem: not all of the connections being attempted are showing up under Connections. They only show up intermittently. When they do show up, clicking Disconnect removed them from the Connections list, but then they come right back again a few seconds later. So I can't even clean up my connections to isolate just one server.

KyleMaas commented 3 years ago

Sorry, no, you're right. I had originally tested against the default room, not the pub. The pub didn't work, either.

KyleMaas commented 3 years ago

Cleared all data for localhost from my browser, loaded the key from mnemonic code, and tried connecting to the default room again. I am no longer getting the errors and the Connections screen has stabilized.

Not a fun failure mode to get stuck in, but I seem to be out of it now. Would be nice if the core of that issue could be traced down, but I do not yet have the familiarity with the codebase to do so effectively.

arj03 commented 3 years ago

That's odd. But glad it is working now. Let me know if it happens again.

KyleMaas commented 3 years ago

I'm still getting these:

bundle-core.js:1578 Exception thrown by PacketStream substream end handler Error: unexpected end of parent stream at PacketStream.destroy (bundle-core.js:1578) at PacketStream.write (bundle-core.js:1578) at source (bundle-core.js:1526) at bundle-core.js:1749 at bundle-core.js:2006 at bundle-core.js:1988 at f (bundle-core.js:1705) at Function.i.abort (bundle-core.js:1705) at b (bundle-core.js:1851) at bundle-core.js:1851 PacketStreamSubstream.destroy @ bundle-core.js:1578 PacketStream.destroy @ bundle-core.js:1578 PacketStream.write @ bundle-core.js:1578 source @ bundle-core.js:1526 (anonymous) @ bundle-core.js:1749 (anonymous) @ bundle-core.js:2006 (anonymous) @ bundle-core.js:1988 f @ bundle-core.js:1705 i.abort @ bundle-core.js:1705 b @ bundle-core.js:1851 (anonymous) @ bundle-core.js:1851 setInterval (async) module.exports @ bundle-core.js:1851 p @ bundle-core.js:2220 (anonymous) @ bundle-core.js:2220 r @ bundle-core.js:1490 (anonymous) @ bundle-core.js:1490 u @ bundle-core.js:1503 (anonymous) @ bundle-core.js:2202 (anonymous) @ bundle-core.js:2202 o @ bundle-core.js:1902 h @ bundle-core.js:1902 (anonymous) @ bundle-core.js:1902 (anonymous) @ bundle-core.js:1902 (anonymous) @ bundle-core.js:1979 (anonymous) @ bundle-core.js:2035 bundle-core.js:1578 Error: unexpected end of parent stream at PacketStream.destroy (bundle-core.js:1578) at PacketStream.write (bundle-core.js:1578) at source (bundle-core.js:1526) at bundle-core.js:1749 at bundle-core.js:2006 at bundle-core.js:1988 at f (bundle-core.js:1705) at Function.i.abort (bundle-core.js:1705) at b (bundle-core.js:1851) at bundle-core.js:1851

KyleMaas commented 3 years ago

Hm. Let's try that again:

bundle-core.js:1578 Exception thrown by PacketStream substream end handler Error: unexpected end of parent stream
    at PacketStream.destroy (bundle-core.js:1578)
    at PacketStream.write (bundle-core.js:1578)
    at source (bundle-core.js:1526)
    at bundle-core.js:1749
    at bundle-core.js:2006
    at bundle-core.js:1988
    at f (bundle-core.js:1705)
    at Function.i.abort (bundle-core.js:1705)
    at b (bundle-core.js:1851)
    at bundle-core.js:1851
PacketStreamSubstream.destroy @ bundle-core.js:1578
PacketStream.destroy @ bundle-core.js:1578
PacketStream.write @ bundle-core.js:1578
source @ bundle-core.js:1526
(anonymous) @ bundle-core.js:1749
(anonymous) @ bundle-core.js:2006
(anonymous) @ bundle-core.js:1988
f @ bundle-core.js:1705
i.abort @ bundle-core.js:1705
b @ bundle-core.js:1851
(anonymous) @ bundle-core.js:1851
setInterval (async)
module.exports @ bundle-core.js:1851
p @ bundle-core.js:2220
(anonymous) @ bundle-core.js:2220
r @ bundle-core.js:1490
(anonymous) @ bundle-core.js:1490
u @ bundle-core.js:1503
(anonymous) @ bundle-core.js:2202
(anonymous) @ bundle-core.js:2202
o @ bundle-core.js:1902
h @ bundle-core.js:1902
(anonymous) @ bundle-core.js:1902
(anonymous) @ bundle-core.js:1902
(anonymous) @ bundle-core.js:1979
(anonymous) @ bundle-core.js:2035
bundle-core.js:1578 Error: unexpected end of parent stream
    at PacketStream.destroy (bundle-core.js:1578)
    at PacketStream.write (bundle-core.js:1578)
    at source (bundle-core.js:1526)
    at bundle-core.js:1749
    at bundle-core.js:2006
    at bundle-core.js:1988
    at f (bundle-core.js:1705)
    at Function.i.abort (bundle-core.js:1705)
    at b (bundle-core.js:1851)
    at bundle-core.js:1851
arj03 commented 3 years ago

You can see if its against pub in that it should have id something like lboc..

Again these error should be rather harmless. It can happen if the connection is interrupted, the connection scheduler should try the connection again relately soon afterwards. The app doesn't totally break when this happens, right?

KyleMaas commented 3 years ago

To be honest, I have yet to get it to actually sync anything usable yet, regardless of what I connect to. I've tried your pub and the Hermies one. I've tried your room connection. I've been working on DHT connections. None of them have worked. I've been working on developing as if it did work, but I haven't gotten it to actually show anything yet.

arj03 commented 3 years ago

This is really odd. Are you on a good connection otherwise? I'm not sure if the hermies room support websocket. The room hardcoded in the app for sure does. I was going to ask for your SSB id, but I guess you don't really have one yet that is reachable? ;-)

KyleMaas commented 3 years ago

Excellent connectivity otherwise. And, no, it doesn't work with the built-in room for me. Would the fact that I've got both IPv6 and IPv4 connectivity be making a difference? Maybe the built-in room doesn't work over IPv6?

KyleMaas commented 3 years ago

Just tried it in Firefox to see if it would run any different there. When connecting to the default room, I get the console message:

connected to: @7R5/crt8/icLJNpGwP2D7Oqz2WUd7ObCIinFKVR6kNY=.ed25519

And then nothing. If I look at the Network traffic log, I can see a GET request to wss://between-two-worlds.dk:9999/ which received these headers:

HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: PKkUTeZ8dxyh54XChfab8U/ckgU=

...and then nothing after that.

KyleMaas commented 3 years ago

If I run it in Chromium instead, in the logs I get a seemingly-endless series of:

connected to: @7R5/crt8/icLJNpGwP2D7Oqz2WUd7ObCIinFKVR6kNY=.ed25519
bundle-core.js:1578 Exception thrown by PacketStream substream end handler Error: unexpected end of parent stream
    at PacketStream.destroy (bundle-core.js:1578)
    at PacketStream.write (bundle-core.js:1578)
    at bundle-core.js:1526
    at bundle-core.js:1922
    at bundle-core.js:1815
    at bundle-core.js:1574
    at e (bundle-core.js:1815)
    at bundle-core.js:1815
    at Object.cb (bundle-core.js:1574)
    at o (bundle-core.js:1902)
PacketStreamSubstream.destroy @ bundle-core.js:1578
PacketStream.destroy @ bundle-core.js:1578
PacketStream.write @ bundle-core.js:1578
(anonymous) @ bundle-core.js:1526
(anonymous) @ bundle-core.js:1922
(anonymous) @ bundle-core.js:1815
(anonymous) @ bundle-core.js:1574
e @ bundle-core.js:1815
(anonymous) @ bundle-core.js:1815
(anonymous) @ bundle-core.js:1574
o @ bundle-core.js:1902
h @ bundle-core.js:1902
(anonymous) @ bundle-core.js:1902
(anonymous) @ bundle-core.js:1705
(anonymous) @ bundle-core.js:1988
(anonymous) @ bundle-core.js:1715
o @ bundle-core.js:1902
h @ bundle-core.js:1902
(anonymous) @ bundle-core.js:1902
(anonymous) @ bundle-core.js:1902
(anonymous) @ bundle-core.js:1979
(anonymous) @ bundle-core.js:2035
bundle-core.js:1578 Error: unexpected end of parent stream
    at PacketStream.destroy (bundle-core.js:1578)
    at PacketStream.write (bundle-core.js:1578)
    at bundle-core.js:1526
    at bundle-core.js:1922
    at bundle-core.js:1815
    at bundle-core.js:1574
    at e (bundle-core.js:1815)
    at bundle-core.js:1815
    at Object.cb (bundle-core.js:1574)
    at o (bundle-core.js:1902)
arj03 commented 3 years ago

The firefox actually looks good. Seems like you are connected to the rooms server. Can you try connecting to the pub from that? The error might be in chromium for some reason.

KyleMaas commented 3 years ago

If you want to look through the logs on the server end, the Chromium version I have open right now has the ID "@IHNoInKURnj3lgRxXsGxmLc2qvbRfrJLmE2ze8w2KXw=.ed25519". I've been changing these out periodically as I do a full clear of all local storage just to make sure I'm starting from a clean slate, but that's what I've currently got.

KyleMaas commented 3 years ago

Connecting to the pub I get:

connected to: @lbocEWqF2Fg6WMYLgmfYvqJlMfL7hiqVAV6ANjHWNw8=.ed25519
bundle-core.js:25 syncing with @lbocEWqF2Fg6WMYLgmfYvqJlMfL7hiqVAV6ANjHWNw8=.ed25519
bundle-core.js:11 syncing feeds
bundle-core.js:11 full feeds: 266.145751953125 ms
bundle-core.js:11 partial feeds: 41.7978515625 ms
bundle-core.js:5 doing ebt with @lbocEWqF2Fg6WMYLgmfYvqJlMfL7hiqVAV6ANjHWNw8=.ed25519

...before it goes right back to the "unexpected end of parent stream" errors. But I think those are coming from it still trying to connect to @7R5/crt8/icLJNpGwP2D7Oqz2WUd7ObCIinFKVR6kNY=.ed25519.

arj03 commented 3 years ago

Yes. I think its because the rooms server is unstable. The @lboc looks good.

arj03 commented 3 years ago

I'm actually seeing the same errors now. You can see in the connections screen that its because the rooms sends out a bunch of ids and then crashes. The lboc connection is stable.

KyleMaas commented 3 years ago

Okay. Since the @7R5/ is unstable and has retries, I can't disconnect it (see #24), so I think I'm going to do a full data clear and try it with just @lboc.

arj03 commented 3 years ago

Exactly

KyleMaas commented 3 years ago

Okay, so after starting a new profile, linking up with the pub, adding two Public messages to test out the Unicode branch I was working on, and then refreshing, I now get this:

blobs dir: /.ssb-lite/blobs
bundle-core.js:8 my id:  @g32UmBIVcr7T1iH8nw5Z8YN907f7akbGuw1zs6eW8Hs=.ed25519
bundle-core.js:689 Uncaught RangeError: Trying to access beyond buffer length
    at checkOffset (bundle-core.js:689)
    at Uint8Array.Buffer.readUInt16LE (bundle-core.js:689)
    at bundle-core.js:109
    at bundle-core.js:109
    at Request._callback (bundle-core.js:109)
    at Request.callback (bundle-core.js:2153)
    at ReadRequest.onread (bundle-core.js:2124)
    at FileReader.ReadRequest.reader.onload (bundle-core.js:2124)
checkOffset @ bundle-core.js:689
Buffer.readUInt16LE @ bundle-core.js:689
(anonymous) @ bundle-core.js:109
(anonymous) @ bundle-core.js:109
(anonymous) @ bundle-core.js:109
Request.callback @ bundle-core.js:2153
ReadRequest.onread @ bundle-core.js:2124
ReadRequest.reader.onload @ bundle-core.js:2124
load (async)
ReadRequest @ bundle-core.js:2124
read @ bundle-core.js:2124
Request._run @ bundle-core.js:2153
RandomAccess.run @ bundle-core.js:2153
RandomAccess.read @ bundle-core.js:2153
(anonymous) @ bundle-core.js:109
Request.callback @ bundle-core.js:2153
(anonymous) @ bundle-core.js:2124
bundle-core.js:25 connected to: @lbocEWqF2Fg6WMYLgmfYvqJlMfL7hiqVAV6ANjHWNw8=.ed25519
bundle-core.js:25 syncing with @lbocEWqF2Fg6WMYLgmfYvqJlMfL7hiqVAV6ANjHWNw8=.ed25519
bundle-core.js:11 syncing feeds
bundle-core.js:11 full feeds: 0.10400390625 ms
bundle-core.js:11 partial feeds: 2.049072265625 ms
bundle-core.js:5 doing ebt with @lbocEWqF2Fg6WMYLgmfYvqJlMfL7hiqVAV6ANjHWNw8=.ed25519

The exception seems to be unrelated to the pub syncing. Maybe not, but I figure I'd better report this in case it is related.

KyleMaas commented 3 years ago

So, after clearing again and connecting only to the pub and waiting a few minutes, status does not seem to be changing:

KyleMaas commented 3 years ago

Let's try that again:

DB status
{
  "log": -1,
  "indexes": {
    "base": -1,
    "ebt": -1,
    "fullMentions": -1,
    "contacts": -1,
    "profiles": -1
  },
  "totalPartial": 0,
  "profilesSynced": 0,
  "contactsSynced": 0,
  "messagesSynced": 0,
  "totalFull": 0,
  "fullSynced": 0
}
EBT status
{
  "id": "@i+X5J2e6gaq5dPTmabMnF55gztUAtJy3FbW8Tv3TabU=.ed25519",
  "peers": {
    "@lbocEWqF2Fg6WMYLgmfYvqJlMfL7hiqVAV6ANjHWNw8=.ed25519": {
      "seq": -1,
      "replicating": {
        "tx": false,
        "rx": true,
        "sent": -1,
        "requested": 0
      }
    }
  }
}

I am not seeing any messages in Public or Private.

arj03 commented 3 years ago

This is fine actually.

DB status { "log": -1

Means that you don't have any data in the browser. So when it syncs it doesn't know who to download. Try going to the id of your phone and follow that one. Then log should be 0 and you should start getting messages from that one and all the people you follow from your phone.

arj03 commented 3 years ago

If lboc doesn't know about your phones profile you can try @6CAxOI3f+LUOVrbAl0IemqiS7ATpQvr9Mdw9LC4+Uv0=.ed25519. That is my main profile. For a smaller amount of data you can try against my browser test profile: @VIOn+8a/vaQvv/Ew3+KriCngyUXHxHbjXkj4GafBAY0=.ed25519.

KyleMaas commented 3 years ago

Ah, yep, that works. Cool. Now I have message data to work with. Thanks!

KyleMaas commented 3 years ago

Tagged this one with "enhancement", because I think it'd be good if we had some kind of a warning for new users about how this works.

KyleMaas commented 3 years ago

Well, we now have an indicator under Connections. I'm almost thinking we could close this. What do you think?