-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix: sync should only happen when both sides are enabled #764
Conversation
I added a commit which I think fixes this. I don't particularly like this, and I feel like this code is fragile, given that we are doing something not supported by hypercore, but I have written some more robust unit tests for this now. I extracted The solution I found for this is that rather than iterating through peers attached to a core to get the channel reference (to close it), I iterate through the channels of a protomux. I'm not sure what the consequences are if there are multiple channels with the same id on a protomux, but I don't think we do that so I think it's fine. With the unit tests for |
Correction: not yet fixed! Fuzz tests are showing errors still with re-sync not working as expected. I am unable to reproduce locally, I wonder if there is a way we can make fuzz tests reproducible? |
The issue could be because of edge cases (race conditions) around starting and stopping sync in the same tick. Opening a protomux channel (which happens when replicating a core) is asynchronous, and I'm not sure what happens when we close a protomux channel in the same tick as when it is opening. Our sync api |
Filed #786. |
Gregor and I paired on this so I will merge without additional review. |
Closes #762.