In a multi-threaded/process environnement, the function generating the zip file is called multiple times in parallel, and may try to unlink a file that has already been unlinked by a parallel process. This ends up with a FileNotFoundError exception being raised at the application startup if such a case occurs.
During the route initialization process, the
client_pages
module is loaded to add the route to the client kickstart files.https://github.com/UCL-INGI/ICTV/blob/97c8dcba78d02d55da1422dfce3a69a552811c26/ictv/flask/mapping.py#L7
However, this module also generates the kickstart zip when it is loaded the first time.
https://github.com/UCL-INGI/ICTV/blob/97c8dcba78d02d55da1422dfce3a69a552811c26/ictv/client/pages/client_pages.py#L84
In a multi-threaded/process environnement, the function generating the zip file is called multiple times in parallel, and may try to unlink a file that has already been unlinked by a parallel process. This ends up with a
FileNotFoundError
exception being raised at the application startup if such a case occurs.https://github.com/UCL-INGI/ICTV/blob/97c8dcba78d02d55da1422dfce3a69a552811c26/ictv/client/pages/client_pages.py#L54-L64
Writing the file in parallel should also be avoided in case
ZipFile
does not implement an internal lock/is not threadsafe.