OokTech / TW5-Bob

A plugin that makes tiddlywiki a multi-user wiki on node
BSD 3-Clause "New" or "Revised" License
216 stars 28 forks source link

Bob deletes tiddler when edited via edit-text #194

Open tcj-one opened 1 year ago

tcj-one commented 1 year ago

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]):

and using

Before posting I read issue guidelines and:

simpsoneric commented 1 year ago

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

My version setup is:

The error case is:

tcj-one commented 1 year ago

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.

simpsoneric commented 1 year ago

Some debugging on my end:

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)

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.

tcj-one commented 1 year ago

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.

tcj-one commented 1 year ago

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: