error, after the fly deploy command, please help

2022-10-11T13:18:59Z [info][2022-10-11 13:18:59 +0000] [520] [INFO] Starting gunicorn 20.1.0
2022-10-11T13:18:59Z [info][2022-10-11 13:18:59 +0000] [520] [INFO] Listening at: http://0.0.0.0:8080 (520)
2022-10-11T13:18:59Z [info][2022-10-11 13:18:59 +0000] [520] [INFO] Using worker: sync
2022-10-11T13:18:59Z [info][2022-10-11 13:18:59 +0000] [538] [INFO] Booting worker with pid: 538
2022-10-11T13:18:59Z [info][2022-10-11 13:18:59 +0000] [538] [ERROR] Exception in worker process
2022-10-11T13:18:59Z [info]Traceback (most recent call last):
2022-10-11T13:18:59Z [info] File “/layers/paketo-buildpacks_pip-install/packages/lib/python3.10/site-packages/gunicorn/arbiter.py”, line 589, in spawn_worker
2022-10-11T13:18:59Z [info] worker.init_process()
2022-10-11T13:18:59Z [info] File “/layers/paketo-buildpacks_pip-install/packages/lib/python3.10/site-packages/gunicorn/workers/base.py”, line 134, in init_process
2022-10-11T13:18:59Z [info] self.load_wsgi()
2022-10-11T13:18:59Z [info] File “/layers/paketo-buildpacks_pip-install/packages/lib/python3.10/site-packages/gunicorn/workers/base.py”, line 146, in load_wsgi
2022-10-11T13:18:59Z [info] self.wsgi = self.app.wsgi()
2022-10-11T13:18:59Z [info] File “/layers/paketo-buildpacks_pip-install/packages/lib/python3.10/site-packages/gunicorn/app/base.py”, line 67, in wsgi
2022-10-11T13:18:59Z [info] self.callable = self.load()
2022-10-11T13:18:59Z [info] File “/layers/paketo-buildpacks_pip-install/packages/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py”, line 58, in load
2022-10-11T13:18:59Z [info] return self.load_wsgiapp()
2022-10-11T13:18:59Z [info] File “/layers/paketo-buildpacks_pip-install/packages/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py”, line 48, in load_wsgiapp
2022-10-11T13:18:59Z [info] return util.import_app(self.app_uri)
2022-10-11T13:18:59Z [info] File “/layers/paketo-buildpacks_pip-install/packages/lib/python3.10/site-packages/gunicorn/util.py”, line 359, in import_app
2022-10-11T13:18:59Z [info] mod = importlib.import_module(module)
2022-10-11T13:18:59Z [info] File “/layers/paketo-buildpacks_cpython/cpython/lib/python3.10/importlib/init.py”, line 126, in import_module
2022-10-11T13:18:59Z [info] return _bootstrap._gcd_import(name[level:], package, level)
2022-10-11T13:18:59Z [info] File “”, line 1050, in _gcd_import
2022-10-11T13:18:59Z [info] File “”, line 1027, in _find_and_load
2022-10-11T13:18:59Z [info] File “”, line 1004, in _find_and_load_unlocked
2022-10-11T13:18:59Z [info]ModuleNotFoundError: No module named ‘server’
2022-10-11T13:18:59Z [info][2022-10-11 13:18:59 +0000] [538] [INFO] Worker exiting (pid: 538)
2022-10-11T13:18:59Z [info][2022-10-11 13:18:59 +0000] [520] [INFO] Shutting down: Master
2022-10-11T13:18:59Z [info][2022-10-11 13:18:59 +0000] [520] [INFO] Reason: Worker failed to boot.
2022-10-11T13:18:59Z [info]Starting clean up.
→ v0 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v1

→ Troubleshooting guide at Troubleshooting your Deployment · Fly Docs
Error abort

(venv) masha@hugenb:~/eric/test/test$

I am having the exact same issue. I tried building the default python test app you have in your docs, and the only diversion I took from the instructions was to provision a Postgres instance during the flyctl launch step.

I’ve tried deploying twice with the same result:

image: registry.fly.io/python-hellofly-flask:deployment-01GGTYQEZ8JBZYPJNDVJ0SDFT5
image size: 307 MB
==> Creating release
--> release v1 created

--> You can detach the terminal anytime without stopping the deployment
==> Monitoring deployment

 1 desired, 1 placed, 0 healthy, 1 unhealthy [restarts: 2] [health checks: 1 total]
Failed Instances

Failure #1

Instance
ID      	PROCESS	VERSION	REGION	DESIRED	STATUS	HEALTH CHECKS	RESTARTS	CREATED
1fd00d0d	app    	1      	sjc   	run    	failed	1 total      	2       	30s ago

Recent Events
TIMESTAMP           	TYPE           	MESSAGE
2022-11-02T01:19:24Z	Received       	Task received by client
2022-11-02T01:19:24Z	Task Setup     	Building Task Directory
2022-11-02T01:19:34Z	Started        	Task started by client
2022-11-02T01:19:38Z	Terminated     	Exit Code: 3
2022-11-02T01:19:38Z	Restarting     	Task restarting in 1.046223529s
2022-11-02T01:19:45Z	Started        	Task started by client
2022-11-02T01:19:49Z	Terminated     	Exit Code: 3
2022-11-02T01:19:49Z	Restarting     	Task restarting in 1.142814494s
2022-11-02T01:19:56Z	Started        	Task started by client
2022-11-02T01:20:00Z	Terminated     	Exit Code: 3
2022-11-02T01:20:00Z	Not Restarting 	Exceeded allowed attempts 2 in interval 5m0s and mode is "fail"
2022-11-02T01:20:00Z	Alloc Unhealthy	Unhealthy because of failed task
2022-11-02T01:20:00Z	Killing        	Sent interrupt. Waiting 5s before force killing

2022-11-02T01:19:57Z   [info][2022-11-02 01:19:57 +0000] [520] [INFO] Starting gunicorn 20.1.0
2022-11-02T01:19:57Z   [info][2022-11-02 01:19:57 +0000] [520] [INFO] Listening at: http://0.0.0.0:8080 (520)
2022-11-02T01:19:57Z   [info][2022-11-02 01:19:57 +0000] [520] [INFO] Using worker: sync
2022-11-02T01:19:57Z   [info][2022-11-02 01:19:57 +0000] [538] [INFO] Booting worker with pid: 538
2022-11-02T01:19:57Z   [info][2022-11-02 01:19:57 +0000] [538] [ERROR] Exception in worker process
2022-11-02T01:19:57Z   [info]Traceback (most recent call last):
2022-11-02T01:19:57Z   [info]  File "/layers/paketo-buildpacks_pip-install/packages/lib/python3.10/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2022-11-02T01:19:57Z   [info]    worker.init_process()
2022-11-02T01:19:57Z   [info]  File "/layers/paketo-buildpacks_pip-install/packages/lib/python3.10/site-packages/gunicorn/workers/base.py", line 134, in init_process
2022-11-02T01:19:57Z   [info]    self.load_wsgi()
2022-11-02T01:19:57Z   [info]  File "/layers/paketo-buildpacks_pip-install/packages/lib/python3.10/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2022-11-02T01:19:57Z   [info]    self.wsgi = self.app.wsgi()
2022-11-02T01:19:57Z   [info]  File "/layers/paketo-buildpacks_pip-install/packages/lib/python3.10/site-packages/gunicorn/app/base.py", line 67, in wsgi
2022-11-02T01:19:57Z   [info]    self.callable = self.load()
2022-11-02T01:19:57Z   [info]  File "/layers/paketo-buildpacks_pip-install/packages/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2022-11-02T01:19:57Z   [info]    return self.load_wsgiapp()
2022-11-02T01:19:57Z   [info]  File "/layers/paketo-buildpacks_pip-install/packages/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2022-11-02T01:19:57Z   [info]    return util.import_app(self.app_uri)
2022-11-02T01:19:57Z   [info]  File "/layers/paketo-buildpacks_pip-install/packages/lib/python3.10/site-packages/gunicorn/util.py", line 359, in import_app
2022-11-02T01:19:57Z   [info]    mod = importlib.import_module(module)
2022-11-02T01:19:57Z   [info]  File "/layers/paketo-buildpacks_cpython/cpython/lib/python3.10/importlib/__init__.py", line 126, in import_module
2022-11-02T01:19:57Z   [info]    return _bootstrap._gcd_import(name[level:], package, level)
2022-11-02T01:19:57Z   [info]  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
2022-11-02T01:19:57Z   [info]  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
2022-11-02T01:19:57Z   [info]  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
2022-11-02T01:19:57Z   [info]ModuleNotFoundError: No module named 'server'
2022-11-02T01:19:57Z   [info][2022-11-02 01:19:57 +0000] [538] [INFO] Worker exiting (pid: 538)
2022-11-02T01:19:57Z   [info][2022-11-02 01:19:57 +0000] [520] [INFO] Shutting down: Master
2022-11-02T01:19:57Z   [info][2022-11-02 01:19:57 +0000] [520] [INFO] Reason: Worker failed to boot.
2022-11-02T01:19:58Z   [info]Starting clean up.
--> v1 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v2

--> Troubleshooting guide at https://fly.io/docs/getting-started/troubleshooting/
Error abort

Hey, it looks like there might be an issue with the procfile, from this ModuleNotFoundError: No module named ‘server’. Check that the procfile has this line web: gunicorn hellofly:app, it should be hellofly:app instead of server:app (which I’m guessing is the issue).

Another possibility to troubleshoot would be to change the builder in your fly.toml to heroku/buildpacks:18. In general, buildpacks can be a bit finicky and a more reliable solution would be to create a specific dockerfile for the project and build locally instead of relying on the remote builder.

I tried the solution suggested above by edting this in the Procfile serverhellofly since I also received the same error in the original post. I noticed after the error that it created an extra application:

# fly ls apps
 NAME                       | STATUS   | ORG      | DEPLOYED       
-----------------------------*----------*----------*---------------- 
...
  fly-builder-rough-sky-4968 | deployed | personal |                
  misty-field-8977           | dead     | personal | 9 minutes ago

the ‘fly-builder-rough-sky-4968’ is the extra unexpected app while ‘mist-field-8977’ is what I was expecting and what is in my fly.toml:

app = "misty-field-8977"

Procfile:

# Modify this Procfile to fit your needs
web: gunicorn server:app

I changed the Procfile to:

# Modify this Procfile to fit your needs
web: gunicorn hellofly:app

Then I deleted the extra app

# fly destroy fly-builder-rough-sky-4968

and tried to deploy again:

# fly deploy

It worked, but again created an extra app:

# fly ls apps

  NAME                           | STATUS   | ORG      | DEPLOYED       
---------------------------------*----------*----------*----------------
...  
  fly-builder-quiet-firefly-2392 | deployed | personal |                
  misty-field-8977               | running  | personal | 7 minutes ago  

I ran this example app yesterday with no issues nor an extra app being created.

-Jon

Ah, yes. So that app misty-field-8977 is the remote builder that we use to build your docker image. It runs when you make a new deploy and dies after a time on inactivity. If you don’t want that app to exist, you’d need to create a docker file and build a docker image locally and run fly deploy --local-only

Don’t you mean that the fly-builder-quiet-firefly-2392 is the remote builder? I ran into the issue when fly deploy prompted me, asking if I wanted to overwrite the Procfile. I figured it knew what it was doing so I said yes and it replaced ‘hellofly’ with ‘server’ which I believe should be the name of the file (minus the ‘.py’ extension) of the flask app. I made pull request to the documentation adding this note in case y’all are interested. Thanks!

1 Like

Ah yes, my bad. Thanks for the PR!

You bet!