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

A note sometimes get erased after saving from external text editor (Typora) #1854

Closed
lucker999 opened this issue Sep 5, 2019 · 13 comments
Closed
Assignees
Labels
bug It's a bug

Comments

@lucker999
Copy link

First of all I would like to say a ton of thanks for the amazingly awesome cross-platform not taking app. There are a large room for further improvement and growth but (1) it really ready to use, (2) the development is going in the right direction (although slow, but I understand) and (3) but definitely not least, I really can't leave without this app anymore! I set it up with my nextcloud and completely forget any doubts either type down sensitive info into a note or not. Sincerely and wholeheartedly Thank you!

Environment

Joplin version: 1.0.165 (prod, win32)
Platform: Windows 8.1

Steps To Reproduce

  1. Setup "Text editor command" in Settings to "C:\Program Files\Typora\Typora.exe" without any additional arguments
  2. Open a note in external editor from Joplin interface (click on "Edit in external editor" button)
  3. Make some changes in the note and save it in external editor OR just save a note in external editor
  4. Witness how you previously carefully gathered into the not info dissapeared (incl. note header)

Frankly and seriously, this happens SOMETIMES. I would say about each 10th or 15th time I save a note, and sometimes no a single time in a day, but it is tremendously annoying, because after I first time lost the collected in months info I ALWAYS must check whether the info in the note is in place or not after saving. 'cause if I close the external editor and info gone, ... well... you know... The only thing to make it back again is to save the note from external editor once again.

The note after that bug looks like on the screenshot.

Describe what you expected to happen:

I сouldn't be more happy if after this post two thing will be in my life with joplin:

  1. no need to check if a note is actually saved and not dissapeared - so, it actually saves EACH and EVERY time.
  2. no need to manually click again on the button "Edit in external editor" after I finished such editing and close the editor and the note

Logfile

I tried to log all this, but console was totally empty, nothing appered in it, sorry.

Screenshot 2019-09-05 20_48_50

@lucker999 lucker999 added the bug It's a bug label Sep 5, 2019
@laurent22
Copy link
Owner

This is unfortunately an issue that comes up now and then and it's hard to fix since I can't replicate it.

If you could provide a log file while this bug is happening that could help. To do so could you add a file "flags.txt" in the config directory with the following content? --log-level debug (see here for more info) This will make sure everything is logged to the file "log.txt" in your profile directory.

Then use the app as normal and when this bug happen, please copy the log.txt file and send it over. From that it might be possible to see what action leads to this bug.

@lucker999
Copy link
Author

Oops, somehow I missed the notion, that the log should already be saved in a file:)

When I posted the bug report I had already performed the steps from the instructions in your last message. Then I thought that I should copy log from console, which was empty. So, today I found the log from my first attempt (when I posted the bug with screenshot).

I'm not sure about the actual time I started the debug log, but I think it should be later than 18.00 or so. Let me know if I could provide any additional info.

log.txt

@laurent22
Copy link
Owner

Unfortunately there are too many events to find something in it with an approximate time. If the blanked note happens again, please note the exact time (to the second if possible) and send the log.

@rhklite
Copy link

rhklite commented Sep 30, 2019

i've been having this issue as well. Similar to what @lucker999 posted, I also don't know the guaranteed way to reproduce this. However, i think i was able to narrow this down to Scheduling sync operation

In log attached, the issue happened at 2019-09-29 20:45, then 2019-09-29 20:58:37. I was watching the log when the 20:58 event happened.

2019-09-29 20:45:24: "Scheduling sync operation..."
2019-09-29 20:45:28: "Scheduling sync operation..."
2019-09-29 20:45:30: "Scheduling sync operation..."
...
2019-09-29 20:58:37: "Scheduling sync operation..."
2019-09-29 20:58:42: "Scheduling sync operation..."
2019-09-29 20:58:44: "Scheduling sync operation..."

Environment

Joplin version: Joplin 1.0.161 (prod, linux)
Revision: d066350 (HEAD)
Platform: Ubuntu 16.04
External Editor: VScode

Process Done to Reproduce Bug

  1. Opened 1 instance of note in external editor.
  2. Typed, saved. This did not reproduce the issue.
  3. Opened 2nd instance of note in external editor
  4. Typed, saved, issue produced. (20:45 event)
  5. Opened log file in split screen
  6. typed in external editor not saved in external editor
  7. Saw scheduling sync in log.txt, and note in the Joplin GUI erased (20:58 event)
  8. ctrl+s in external editor, note in Joplin GUI restored

log.txt

@rhklite
Copy link

rhklite commented Sep 30, 2019

I think i found a semi-reliable way to reproduce this. This seems to happen when i manually trigger a sync when the system scheduled sync happens.

In the log attached, I was able to reproduce this at 2019-09-29 21:33:18 and 2019-09-29 21:45:33
log.txt

Steps To Reproduce

  1. Open note in external editor
  2. Open log.txt in external editor to monitor sync status.
  3. Wait until system triggered sync event. look for "Scheduling sync operation..."
  4. before the systen syn event finishes ctrl+s in external editor, this will manually trigger a sync event.
  5. Notes inside Joplin GUI should be erased.
  6. ctrl+s again in external editor restores the erased note.

I tried this 4 times. was successful 2/4 times in reproducing this bug.

@lucker999
Copy link
Author

Additionally I also noticed, that the larger a note I edited then more probably this bug occurs. On a huge note with many code snippets and TOC and so on this happens far more often than on a tiny note with only several lines plain text. Although I never tried to manually sync when editing a note in an external editor.

Eventually I have to admit that recent updates of Joplin client for windows did make a difference in the behavior and, probably, exterminated the bug. Since the logic behind the acquiring changes from an external editor was changed (now I do not need to save a note manually, Joplin somehow pulls changes itself and fast instantly) I can not say that I encountered the bug any more. I do less notes recently, but from what I experience, I have a feeling that it might be gone.

Anyway, i'll keep you posted on my encounters.

@laurent22
Copy link
Owner

@rhklite, thanks for providing the steps to replicate. As mentioned earlier, could you try to run the app with the --log-level debug flag, as described there? https://joplinapp.org/debugging/#desktop-application. That should add log entries with a "ExternalEditWatcher:" prefix which might tell us more precisely what happens. When I have a moment I'll also try the steps you listed.

@rhklite
Copy link

rhklite commented Oct 2, 2019

I didn't explicitly try to replicate this bug, I just caught by chance.

bug happened around 2019-10-02 14:04:27

log.txt

@rhklite
Copy link

rhklite commented Oct 2, 2019

  • caught a 2nd instance of the bug right after i posted the previou comment

bug happened between 2019-10-02 14:07:28 to 2019-10-02 14:08:00

log.txt

@rhklite
Copy link

rhklite commented Oct 2, 2019

I updated joplin version. The two bug instance i mentioned are on

Joplin 1.0.169 (prod, linux)
Revision: 0c552fe (HEAD)

@rhklite
Copy link

rhklite commented Oct 3, 2019

log.txt

caught another instance of this bug; happened at 2019-10-03 17:44:27

@pryme
Copy link

pryme commented Oct 9, 2019

I have been seeing this issue also this week. Haven't been able to reproduce by steps above, but it just happened at 2019-10-09 12:52:12 in the attached log file.

Environment

Joplin version: Joplin 1.0.169 (prod, linux)
Revision: 0c552fe (HEAD)
Platform: Ubuntu 16.04
External Editor: VScode
Syncing is not configured

log.txt

@laurent22
Copy link
Owner

I've finally managed to replicate this bug consistently and fixed it. It's some strange thing that Typora is doing that results in an empty file for a very short period of time (it's probably clearing the file and adding the new content to it) and if Joplin reads it at that very moment, it will be get empty content, and save an empty note.

The fix will be in the next version so please give it a try then and let me know if it works.

@lock lock bot locked and limited conversation to collaborators Oct 14, 2019
scoroi pushed a commit to scoroi/joplin that referenced this issue Nov 10, 2019
scoroi pushed a commit to scoroi/joplin that referenced this issue Nov 10, 2019
…d when using certain external editors (in particular Typora)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug It's a bug
Projects
None yet
Development

No branches or pull requests

4 participants