Remix.run Logo
NewsaHackO a day ago

>to a raciness in load_json where it's checked for file existence with an if and then carrying on as if the file is certainly there...

Explain the issue with load_json to me more. From my reading it checks if the file exists, then raises an error if it does not. How is that carrying on as if the file is certainly there?

selcuka a day ago | parent [-]

There is a small amount of time between the `if` and the `with` where another process can delete the file, hence causing a race condition. Attempting to open the file and catching any exceptions raised is generally safer.

taberiand a day ago | parent | next [-]

Won't it throw the same "FileNotFound" exception in that case? The issue being bothering to check if it exists in the first place I suppose.

selcuka a day ago | parent [-]

Yes, but it won't log the error as it is clearly the intention of the first check.

NewsaHackO 21 hours ago | parent | prev [-]

OK, that does make sense. Thanks!