2019-05-03 11:59:28: WARNING[Server]: Failed to write to file: ~\bin\..\worlds\ctf_mapmake\env_meta.txt
2019-05-03 11:59:28: ERROR[Server]: An unhandled exception occurred: Couldn't save env meta
2019-05-03 11:59:28: ERROR[Server]: In thread 8:
2019-05-03 11:59:28: ERROR[Server]: /home/stefan/mt-build/build/minetest_64/minetest/src/server.cpp:74: run: A fatal error occurred: Couldn't save env meta
Does anyone has a solution?
Last edited by Miniontoby on Fri May 10, 2019 12:13, edited 3 times in total.
Working on mtctl ---- Check my mod "Doorbell" -- Stay safe
This seems to be a "SerializationError". The file is probably corrupted or inaccessible. Try deleting ~\bin\..\worlds\ctf_mapmake\env_meta.txt, and try again.
2019-03-23 10:27:32: WARNING[Server]: Failed to write to file: XXX\bin\..\worlds\youtube\env_meta.txt
2019-03-23 10:27:32: ERROR[Server]: An unhandled exception occurred: Couldn't save env meta
2019-03-23 10:27:32: ERROR[Server]: In thread e:
2019-03-23 10:27:32: ERROR[Server]: /home/stefan/mt-build/build/minetest_64/minetest/src/server.cpp:74: run: A fatal error occurred: Couldn't save env meta
2019-05-10 12:55:51: WARNING[Server]: Failed to write to file: XXX\bin\..\worlds\youtube\env_meta.txt
2019-05-10 12:55:51: ERROR[Server]: An unhandled exception occurred: Couldn't save env meta
2019-05-10 12:55:51: ERROR[Server]: In thread 15:
2019-05-10 12:55:51: ERROR[Server]: /home/stefan/mt-build/build/minetest_64/minetest/src/server.cpp:74: run: A fatal error occurred: Couldn't save env meta
2019-05-10 13:57:32: WARNING[Server]: Failed to write to file: XXX\bin\..\worlds\youtube\env_meta.txt
2019-05-10 13:57:32: ERROR[Server]: An unhandled exception occurred: Couldn't save env meta
2019-05-10 13:57:32: ERROR[Server]: In thread 9:
2019-05-10 13:57:32: ERROR[Server]: /home/stefan/mt-build/build/minetest_64/minetest/src/server.cpp:74: run: A fatal error occurred: Couldn't save env meta
2019-05-10 12:55:51: WARNING[Server]: Failed to write to file: XXX\bin\..\worlds\youtube\env_meta.txt
2019-05-10 12:55:51: ERROR[Server]: An unhandled exception occurred: Couldn't save env meta
2019-05-10 12:55:51: ERROR[Server]: In thread 14:
2019-05-10 12:55:51: ERROR[Server]: /home/stefan/mt-build/build/minetest_64/minetest/src/server.cpp:74: run: A fatal error occurred: Couldn't save env meta
2019-05-13 14:23:52: WARNING[Server]: Failed to write to file: XXX\bin\..\worlds\server_daconcepts.com_30000\env_meta.txt
2019-05-13 14:23:52: ERROR[Server]: An unhandled exception occurred: Couldn't save env meta
2019-05-13 14:23:52: ERROR[Server]: In thread f:
2019-05-13 14:23:52: ERROR[Server]: /home/stefan/mt-build/build/minetest_64/minetest/src/server.cpp:74: run: A fatal error occurred: Couldn't save env meta
I have got some more other errors (look at the all 3rd lines)
Last edited by Miniontoby on Mon Jun 03, 2019 15:11, edited 3 times in total.
Working on mtctl ---- Check my mod "Doorbell" -- Stay safe
This may well be another missing lock in the threading code. The temporary file that safeWriteToFile creates is not really thread-safe, it's just the original name with .~mt appended.
I don't understand what this has to do with server.cpp:74, as it's only called in lines 283 and 989.
Me neither. It enters there only when safeWriteToFile returns false. In turn, safeWriteToFile emits the warning and returns false when renaming the temporary file fails. https://github.com/minetest/minetest/bl ... ys.cpp#736
My hypothesis was that lack of locking was causing a race where the file was renamed by a thread and then another thread tried to rename it and failed (because the name of the temporary file is the same for all threads). However, on inspection, the only callers to saveMeta I've found are all in server.cpp, and they are protected with the same lock. The callers I've found are:
2019-05-12 15:21:53: WARNING[Server]: Failed to write to file: XXX\bin\..\worlds\server_daconcepts.com_30000\env_meta.txt
2019-05-12 15:21:53: ERROR[Server]: An unhandled exception occurred: Couldn't save env meta
2019-05-12 15:21:53: ERROR[Server]: In thread 14:
2019-05-12 15:21:53: ERROR[Server]: /home/stefan/mt-build/build/minetest_64/minetest/src/server.cpp:74: run: A fatal error occurred: Couldn't save env meta
Working on mtctl ---- Check my mod "Doorbell" -- Stay safe
2019-05-12 15:21:53: WARNING[Server]: Failed to write to file: XXX\bin\..\worlds\server_daconcepts.com_30000\env_meta.txt
2019-05-12 15:21:53: ERROR[Server]: An unhandled exception occurred: Couldn't save env meta
2019-05-12 15:21:53: ERROR[Server]: In thread 14:
2019-05-12 15:21:53: ERROR[Server]: /home/stefan/mt-build/build/minetest_64/minetest/src/server.cpp:74: run: A fatal error occurred: Couldn't save env meta
You don't seem to be setting it right
Sorry, I was wrong. The thread id is not the internal Minetest emerge thread id as I thought it was. It's the result of std::this_thread::get_id(), which can be something entirely different.
Last edited by pgimeno on Sun May 12, 2019 15:12, edited 1 time in total.
That means that the problem is not in the file. For some reason the rename succeeds in the command line but it fails in the client. Without a client that can emit diagnostics (in particular the errno for the rename operation) I don't think anyone can do anything.
Do you think you can compile your own Minetest with this patch applied?