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

Be more defensive for delayed doc unload being triggered twice, introduced in a320772a #278

Merged
merged 1 commit into from
Mar 24, 2020

Conversation

ericyhwang
Copy link
Contributor

In #276, I introduced deferred doc unload to fix a memory leak introduced by a PR last year.

However, if a doc gets two unloads deferred, the second one can fail with a stack trace like this:

     Uncaught TypeError: Cannot read property 'remove' of undefined
      at Doc.unloadDoc (node_modules/racer/lib/Model/subscriptions.js:193:44)
      at Doc._emitNothingPending (node_modules/sharedb/lib/client/doc.js:246:8)
      at Doc._clearInflightOp (node_modules/sharedb/lib/client/doc.js:962:8)
      at Doc._opAcknowledged (node_modules/sharedb/lib/client/doc.js:884:8)
      at Doc._handleOp (node_modules/sharedb/lib/client/doc.js:315:10)
      at Connection.handleMessage (node_modules/sharedb/lib/client/connection.js:246:20)
      at StreamSocket.socket.onmessage (node_modules/sharedb/lib/client/connection.js:139:18)

This fixes the double deferred unload case by being more defensive.

@ericyhwang ericyhwang merged commit 0e28888 into master Mar 24, 2020
@ericyhwang ericyhwang deleted the doc-unload-fix branch March 24, 2020 17:35
@ericyhwang ericyhwang changed the title Be more defensive for delayed doc unload introduced in a320772a Be more defensive for delayed doc unload being triggered twice, introduced in a320772a Mar 24, 2020
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 this pull request may close these issues.

1 participant