Comments (7)
Any idea how to fix this? I'm having the same issue...
from foreman.
Not quite sure. Here's another session without using foreman:
(vagrant)vagrant@lucid32:[~]$ python manage.py run_gunicorn &
[1] 1992
(vagrant)vagrant@lucid32:[~]$ Validating models...
[...]
2011-10-21 13:41:38 [1992] [INFO] Starting gunicorn 0.13.1
2011-10-21 13:41:38 [1992] [INFO] Listening at: http://127.0.0.1:8000 (1992)
2011-10-21 13:41:38 [1992] [INFO] Using worker: sync
2011-10-21 13:41:38 [2046] [INFO] Booting worker with pid: 2046
(vagrant)vagrant@lucid32:[~]$ ps aux | grep python
vagrant 1992 5.5 4.7 25596 18052 pts/1 S 05:41 0:00 python manage.py run_gunicorn
vagrant 2046 0.0 3.8 25596 14700 pts/1 S 05:41 0:00 python manage.py run_gunicorn
vagrant 2056 0.0 0.1 2140 744 pts/1 S+ 05:41 0:00 grep --color=auto python
(vagrant)vagrant@lucid32:[~]$ kill -TERM 1992
2011-10-21 13:41:53 [1992] [INFO] Handling signal: term
2011-10-21 13:41:53 [2046] [INFO] Worker exiting (pid: 2046)
2011-10-21 13:41:53 [1992] [INFO] Shutting down: Master
[1]+ Done python manage.py run_gunicorn
(vagrant)vagrant@lucid32:[~]$ ps aux | grep python
vagrant 2082 0.0 0.1 2140 740 pts/1 S+ 05:41 0:00 grep --color=auto python
gunicorn does handle the signal properly.
from foreman.
Thought it might have to do with subprocessing, I did essentially the same foreman does but in python:
(vagrant)vagrant@lucid32:[~]$ ps aux | grep python
vagrant 2406 0.0 0.1 2140 740 pts/0 S+ 05:54 0:00 grep --color=auto python
(vagrant)vagrant@lucid32:[~]$ python
[...]
>>> import subprocess, signal
>>> gu = subprocess.Popen(['python', 'manage.py', 'run_gunicorn'])
[...]
2011-10-21 13:55:32 [2416] [INFO] Starting gunicorn 0.13.1
2011-10-21 13:55:32 [2416] [INFO] Listening at: http://127.0.0.1:8000 (2416)
2011-10-21 13:55:32 [2416] [INFO] Using worker: sync
2011-10-21 13:55:32 [2462] [INFO] Booting worker with pid: 2462
>>>
[1]+ Stopped python
(vagrant)vagrant@lucid32:[~]$ ps aux | grep python
vagrant 2415 0.0 1.1 8472 4496 pts/0 T 05:55 0:00 python
vagrant 2416 4.8 4.7 25616 18052 pts/0 S 05:55 0:00 python manage.py run_gunicorn
vagrant 2462 0.0 3.8 25616 14700 pts/0 S 05:55 0:00 python manage.py run_gunicorn
vagrant 2472 0.0 0.1 2140 744 pts/0 S+ 05:55 0:00 grep --color=auto python
(vagrant)vagrant@lucid32:[~]$ curl -I localhost:8000
HTTP/1.1 302 FOUND
Server: gunicorn/0.13.1
Date: Fri, 21 Oct 2011 12:55:46 GMT
Connection: close
Transfer-Encoding: chunked
Vary: Cookie
Content-Type: text/html; charset=utf-8
Location: http://localhost:8000/login/?next=/
(vagrant)vagrant@lucid32:[~]$ %1
>>> gu.send_signal(signal.SIGTERM)
2011-10-21 13:56:04 [2416] [INFO] Handling signal: term
2011-10-21 13:56:04 [2462] [INFO] Worker exiting (pid: 2462)
2011-10-21 13:56:04 [2416] [INFO] Shutting down: Master
>>> quit()
(vagrant)vagrant@lucid32:[~]$ ps aux | grep python
vagrant 2499 0.0 0.1 2140 740 pts/0 S+ 05:56 0:00 grep --color=auto python
from foreman.
It seems that when not using python manage.py run_gunicorn
but gunicorn_django
instead it behaves correctly.
Procfile:
web: gunicorn_django path/to/settings.py
Update
It seems that foreman shuts down all the processes correctly when not binding to a specific address/port with -b 0.0.0.0:$PORT
. As soon as you're using -b
it won't shut down child processes anymore.
Further update
Binding not with $PORT
but a hardcoded port shuts gunicorn down correctly too:
web: gunicorn_django path/to/settings.py -b 0.0.0.0:12345
from foreman.
ok, great! I already figured it had to do something with the subprocesses, thanks for the help! The workaround works like a charm :)
from foreman.
Rolling into #94
from foreman.
I'm still getting issue with subprocesses not being shut down on my Clojure app with a Ctrl+C sent to the Foreman process.
Here's the contents of my Procfile:
web: lein run -m com.twilio.smsauth.core
Running with foreman start, and then Ctrl+C:
18> foreman start
Invalid gemspec in [/Library/Ruby/Gems/1.8/specifications/heroku-2.13.0.gemspec]: invalid date format in specification: "2011-11-10 00:00:00.000000000Z"
15:50:46 web.1 | started with pid 24972
15:50:55 web.1 | 2011-11-18 15:50:55.977:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
15:50:56 web.1 | #<Server Server@7213f866>
15:50:56 web.1 | 2011-11-18 15:50:55.979:INFO::jetty-6.1.25
15:50:56 web.1 | 2011-11-18 15:50:56.004:INFO::Started [email protected]:5000
^CSIGINT received
15:50:59 system | sending SIGTERM to all processes
There's still a Java process running:
19> ps aux | grep java
kevin 25012 0.0 0.0 2435120 532 s007 R+ 3:51PM 0:00.00 grep -i --color=auto java
kevin 24996 0.0 3.1 2889504 128604 ?? S 3:50PM 0:16.92 /usr/bin/java -cp /Users/kevin/code/smsauth/test:/Users/kevin/code/smsauth/test-resources:/Users/kevin/code/smsauth/src:/Users/kevin/code/smsauth/classes:/Users/kevin/code/smsauth/resources:/Users/kevin/code/smsauth/lib/clj-base64-0.0.0-20100308.145053-2.jar:/Users/kevin/code/smsauth/lib/clj-http-0.2.1.jar:/Users/kevin/code/smsauth/lib/clojure-1.2.1.jar:/Users/kevin/code/smsauth/lib/clojure-contrib-1.2.0.jar:/Users/kevin/code/smsauth/lib/clout-0.4.1.jar:/Users/kevin/code/smsauth/lib/commons-codec-1.5.jar:/Users/kevin/code/smsauth/lib/commons-fileupload-1.2.1.jar:/Users/kevin/code/smsauth/lib/commons-io-1.4.jar:/Users/kevin/code/smsauth/lib/commons-logging-1.1.1.jar:/Users/kevin/code/smsauth/lib/compojure-0.6.5.jar:/Users/kevin/code/smsauth/lib/core.incubator-0.1.0.jar:/Users/kevin/code/smsauth/lib/hiccup-0.3.6.jar:/Users/kevin/code/smsauth/lib/httpclient-4.1.2.jar:/Users/kevin/code/smsauth/lib/httpcore-4.1.2.jar:/Users/kevin/code/smsauth/lib/inflections-0.4.2-20110104.084027-3.jar:/Users/kevin/code/smsauth/lib/java.jdbc-0.1.1.jar:/Users/kevin/code/smsauth/lib/jbcrypt-0.3m.jar:/Users/kevin/code/smsauth/lib/jetty-6.1.25.jar:/Users/kevin/code/smsauth/lib/jetty-util-6.1.25.jar:/Users/kevin/code/smsauth/lib/libphonenumber-3.9.jar:/Users/kevin/code/smsauth/lib/postgresql-9.1-901.jdbc4.jar:/Users/kevin/code/smsauth/lib/ring-basic-authentication-0.0.1.jar:/Users/kevin/code/smsauth/lib/ring-core-0.3.11.jar:/Users/kevin/code/smsauth/lib/ring-jetty-adapter-1.0.0-RC1.jar:/Users/kevin/code/smsauth/lib/ring-servlet-1.0.0-RC1.jar:/Users/kevin/code/smsauth/lib/sandbar-0.4.0-20110601.165758-5.jar:/Users/kevin/code/smsauth/lib/servlet-api-2.5-20081211.jar:/Users/kevin/code/smsauth/lib/servlet-api-2.5.jar:/Users/kevin/code/smsauth/lib/tools.macro-0.1.0.jar -Dclojure.compile.path=/Users/kevin/code/smsauth/classes -Dsmsauth.version=0.1 -Dclojure.debug=false clojure.main -e (do (try (clojure.core/require (quote com.twilio.smsauth.core)) (catch java.io.FileNotFoundException ___3908__auto__)) nil (do (clojure.core/ns leiningen.util.injected) (defn- compose-hooks [f1 f2] (fn [& args] (apply f2 f1 args))) (defn- join-hooks [original hooks] (reduce compose-hooks original hooks)) (defn- run-hooks [hook original args] (apply (join-hooks original (clojure.core/deref hook)) args)) (defn- prepare-for-hooks [v] (when-not (:robert.hooke/hook (meta (clojure.core/deref v))) (let [hook (atom ())] (alter-var-root v (fn [original] (with-meta (fn [& args] (run-hooks hook original args)) (assoc (meta original) :robert.hooke/hook hook :robert.hooke/original original))))))) (defn- add-unless-present [coll f] (if-not (some #{f} coll) (conj coll f) coll)) (defn add-hook "Add a hook function f to target-var. Hook functions are passed the\n target function and all their arguments and must apply the target to\n the args if they wish to continue execution." [target-var f] (prepare-for-hooks target-var) (swap! (:robert.hooke/hook (meta (clojure.core/deref target-var))) add-unless-present f)) (clojure.core/ns user)) (set! *warn-on-reflection* nil) (try (clojure.core/let [v__3906__auto__ (clojure.core/resolve (quote com.twilio.smsauth.core/-main))] (if (clojure.core/ifn? v__3906__auto__) (v__3906__auto__) (clojure.lang.Reflector/invokeStaticMethod "com.twilio.smsauth.core" "main" (clojure.core/into-array [(clojure.core/into-array java.lang.String (quote nil))])))) (finally (clojure.core/when (clojure.core/and false (clojure.core/not= "1.5" (java.lang.System/getProperty "java.specification.version")) true) (clojure.core/shutdown-agents)))))
I tried setting a $PORT in my env, or just letting Foreman choose one, and either one seems to reproduce the error.
I am running 0.26.1. I'm on a Mac, running Snow Leopard. Please let me know what I can do to solve this.
20> gem search foreman
*** LOCAL GEMS ***
foreman (0.26.1)
from foreman.
Related Issues (20)
- Odd error message when you skip the 'start' command and include a -f
- Using RuboCop?
- issue killing subprocesses using `cd` with failure at startup HOT 1
- breakpoint vscode not work to Ruby
- After the foreman finishes, the ruby process continues to exist HOT 2
- Release 1.0? HOT 1
- About link is broken HOT 1
- Foreman does not terminate child process HOT 3
- Forman doesn't show errors and logs of Procfile commands HOT 3
- Change https://ddollar.github.com/foreman to https://ddollar.github.io/foreman on repo description link
- Port 5000 taken by Mac OSX HOT 1
- When launching rails via foreman, rails asset pipeline errors
- Support for x64-mingw-ucrt platform
- Version Optimize
- Document that Foreman secretly sets the PORT environment variable to 5000 HOT 1
- Error after running command "foreman start"
- foreman export systemd raises undefined method `exists?' for File:Class (NoMethodError) HOT 1
- Security CVE-2022-3874 HOT 4
- Usage Error: Unrecognized or legacy configuration settings found
- Ruby32-x64/lib/ruby/gems/3.2.0/gems/foreman-0.87.2/lib/foreman/engine.rb:201:in `kill': Invalid argument (Errno::EINVAL)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from foreman.