share / share/sharedb

Doc never resends operations if they fail to acknowledge

Open
#700 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
6.5k
Forks
456
Avg merge
1d 5h
Merged PRs (30d)
5

Description

Problem Summary
ShareDB operations can become permanently stuck when acknowledgments fail, with no built-in retry mechanism. Once an operation is marked as inflightOp, it will never be retried as flush blocks it.

What happens

  • User calls submitOp() → Operation becomes inflightOp
  • Operation is sent to server via connection.send()
  • Server fails to respond (crash, network issue, etc.)
  • inflightOp remains set forever
  • flush() never calls _sendOp() again because inflightOp exists
  • Operation is permanently stuck

Proposed fix
Change flush to resend the inflightOp, though you should add a backoff mechanism so it doesn't retry forever.

This is causing some data loss for us as this fails silently! User's would be typing away and because the doc does optimistic inserts it would appear everything was kosher, but on refresh of the page all their data (after the failed acknowledgement) was wiped out.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing submitOp(), flush(), _sendOp(), and connection.send() to understand how inflightOp blocks retries. Define and verify retry behavior with backoff, including what happens when acknowledgments never arrive, so failed operations are no longer silently stuck.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.