How to debug mysterious deletion of files? #4726
-
I am developing a node (v16.15.0) application that uses
As you can see there are few directories left in .git. Usually there are more files here. Application only reads/writes files to the working directory but never deletes them. It's using node's fs module for file system read/write. For all git related stuff, nodegit obviously uses filesystem internally to read/write to .git, but my application never directly accesses .git I've tried to observe when this happens and how frequently it happens. So far it has happened a 3-4 times over the course of couple of months. I can't actually pin point or repro. The last time it happened was when I had put my macbook to sleep while the node application was still running. After waking up I started seeing this error. The files in the working directly that have disappeared are all the files read (but not updated after creation) by the application. Files that were not deleted were files my application only just created (as a result of a new api I'm still developing and I only got the creation part working so far). These files are not yet read by my application. In the course of product development, I'm restarting my application all the time (nodemon) and I often put my macbook in sleep mode between breaks. Since I'm losing files from both .git and working directly, this makes me wonder if I can rule out nodegit. Secondly, I have no idea where even begin to debug this. I am going to try using 'fs_usage' next. Any suggestions on how I can try to understand when/why this happens? |
Beta Was this translation helpful? Give feedback.
Replies: 0 comments 1 reply
-
On Linux you'd use strace to record file operations and stack traces. On macOS... maybe dtruss? Requires root and isn't nearly as polished as strace though. |
Beta Was this translation helpful? Give feedback.
On Linux you'd use strace to record file operations and stack traces. On macOS... maybe dtruss? Requires root and isn't nearly as polished as strace though.