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

editing changes not being saved #331

Open
elpraga opened this issue Oct 5, 2019 · 16 comments
Open

editing changes not being saved #331

elpraga opened this issue Oct 5, 2019 · 16 comments

Comments

Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants
@elpraga
Copy link

@elpraga elpraga commented Oct 5, 2019

Describe the bug
A clear and concise description of what the bug is.

Changes stopped being saved after some time of collaborative editing.

To Reproduce
not sure

Expected behavior
I expect all changes to be saved.

Client details:

  • OS: Android, Win, Ubuntu
  • Browser: chrome
  • Version: 1.02 Nextcloud 16.0.5
Server details

Text app version: (see Nextcloud apps page)

Operating system:

Web server:
apache
Database:
mariadb
PHP version:
7.3
Nextcloud version: (see Nextcloud admin page)
16.0.5

Logs

Nextcloud log (data/nextcloud.log)

debug text
Unsaved steps but collission with file, continue collaborative editing

Browser log

Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log
c) ...
@elpraga elpraga added the bug label Oct 5, 2019
@jimjulian
Copy link

@jimjulian jimjulian commented Oct 6, 2019

We are seeing this too. Changes were not being updated for five+ minutes.

Note that we had both the "Text" module and the "Plain text editor" enabled at the same time. The changes were reflected in the "Plain text editor" immediately. We did not have trouble at first but have been more heavily and concurrenlty editing our test file.

This is a fresh Nextcloud 16.0.5 installation using Ubuntu Linux, PHP7, etc. The Nextcloud "Overview" gives a green checkmark with no issues.

Aside:

  • We assume that the "Plain text editor" was being used when the file was right-clicked ("...edit in plain text..."). Single-clicking the file brought up the "Text" module.
  • Currently, the "Text" module is disabled, leaving only the "Plain text editor" enabled. Now single-clicking the file opens the "Plain text editor" module.

@juliushaertl
Copy link
Member

@juliushaertl juliushaertl commented Oct 7, 2019

Any change to get hands on a broken document?

@elpraga
Copy link
Author

@elpraga elpraga commented Oct 7, 2019

I'm sorry @@juliushaertl unfortunately, I indeed to make this file usable ASAP, so I couldn't leave it in the state it was in.

Renaming the file did not help. I had to copy it outside Nextcloud, erase it, and upload it again.

Are there some more detailed logs I might look into? I didn't find any, but maybe you could guide me..

@juliushaertl
Copy link
Member

@juliushaertl juliushaertl commented Oct 8, 2019

The browser log would be interesting in those cases. If anyone encounters an issue please report that one as verbose as possible.

@ReleaseTheKnowledge
Copy link

@ReleaseTheKnowledge ReleaseTheKnowledge commented Oct 18, 2019

I have a live text document that can't be saved. It stopped updating while 5 people were editing it. It sends "Changes could not be sent yet" at the top of the page.
I made a copy of the file through Nextcloud and then the copy worked. But not the original.

I can attach the file but I do not know if it will show anything as the copy of the file worked for me.
And I can send logs if someone says what is needed and how.

Note:
This is using NextcloudPi v.1.17.1 on a Raspberry Pi 3b+. Kernel: 4.19.66-v7+, Nextcloud version 16.0.5

@juliushaertl
Copy link
Member

@juliushaertl juliushaertl commented Oct 24, 2019

@ReleaseTheKnowledge You can send me a public share link of the file. Otherwise you will need to to the following to get broken document data:

  • obtain the file id (which is easy to get if you copy a internal link in the files sidebar and just take the number at the end of the link) Assuming 1441 as the file id for the following steps:
  • get the base file from data/appdata_[instanceid]/text/1441
  • get the list of steps applied on top from the database with the following query:
    select * from oc_text_steps WHERE document_id = 1441;

Feel free to share it via mail (in my github profile)

@ReleaseTheKnowledge
Copy link

@ReleaseTheKnowledge ReleaseTheKnowledge commented Oct 24, 2019

Sent info.

@juliushaertl
Copy link
Member

@juliushaertl juliushaertl commented Oct 25, 2019

Thanks, I'll look into that.

@kubasz
Copy link

@kubasz kubasz commented Nov 11, 2019

We've also encountered this issue, I can send you an e-mail with a public share link if that'd be useful?

It occurs on both Chrome and FF, on both Windows and Arch linux, the server is FreeBSD 11.3 running Nextcloud 16.0.6 with Text 1.0.2 on PHP 7.3. All of our files are in group folders, and all accounts authenticate with LDAP if that's relevant.

The error from the browser log when trying to edit the file is:

failed to apply steps due to collission, retrying editor.js:129:3534
    value https://[our nextcloud domain]/apps/text/js/editor.js?v=03e73356d15664e71680:129

There are no entries in the nextcloud log.
That particular file has been stuck in a state with unsaved changes and not saving at all for 6 days now.

@juliushaertl
Copy link
Member

@juliushaertl juliushaertl commented Nov 13, 2019

@kubasz Yes, please, a share link would be great.

@kubasz
Copy link

@kubasz kubasz commented Nov 13, 2019

@juliushaertl You should receive an e-mail with the link and password now

@juliushaertl
Copy link
Member

@juliushaertl juliushaertl commented Nov 15, 2019

Thanks a lot @kubasz and @ReleaseTheKnowledge for sharing the failed documents.

I think I found the underlying issue that is actually a race-condition when pushing the steps to the database. If multiple users push steps at the same time, there might be two different set of steps added from the same base version in

$document = $this->documentMapper->find($documentId);
if ($version !== $document->getCurrentVersion()) {
throw new VersionMismatchException('Version does not match');
}
$stepsJson = json_encode($steps);
if (!is_array($steps) || $stepsJson === null) {
throw new InvalidArgumentException('Failed to encode steps');
}
$validStepTypes = ['addMark', 'removeMark', 'replace', 'replaceAround'];
foreach ($steps as $step) {
if (array_key_exists('stepType', $step) && !in_array($step['stepType'], $validStepTypes, true)) {
throw new InvalidArgumentException('Invalid step data');
}
}
$newVersion = $document->getCurrentVersion() + count($steps);
$document->setCurrentVersion($newVersion);
$this->documentMapper->update($document);
$step = new Step();
$step->setData($stepsJson);
$step->setSessionId($sessionId);
$step->setDocumentId($documentId);
$step->setVersion($version+1);
$this->stepMapper->insert($step);

I'll prepare a fix and a workaround to fix existing broken documents next week.

@anarcat
Copy link

@anarcat anarcat commented Nov 22, 2019

for the record, we have found similar problems when 10+ people would join a document at the same time, many of which editing. some styling commands wouldn't apply, or it would be seen by a client but not another, and on reload, the first one wouldn't see it anymore.

it seems consistent with a race condition, and i'm happy to hear there's a fix in preparation!

@micah
Copy link

@micah micah commented Dec 12, 2019

I've encountered this same bug, @juliushaertl - have you found a fix for this and for existing documents?

@JanoschDeurer
Copy link

@JanoschDeurer JanoschDeurer commented Jan 24, 2020

I'm having the same problem. This is now part of Nextcloud 18 and therefore used by my Nextcloud users... @juliushaertl is there any way we can help you? Do you need more information?

@benoitg
Copy link

@benoitg benoitg commented Jan 28, 2020

What's particularly bad about this bug, is that normal users will not have any indication that anything isn't working. Both users encountering the race can keep typing, and both of their version will silently fail to be saved, and end in data loss. The only way they can know is if they open the browser's console...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment