Description
The PrimeDesign Docker web app fails during startup with a FileExistsError for /PrimeDesign/reports, causing Gunicorn to shut down.
Steps to reproduce
Run the documented command:
docker run -p 9994:9994 pinellolab/primedesign:latest primedesign_webapp
Expected behavior
The web app starts successfully and is accessible at http://localhost:9994.
Actual behavior
Gunicorn starts four workers, but one fails while creating the reports directory:
File "/PrimeDesign/web_app/app.py", line 36, in <module>
os.makedirs(UPLOAD_DIRECTORY)
FileExistsError: [Errno 17] File exists: '/PrimeDesign/reports'
[INFO] Shutting down: Master
[INFO] Reason: Worker failed to boot.
Likely cause
The directory existence check and creation are separate operations:
if not os.path.exists(UPLOAD_DIRECTORY):
os.makedirs(UPLOAD_DIRECTORY)
Multiple workers can pass the check before any worker creates the directory. A subsequent creation attempt then raises FileExistsError. This makes the failure timing-dependent.
Suggested fix
Replace the check-then-create sequence with:
os.makedirs(UPLOAD_DIRECTORY, exist_ok=True)
This tolerates concurrent directory creation while preserving existing contents. The proposed fix has not yet been tested.
Environment
- Host: macOS
- Docker image:
pinellolab/primedesign:latest
- Gunicorn: 20.1.0
- Python inside the container: 3.8
Description
The PrimeDesign Docker web app fails during startup with a
FileExistsErrorfor/PrimeDesign/reports, causing Gunicorn to shut down.Steps to reproduce
Run the documented command:
Expected behavior
The web app starts successfully and is accessible at http://localhost:9994.
Actual behavior
Gunicorn starts four workers, but one fails while creating the reports directory:
Likely cause
The directory existence check and creation are separate operations:
Multiple workers can pass the check before any worker creates the directory. A subsequent creation attempt then raises
FileExistsError. This makes the failure timing-dependent.Suggested fix
Replace the check-then-create sequence with:
This tolerates concurrent directory creation while preserving existing contents. The proposed fix has not yet been tested.
Environment
pinellolab/primedesign:latest