turtl / tracker

This project is for tracking issues, bug reports, and progress on the entire Turtl project.
67 stars 3 forks source link

Strange sync issue causing repeated duplication of part of the note #390

Open robme opened 3 years ago

robme commented 3 years ago

I don't know how this happened, but when saving a note on either Android app or Windows program it somehow ended up with part of the text repeated hundreds of times. The result was this note became hundreds of megabytes in size.

The note became so large that it barely opened, the program lags so much when trying to edit it. I copied it out to Notepad, removed the duplicated parts and copied it back. And after saving, it happens again.

I can repeat these steps and get it to happen every time. There is something about the text in this note that causes the Android app to repeat a specific section of it whenever editing it. It becomes exponential because it goes from 2 duplications, to 4, to 8, and so on.

I don't even need to edit the note, just open it, change nothing, click Save, and every time I do this, it duplicates a specific section of the text.

orthecreedence commented 3 years ago

Wow, that's an interesting one. Explains some of the server alerts I got a day or two ago.

If you copy this text into a new note, does the duplication occur again? What I'm trying to figure out is if the problem is in the note itself or the text inside the note. If it is indeed the text, if it's not a private nature, would you might sharing it, or if it is private, can the private information be removed in such a way that the duplication still happens? If the problem is with the note itself, I'd be interested to know the note's ID.

You can obtain the note's ID by opening the note, typing ctrl+shift+k to open the dev tools, selecting the "Console" tab, and pasting this: $E('.note-view .view').getAttribute('rel'). It will spit out a value, which you can copy/paste here.

Thanks for helping to narrow this down!

robme commented 3 years ago

The note in question was for my personal diary for February, so I don't want to share its contents.

If you copy this text into a new note, does the duplication occur again?

Yes, I just tried putting it in a new note and it occurred again.

The note ID is 01775eca5b7234a11c786bc4b27fff6e1ac9fce82003d61b68944f1673206657dec2475c2e0c00e2 but it doesn't seem to be specific to the note, but to the text.

I am not sure what else I can give you to debug this. I wondered if there might have been an invisible character in there during sync.

The part that duplicates starts with this:

" now if back ups didn't exist."

I wrote that in the entry for 23 February, and it keeps duplicating everything written after it every time the note is saved (i.e. what I wrote for the rest of the month).

orthecreedence commented 3 years ago

FWIW I added a note with " now if back ups didn't exist." with some text following it to my Turtl and now it won't even show me the notes list (I get an unspecified error).

It appears we are somewhat in the same boat. I just reinstalled my OS and haven't gotten Turtl dev set up yet, but I'll see what I can do to get it running locally and pick this apart. It appears you've found some sort of magic phrase.

orthecreedence commented 3 years ago

Turns out my issue was unrelated, and unfortunately I cannot reproduce this. The invisible character could be a cause, but without the note text there's not a lot I can do. If you can reduce the error to a particular test case, like a minimized set of words/punctuation that isn't private, I could try to reproduce it on my end.

robme commented 3 years ago

This has happened again to me quite a few times now, and I've realised it is related to the length of the document. I've done some experimenting and worked out that when it goes beyond 65362 characters everything after that character will get repeated every time you save the note.

I have prepared a note you can use to reproduce this.

example.txt

Steps to reproduce:

  1. Paste example.txt into a new Turtl note and save it. It should save fine.
  2. Edit it and add any characters to the end and save it.
  3. Open the note and you should see the characters you added got repeated.
  4. Every time you open the note and save it, the characters after character 65362 get doubled, so it exponentially gets bigger.