Occasional strange behaviour when saving modules

A similar issue to this was brought up at the beginning of the year, namely an error message that pops up when saving a module that in my case says: “java.io.IOException: Unable to overwrite F:\TheSatS_112.vmod: file does not exist. Data written to F:\tmp2759561896270664881.zip instead.”

In answer to the original query you stated that perhaps Java didn’t have permission to write to that folder. However in my case, this doesn’t happen every time I try to save, maybe only 1 in 10 or 20 times does this happen. What could cause the program to sometimes be able to overwrite the old file, while other times not being able to?

Thus spake Gouka:

A similar issue to this was brought up at the beginning of the year,
namely an error message that pops up when saving a module that in my
case says: “java.io.IOException: Unable to overwrite
F:\TheSatS_112.vmod: file does not exist. Data written to
F:\tmp2759561896270664881.zip instead.”

In answer to the original query you stated that perhaps Java didn’t have
permission to write to that folder. However in my case, this doesn’t
happen every time I try to save, maybe only 1 in 10 or 20 times does
this happen. What could cause the program to sometimes be able to
overwrite the old file, while other times not being able to?

The file paths you’re showing suggest that you’re using Windows.

Windows won’t let a file which is already open be opened for writing.
This sounds reasonable at first, but turns out to be a poor design
decision because what files you’re able to open becomes a function of
the whole collection of running programs and thus isn’t predictable.

Tossing in Java, which cleans up resources using garbage collection—
a process which also happens at unpredictable times—makes this
situation worse.

What’s probably happening is that there’s a race between closing the
file you’re trying to write and opening it for writing. Most of the
time closing wins the race and things happen in the correct order, but
occasionally opening the file wins—and that fails becuase the file
is already being held open.


J.