OokTech/TW5-Bob

Bob deletes tiddler when edited via edit-text

tcj-one opened this issue · 5 comments

When editing a Tiddler via an edit-text widget in another tiddler, the tiddler being edited will frequently get deleted. This happens regardless of how its being targeted (variable from dropdown or hardcoded) and whether or not the widget itself is hardcoded or generated as part of a macro.

My first hypothesis is that bob is trying to save the modified tiddler every single character, and occasionally steps on itself (sometimes you can go for many seconds without problem).

My first instinct is to increase the save delay (IE wait 30 seconds between changes before saving, not 0). But I'm not sure how to do that, and it would really only be masking over the problem.

Any thoughts?

This is my widget that's causing the issue

<$edit-text tag=textarea class=table-editor-text minHeight=10px tiddler=Test field=effect1/> \end


I am running (check any that apply, put an x inside the [ ] to check a box, like this: [x]):

  • Windows
  • OSX
  • Linux
  • Other

and using

  • The nodejs version
  • The single file executable

Before posting I read issue guidelines and:

  • I am using the newest version
  • The answer to my question isn't listed in the documentation or this isn't
    a question
  • This is not a duplicate issue
  • I have not done anything that required me to set acceptance to
    I Will Not Get Tech Support For This

I don't want to complicate this issue,
but I am also running into this problem.

My version setup is:

  • Linux
  • nodejs version (TiddlyWiki 5.2.5)
  • TW-Bob version c2e47d0

The error case is:

  • I have tiddler "Foo" open in my browser
  • I edit the tiddler "Foo.tid" using vim on the file system and save it
  • Occasionally "Foo.tid" gets deleted and not re-created after a save
  • Web browser doesn't see it and it is gone from the file system

I also had a script running on the server that would scan modified .tid files, and modify them based on the contents. I assumed it was my poor coding that was causing some of those to get deleted, and only discovered my above problem after disabling it. Maybe my code wasn't as poor as I thought.

Some debugging on my end:

  • I had vim configured to use backup files

This creates files in the mywiki/tiddlers directory with the Foo.tid~ name. I noticed the TW-Bob file system watcher was essentially deleting and watching the same tiddler twice, since their title was identical.

This may have also been a race condition (but I did not spend much time debugging)

  • Two tiddlers had the same title in the tiddlers directory
  • The TW-Bob file system watcher was notified of these two changes
  • They both would race to the fs.unlink() call on local file system changes prior to resaving the tiddler contents to disk

Vim backup files seemed like a bad idea to mix with the TW-Bob file system watcher, so I disabled them.

In addition, I made some code changes I'm trying out at https://github.com/simpsoneric/TW5-Bob/tree/fs_sync_issues

I've run my local setup for the past day and have not run into the deleted tiddler problem.

I'll caveat my changes with my lack of TW-Bob knowledge.
I have only used TW-Bob for a few weeks, and I use it in a single user setup.
I have no idea if my changes break other use cases.

I have blindly changed my install to use your repository (after backing up). It's multi-user, but we rarely edit at the same time. I'll let you know if I encounter any issues.

EDIT: It looks like I am a fool and failed to switch to your repo.

It looks like the issue still exists. I just lost a tiddler, called "Ruin". Here some logs from during the event.

0|TW5      | sending ack failed
0|TW5      | sending ack failed
0|TW5      | sending ack failed
0|TW5      | Save Tiddler  Ruin
0|TW5      | sending ack failed
0|TW5      | Save Tiddler  Ruin
0|TW5      | Save Tiddler  Ruin
0|TW5      | Deleted tiddler Ruin
0|TW5      | sending ack failed
0|TW5      | deleted file  /appdata/tiddlywiki/TiddlyWiki5/Wikis/X/tiddlers/Ruin_1.tid
0|TW5      | Save Tiddler  Ruin
0|TW5      | sending ack failed
0|TW5      | Deleted tiddler Ruin
0|TW5      | sending ack failed
0|TW5      | deleted file  /appdata/tiddlywiki/TiddlyWiki5/Wikis/X/tiddlers/Ruin_1.tid

0|TW5  | error removing old backup:
0|TW5  | error removing old backup:
0|TW5  | error removing old backup: