Flask to uwsgi threading get stuckNginx+uWsgi+Flask cannot setup successImportError: No module named flask - uwsgi and buildoutWhy is Upstart not starting uWSGI?Pyramid + Nginx + uWSGI Server 500 Errorsuwsgi + nginx + flask: upstream prematurely closed after file is downloaded502 bad gateway nginx. uwsgi, flaskNGINX + uWSGI + Flask. Some requests very slowConfigure basic python 3.5, flask, uwsgi, nginx appNginx and uWSGI Flask app Connection RefusedNginx uWSGI server setup fro flask: Error starting service
Did the CIA blow up a Siberian pipeline in 1982?
What did River say when she woke from her proto-comatose state?
How to find the last non zero element in every column throughout dataframe?
Why does Linux list NVMe drives as /dev/nvme0 instead of /dev/sda?
How does the spell Remove Curse interact with a Sword of Vengeance?
What was the Shuttle Carrier Aircraft escape tunnel?
Can humans ever directly see a few photons at a time? Can a human see a single photon?
Has there been any indication at all that further negotiation between the UK and EU is possible?
Greeting with "Ho"
Is a single radon-daughter atom in air a solid?
What exactly is the 'online' in OLAP and OLTP?
Explain why a line can never intersect a plane in exactly two points.
What does "play with your toy’s toys" mean?
How to remove this component from PCB
Why is prior to creation called holy?
Is "Busen" just the area between the breasts?
How do I professionally let my manager know I'll quit over smoking in the office?
What can I do with a research project that is my university’s intellectual property?
Do I have to explain the mechanical superiority of the player-character within the fiction of the game?
What's the difference between a deep fryer and a chip pan?
Java TreeMap.floorKey() equivalent for std::map
How many children?
Does having had a visa for a country mean I used to be a citizen/national of that country?
How does a blind passenger not die, if driver becomes unconscious
Flask to uwsgi threading get stuck
Nginx+uWsgi+Flask cannot setup successImportError: No module named flask - uwsgi and buildoutWhy is Upstart not starting uWSGI?Pyramid + Nginx + uWSGI Server 500 Errorsuwsgi + nginx + flask: upstream prematurely closed after file is downloaded502 bad gateway nginx. uwsgi, flaskNGINX + uWSGI + Flask. Some requests very slowConfigure basic python 3.5, flask, uwsgi, nginx appNginx and uWSGI Flask app Connection RefusedNginx uWSGI server setup fro flask: Error starting service
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
im Using Python 3.7.3, uwsgi 2.0.18, (docker container image python:3-stretch)
We have development environment where we are running our code on flask and we change it to uwsgi when we test it on production.
Im running a py script which get live-stream pcm audio from redis (another container)
Now, when we run it on flask all works fine! when we run it on uwsgi threads gets stuck and die.
uwsgi settings :
[uwsgi]
http = :5000
socket = :3031
wsgi-env-behaviour=holy
master=1
uid=1000
gid=2000
master=1
processes = 1
threads = 1
protocol = uwsgi
wsgi-file = server.py
chdir = /app/base/
callable = app
http-raw-body
single-interpreter
paste-logger = true
honour-stdin
#logto = /tmp/errlog
vacuum = true
harakiri-verbose = true
harakiri = 60
cpu-affinity =3
http-timeout = 60
optimize = 2
http-keepalive
listen=30
workers = 40
ugreen
reaper
start_response-nodelay
greenlet
logs :
HARAKIRI: -- wchan> 0
Wed Jun 5 15:55:48 2019 - HARAKIRI !!! worker 24 status !!!
Wed Jun 5 15:55:48 2019 - HARAKIRI [core 0] XX.XX.XX.XX- GET /pcm_json since 1559750087
Wed Jun 5 15:55:48 2019 - HARAKIRI !!! end of worker 24 status !!!
Wed Jun 5 15:55:48 2019 - *** HARAKIRI ON WORKER 27 (pid: 32, try: 1) ***
DAMN ! worker 10 (pid: 15) died, killed by signal 9 :( trying respawn ...
Respawned uWSGI worker 10 (new pid: 64)
whats the major difference between flask and uwsgi regarding post and get requests ?
After googlins 2 days in a row no matter how much i have changed the settings nothing helps, i have tried all things suggested.
we are considering moving to gunicorn..
Thanks.
EDIT:
this is the code sendind request :
conn = http.client.HTTPConnection(server, port)
headers = "ID": ID, "debugLevel": 1, "Multipart": 1, "Audio": 1, "Accept": "application/json" conn.request("GET", "/pcm", "", headers)
ret = conn.getresponse()
this is another error i see in cli
Unhandled exception in thread started by <function get_pcm>
python uwsgi flask
add a comment |
im Using Python 3.7.3, uwsgi 2.0.18, (docker container image python:3-stretch)
We have development environment where we are running our code on flask and we change it to uwsgi when we test it on production.
Im running a py script which get live-stream pcm audio from redis (another container)
Now, when we run it on flask all works fine! when we run it on uwsgi threads gets stuck and die.
uwsgi settings :
[uwsgi]
http = :5000
socket = :3031
wsgi-env-behaviour=holy
master=1
uid=1000
gid=2000
master=1
processes = 1
threads = 1
protocol = uwsgi
wsgi-file = server.py
chdir = /app/base/
callable = app
http-raw-body
single-interpreter
paste-logger = true
honour-stdin
#logto = /tmp/errlog
vacuum = true
harakiri-verbose = true
harakiri = 60
cpu-affinity =3
http-timeout = 60
optimize = 2
http-keepalive
listen=30
workers = 40
ugreen
reaper
start_response-nodelay
greenlet
logs :
HARAKIRI: -- wchan> 0
Wed Jun 5 15:55:48 2019 - HARAKIRI !!! worker 24 status !!!
Wed Jun 5 15:55:48 2019 - HARAKIRI [core 0] XX.XX.XX.XX- GET /pcm_json since 1559750087
Wed Jun 5 15:55:48 2019 - HARAKIRI !!! end of worker 24 status !!!
Wed Jun 5 15:55:48 2019 - *** HARAKIRI ON WORKER 27 (pid: 32, try: 1) ***
DAMN ! worker 10 (pid: 15) died, killed by signal 9 :( trying respawn ...
Respawned uWSGI worker 10 (new pid: 64)
whats the major difference between flask and uwsgi regarding post and get requests ?
After googlins 2 days in a row no matter how much i have changed the settings nothing helps, i have tried all things suggested.
we are considering moving to gunicorn..
Thanks.
EDIT:
this is the code sendind request :
conn = http.client.HTTPConnection(server, port)
headers = "ID": ID, "debugLevel": 1, "Multipart": 1, "Audio": 1, "Accept": "application/json" conn.request("GET", "/pcm", "", headers)
ret = conn.getresponse()
this is another error i see in cli
Unhandled exception in thread started by <function get_pcm>
python uwsgi flask
Could you include an example request?
– Lucas Ramage
Jun 5 at 16:37
You should look at where in your code do your threads get stuck?
– Michael Hampton♦
Jun 5 at 17:43
@LucasRamage the request in the code looks like this : conn = http.client.HTTPConnection(server, port) headers = "ID": ID, "debugLevel": 1, "Multipart": 1, "Audio": 1, "Accept": "application/json" conn.request("GET", "/pcm", "", headers) ret = conn.getresponse()
– Batchen Regev
Jun 6 at 5:35
@MichaelHampton yes but in flask it does not happens. only in uwsgi thats why i want to know the diff between flask and uwsgi. if you have a suggestion on how to see where it is stuck please let me know (im new to python)
– Batchen Regev
Jun 6 at 5:38
@BatchenRegev, I meant the actual request/response, like in postman or a proxy tool.
– Lucas Ramage
Jun 6 at 12:39
add a comment |
im Using Python 3.7.3, uwsgi 2.0.18, (docker container image python:3-stretch)
We have development environment where we are running our code on flask and we change it to uwsgi when we test it on production.
Im running a py script which get live-stream pcm audio from redis (another container)
Now, when we run it on flask all works fine! when we run it on uwsgi threads gets stuck and die.
uwsgi settings :
[uwsgi]
http = :5000
socket = :3031
wsgi-env-behaviour=holy
master=1
uid=1000
gid=2000
master=1
processes = 1
threads = 1
protocol = uwsgi
wsgi-file = server.py
chdir = /app/base/
callable = app
http-raw-body
single-interpreter
paste-logger = true
honour-stdin
#logto = /tmp/errlog
vacuum = true
harakiri-verbose = true
harakiri = 60
cpu-affinity =3
http-timeout = 60
optimize = 2
http-keepalive
listen=30
workers = 40
ugreen
reaper
start_response-nodelay
greenlet
logs :
HARAKIRI: -- wchan> 0
Wed Jun 5 15:55:48 2019 - HARAKIRI !!! worker 24 status !!!
Wed Jun 5 15:55:48 2019 - HARAKIRI [core 0] XX.XX.XX.XX- GET /pcm_json since 1559750087
Wed Jun 5 15:55:48 2019 - HARAKIRI !!! end of worker 24 status !!!
Wed Jun 5 15:55:48 2019 - *** HARAKIRI ON WORKER 27 (pid: 32, try: 1) ***
DAMN ! worker 10 (pid: 15) died, killed by signal 9 :( trying respawn ...
Respawned uWSGI worker 10 (new pid: 64)
whats the major difference between flask and uwsgi regarding post and get requests ?
After googlins 2 days in a row no matter how much i have changed the settings nothing helps, i have tried all things suggested.
we are considering moving to gunicorn..
Thanks.
EDIT:
this is the code sendind request :
conn = http.client.HTTPConnection(server, port)
headers = "ID": ID, "debugLevel": 1, "Multipart": 1, "Audio": 1, "Accept": "application/json" conn.request("GET", "/pcm", "", headers)
ret = conn.getresponse()
this is another error i see in cli
Unhandled exception in thread started by <function get_pcm>
python uwsgi flask
im Using Python 3.7.3, uwsgi 2.0.18, (docker container image python:3-stretch)
We have development environment where we are running our code on flask and we change it to uwsgi when we test it on production.
Im running a py script which get live-stream pcm audio from redis (another container)
Now, when we run it on flask all works fine! when we run it on uwsgi threads gets stuck and die.
uwsgi settings :
[uwsgi]
http = :5000
socket = :3031
wsgi-env-behaviour=holy
master=1
uid=1000
gid=2000
master=1
processes = 1
threads = 1
protocol = uwsgi
wsgi-file = server.py
chdir = /app/base/
callable = app
http-raw-body
single-interpreter
paste-logger = true
honour-stdin
#logto = /tmp/errlog
vacuum = true
harakiri-verbose = true
harakiri = 60
cpu-affinity =3
http-timeout = 60
optimize = 2
http-keepalive
listen=30
workers = 40
ugreen
reaper
start_response-nodelay
greenlet
logs :
HARAKIRI: -- wchan> 0
Wed Jun 5 15:55:48 2019 - HARAKIRI !!! worker 24 status !!!
Wed Jun 5 15:55:48 2019 - HARAKIRI [core 0] XX.XX.XX.XX- GET /pcm_json since 1559750087
Wed Jun 5 15:55:48 2019 - HARAKIRI !!! end of worker 24 status !!!
Wed Jun 5 15:55:48 2019 - *** HARAKIRI ON WORKER 27 (pid: 32, try: 1) ***
DAMN ! worker 10 (pid: 15) died, killed by signal 9 :( trying respawn ...
Respawned uWSGI worker 10 (new pid: 64)
whats the major difference between flask and uwsgi regarding post and get requests ?
After googlins 2 days in a row no matter how much i have changed the settings nothing helps, i have tried all things suggested.
we are considering moving to gunicorn..
Thanks.
EDIT:
this is the code sendind request :
conn = http.client.HTTPConnection(server, port)
headers = "ID": ID, "debugLevel": 1, "Multipart": 1, "Audio": 1, "Accept": "application/json" conn.request("GET", "/pcm", "", headers)
ret = conn.getresponse()
this is another error i see in cli
Unhandled exception in thread started by <function get_pcm>
python uwsgi flask
python uwsgi flask
edited Jun 6 at 7:16
Batchen Regev
asked Jun 5 at 16:06
Batchen RegevBatchen Regev
64
64
Could you include an example request?
– Lucas Ramage
Jun 5 at 16:37
You should look at where in your code do your threads get stuck?
– Michael Hampton♦
Jun 5 at 17:43
@LucasRamage the request in the code looks like this : conn = http.client.HTTPConnection(server, port) headers = "ID": ID, "debugLevel": 1, "Multipart": 1, "Audio": 1, "Accept": "application/json" conn.request("GET", "/pcm", "", headers) ret = conn.getresponse()
– Batchen Regev
Jun 6 at 5:35
@MichaelHampton yes but in flask it does not happens. only in uwsgi thats why i want to know the diff between flask and uwsgi. if you have a suggestion on how to see where it is stuck please let me know (im new to python)
– Batchen Regev
Jun 6 at 5:38
@BatchenRegev, I meant the actual request/response, like in postman or a proxy tool.
– Lucas Ramage
Jun 6 at 12:39
add a comment |
Could you include an example request?
– Lucas Ramage
Jun 5 at 16:37
You should look at where in your code do your threads get stuck?
– Michael Hampton♦
Jun 5 at 17:43
@LucasRamage the request in the code looks like this : conn = http.client.HTTPConnection(server, port) headers = "ID": ID, "debugLevel": 1, "Multipart": 1, "Audio": 1, "Accept": "application/json" conn.request("GET", "/pcm", "", headers) ret = conn.getresponse()
– Batchen Regev
Jun 6 at 5:35
@MichaelHampton yes but in flask it does not happens. only in uwsgi thats why i want to know the diff between flask and uwsgi. if you have a suggestion on how to see where it is stuck please let me know (im new to python)
– Batchen Regev
Jun 6 at 5:38
@BatchenRegev, I meant the actual request/response, like in postman or a proxy tool.
– Lucas Ramage
Jun 6 at 12:39
Could you include an example request?
– Lucas Ramage
Jun 5 at 16:37
Could you include an example request?
– Lucas Ramage
Jun 5 at 16:37
You should look at where in your code do your threads get stuck?
– Michael Hampton♦
Jun 5 at 17:43
You should look at where in your code do your threads get stuck?
– Michael Hampton♦
Jun 5 at 17:43
@LucasRamage the request in the code looks like this : conn = http.client.HTTPConnection(server, port) headers = "ID": ID, "debugLevel": 1, "Multipart": 1, "Audio": 1, "Accept": "application/json" conn.request("GET", "/pcm", "", headers) ret = conn.getresponse()
– Batchen Regev
Jun 6 at 5:35
@LucasRamage the request in the code looks like this : conn = http.client.HTTPConnection(server, port) headers = "ID": ID, "debugLevel": 1, "Multipart": 1, "Audio": 1, "Accept": "application/json" conn.request("GET", "/pcm", "", headers) ret = conn.getresponse()
– Batchen Regev
Jun 6 at 5:35
@MichaelHampton yes but in flask it does not happens. only in uwsgi thats why i want to know the diff between flask and uwsgi. if you have a suggestion on how to see where it is stuck please let me know (im new to python)
– Batchen Regev
Jun 6 at 5:38
@MichaelHampton yes but in flask it does not happens. only in uwsgi thats why i want to know the diff between flask and uwsgi. if you have a suggestion on how to see where it is stuck please let me know (im new to python)
– Batchen Regev
Jun 6 at 5:38
@BatchenRegev, I meant the actual request/response, like in postman or a proxy tool.
– Lucas Ramage
Jun 6 at 12:39
@BatchenRegev, I meant the actual request/response, like in postman or a proxy tool.
– Lucas Ramage
Jun 6 at 12:39
add a comment |
1 Answer
1
active
oldest
votes
So, i figured what made the uwsgi workers crash :
" harakiri = 60"
in my uwsgi.ini conf , because our workers connection is for long time ( giving livestream) i guess harakiri thought it was overload or taking to much time so after 60 sec it would crash it.
for our server - multi-connection and livestream this settings works :
[uwsgi]
http = :5000
socket = :3031
wsgi-env-behaviour=holy
master=1
uid=1000
gid=2000
master=1
threads = 4
protocol = uwsgi
wsgi-file = machine.py
chdir = /app
callable = app
http-raw-body
single-interpreter
paste-logger = true
honour-stdin
cpu-affinity =3
http-timeout = 60
optimize = 2
http-keepalive
listen=30
workers = 80
ugreen
reaper
start_response-nodelay
greenlet
offload-threads = 10
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f970252%2fflask-to-uwsgi-threading-get-stuck%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
So, i figured what made the uwsgi workers crash :
" harakiri = 60"
in my uwsgi.ini conf , because our workers connection is for long time ( giving livestream) i guess harakiri thought it was overload or taking to much time so after 60 sec it would crash it.
for our server - multi-connection and livestream this settings works :
[uwsgi]
http = :5000
socket = :3031
wsgi-env-behaviour=holy
master=1
uid=1000
gid=2000
master=1
threads = 4
protocol = uwsgi
wsgi-file = machine.py
chdir = /app
callable = app
http-raw-body
single-interpreter
paste-logger = true
honour-stdin
cpu-affinity =3
http-timeout = 60
optimize = 2
http-keepalive
listen=30
workers = 80
ugreen
reaper
start_response-nodelay
greenlet
offload-threads = 10
add a comment |
So, i figured what made the uwsgi workers crash :
" harakiri = 60"
in my uwsgi.ini conf , because our workers connection is for long time ( giving livestream) i guess harakiri thought it was overload or taking to much time so after 60 sec it would crash it.
for our server - multi-connection and livestream this settings works :
[uwsgi]
http = :5000
socket = :3031
wsgi-env-behaviour=holy
master=1
uid=1000
gid=2000
master=1
threads = 4
protocol = uwsgi
wsgi-file = machine.py
chdir = /app
callable = app
http-raw-body
single-interpreter
paste-logger = true
honour-stdin
cpu-affinity =3
http-timeout = 60
optimize = 2
http-keepalive
listen=30
workers = 80
ugreen
reaper
start_response-nodelay
greenlet
offload-threads = 10
add a comment |
So, i figured what made the uwsgi workers crash :
" harakiri = 60"
in my uwsgi.ini conf , because our workers connection is for long time ( giving livestream) i guess harakiri thought it was overload or taking to much time so after 60 sec it would crash it.
for our server - multi-connection and livestream this settings works :
[uwsgi]
http = :5000
socket = :3031
wsgi-env-behaviour=holy
master=1
uid=1000
gid=2000
master=1
threads = 4
protocol = uwsgi
wsgi-file = machine.py
chdir = /app
callable = app
http-raw-body
single-interpreter
paste-logger = true
honour-stdin
cpu-affinity =3
http-timeout = 60
optimize = 2
http-keepalive
listen=30
workers = 80
ugreen
reaper
start_response-nodelay
greenlet
offload-threads = 10
So, i figured what made the uwsgi workers crash :
" harakiri = 60"
in my uwsgi.ini conf , because our workers connection is for long time ( giving livestream) i guess harakiri thought it was overload or taking to much time so after 60 sec it would crash it.
for our server - multi-connection and livestream this settings works :
[uwsgi]
http = :5000
socket = :3031
wsgi-env-behaviour=holy
master=1
uid=1000
gid=2000
master=1
threads = 4
protocol = uwsgi
wsgi-file = machine.py
chdir = /app
callable = app
http-raw-body
single-interpreter
paste-logger = true
honour-stdin
cpu-affinity =3
http-timeout = 60
optimize = 2
http-keepalive
listen=30
workers = 80
ugreen
reaper
start_response-nodelay
greenlet
offload-threads = 10
answered 2 days ago
Batchen RegevBatchen Regev
64
64
add a comment |
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f970252%2fflask-to-uwsgi-threading-get-stuck%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Could you include an example request?
– Lucas Ramage
Jun 5 at 16:37
You should look at where in your code do your threads get stuck?
– Michael Hampton♦
Jun 5 at 17:43
@LucasRamage the request in the code looks like this : conn = http.client.HTTPConnection(server, port) headers = "ID": ID, "debugLevel": 1, "Multipart": 1, "Audio": 1, "Accept": "application/json" conn.request("GET", "/pcm", "", headers) ret = conn.getresponse()
– Batchen Regev
Jun 6 at 5:35
@MichaelHampton yes but in flask it does not happens. only in uwsgi thats why i want to know the diff between flask and uwsgi. if you have a suggestion on how to see where it is stuck please let me know (im new to python)
– Batchen Regev
Jun 6 at 5:38
@BatchenRegev, I meant the actual request/response, like in postman or a proxy tool.
– Lucas Ramage
Jun 6 at 12:39