mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
Fix sessioninfos race that can cause crash during USER_CHANGES handling
When stress testing etherpad-lite we occasionally got this error: TypeError: Cannot read property 'author' of undefined at /home/etherpad/etherpad-lite/src/node/handler/PadMessageHandler.js:556:47 handleUserChanges was accessing sessioninfos[client.id].author in a callback, after spending some time in the loop that updates the changeset to the latest revision. It's possible for a disconnect request to be processed during that loop so the session might no longer be there. This patch fixes it by looking up the author at the start of the function.
This commit is contained in:
parent
49799bfa97
commit
e16008b371
1 changed files with 1 additions and 2 deletions
|
@ -465,6 +465,7 @@ function handleUserChanges(client, message)
|
|||
var baseRev = message.data.baseRev;
|
||||
var wireApool = (new AttributePool()).fromJsonable(message.data.apool);
|
||||
var changeset = message.data.changeset;
|
||||
var thisAuthor = sessioninfos[client.id].author;
|
||||
|
||||
var r, apool, pad;
|
||||
|
||||
|
@ -545,8 +546,6 @@ function handleUserChanges(client, message)
|
|||
return;
|
||||
}
|
||||
|
||||
var thisAuthor = sessioninfos[client.id].author;
|
||||
|
||||
pad.appendRevision(changeset, thisAuthor);
|
||||
|
||||
var correctionChangeset = _correctMarkersInPad(pad.atext, pad.pool);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue