mathiassoeholm / markdown-link-updater

20 stars 9 forks source link

Potential race condition when multiple files are moved? #32

Open alex-broad opened 1 year ago

alex-broad commented 1 year ago

Having now used the tool in anger I found I got some corrupted lines. I haven't fully been able to isolate it yet but it appears to happen when there are two files being moved that both cause changes to a single line in the same file. I wasn't able to recreate this scenario easily in the existing test framework as I don't think the test framework allows for this kind of interaction currently.

My gut is that it may be a race condition caused when VSCode makes calls to the plugin for each file being moved in quick succession, and as I suspect there is little/no protection over concurrent file access the corruption can occur?

alex-broad commented 1 year ago

(overall the tool is great and has saved me a lot of time - it was only 3 occurrences in around 174 files which was easy enough to fix up manually!)