I have a C script that parse some data and put the data into mongodb using mongoc driver. The script use multithreading to open 3 threads at the same time. The very first time it worked without problem, but somehow I lost data and had to rerun the script again. This time it crashed the whole server and I had to reboot the server. When server is back online, I noticed there is unclean mongod.lock file in dpath so I run repair command and it crashes again. I also tried to start mongod and it crashes as well if I set dpath to previous dpath (not crash if i set to some other dpath).
I am so confused that I don't know that what's wrong here and how potentially can I fix it?