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

CAS fails randomly even though it shouldn't #136

Closed
SeverinAlexB opened this issue Mar 4, 2025 · 3 comments · Fixed by #137
Closed

CAS fails randomly even though it shouldn't #136

SeverinAlexB opened this issue Mar 4, 2025 · 3 comments · Fixed by #137

Comments

@SeverinAlexB
Copy link
Contributor

I am building a republisher. Following the instructions for CAS in the publish() method, I resolve the most recent packet first before I publish the packet again.
Problem: publishing fails randomly even though no newer packet has been published. See this test which reproduces the problem.

Output:

0 Ok
1 Ok
2 Ok
3 Failed to publish packet. Compare and swap failed; there is a more recent SignedPacket than the one seen before publishing
thread 'publisher::tests::republish_cas_test' panicked at pkarr-publisher/src/publisher.rs:197:17:
@Nuhvi
Copy link
Collaborator

Nuhvi commented Mar 4, 2025

Republishers don't run the risk of overwriting anything, so they don't need to use cas at all.

@SeverinAlexB
Copy link
Contributor Author

Sure. Issue is still here though

@Nuhvi
Copy link
Collaborator

Nuhvi commented Mar 4, 2025

This turns out to be a bug with how the cas is sent to relays as an HTTP Date, which doesn't have enough resolution (seconds instead of microseconds). Still thinking if I can salvage If-Unmodified-Since or if we have to use a custom header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants