Closed basham closed 1 year ago
Could you give replica-server 1.1.2 a go? Having serveShareQuery asked for repeatedly makes me think that one end of that conversation doesn't have my recent fixes, as it should now only be asked for at the beginning of a sync or when a replica is added or removed.
v8.2.4 contains fixes for ReplicaDriverLocalStorage + IndexedDB which fixed an issue like the one you're describing (peers see each others shares but don't exchange docs). Is there a chance your browser app could be using a cached version of Earthstar?
The two websocket servers you see in those scenarios are actually two servers a single websocket client in the test syncs with concurrently, so websockets are being tested from all ends!
I'm now using replica-server@1.1.2
.
As for my browser version of Earthstar, I compiled my own bundle of v8.2.4 (rather than copying it over from the CDN), and I'm including it via npm. Within node_modules
, I've edited that bundle to use console.log()
to output the Websocket messages. That's the only tweak I've done. Because I'm seeing those custom logs, I'm confident I'm using the latest version of Earthstar. If a cached version was being used, I wouldn't see the logs. And just to be extra sure, I inspected a diff between my custom bundle version and what is posted on the Earthstar CDN. The only differences are mostly about different minified variable names. There is no logic differences, as you would expect if you were comparing different versions of the same code. For reference, I'm using deno@1.19.1
on macOS.
Thanks for clarifying about the Websocket test.
With the change to replica-server
, I am noticing a change in the messages the browser receives, but the documents are still not being sent. After the salted handshake (serveSaltedHandshake
), there is only one serveAllShareStates
request, rather than a continuous stream of them like before. However, the browser continues to receive message requests for serveShareQuery
and response messages with empty docs. These two messages repeat continuously.
As additional tests in the browser, I swapped out ReplicaDriverIndexedDB
for ReplicaDriverMemory
and ReplicaDriverLocalStorage
. In all cases, the Websocket messages are identical (as I described in my last comment).
Could you post a full set of logs for me in a gist? One reason two peers may not return docs to one another is because they believe they've caught up with each other. I'd like to see which localIndex
each side is requesting from each other.
This gist contains 5 to 10 seconds of the Websocket messages that the browser received from replica-server. I've logged the messages as JSON. https://gist.github.com/basham/13af3ec5f6395b988ecaf1c924120cd1
The
WebsocketPeerScenario
includes a test that syncs twoTransportWebsocketServer
instances. Please also add a scenario in which aTransportWebsocketClient
syncs with aTransportWebsocketServer
.Background
I'm trying to get a local project to work. Maybe adding this test will reveal a bug that can be fixed or reveal something that I need to change on my end. If there still isn't a fix for my situation in doing this work, at least there is more test coverage.
More specifically, I have a deno script that inserted data in a Sqlite replica (
earthstar@8.2.4
). This was synced to a local instance of the replica server (v1.1.1
). The Sqlite databases are identical, so the sync worked. Now, I have a local browser environment (withearthstar-bundle@8.2.4
) in which I'm trying to sync that server data to the browser. After the salted handshake, the messages returned from the server generally cycle in sequence among these three messages:data.docs
is always empty)The server and client are recognizing common shares. It just seems like the server is not sending documents to the client.