On 25-09-2018 17:01, Roberto De Ioris wrote:
Hello, yes I disabled selinux and firewall before testing. As I said above I can successfully get response when I run my application on flask built-in server or simply running command on command line.I am using CentOS 7 with uwsgi(2.0.17.1), uwsgi-plugin-python2 (2.0.17) and Flask (1.0.2). I have a flask application that runs many shell commands. Some of them hangs indefinitely. I am sharing one of them as an example below, it is easy to reproduce. I am using uwsgi in threaded mode. * #!/usr/bin/python** ** from flask import Flask** ** import subprocess** **** ** app = Flask(__name__)** **** ** @app.route("/test/")** ** def test():** ** print 'state 1'** ** p = subprocess.Popen(['ntpdate', '-u', '0.pool.ntp.org'],close_fds=True)** ** print 'state 2'** ** out, err = p.communicate()** ** print 'state 3'** **** ** print 'output: {}'.format(out)** ** print 'error: {}'.format(err)** ** return 'finish'* uwsgi command: *> \# uwsgi --ini uwsgi.conf --http-socket :8001* uwsgi conf file: * [uwsgi]** ** #virtual env's base folder** ** base = /root/plaground** ** home = /usr/** **** ** #cmd options** ** bin = /usr/sbin/uwsgi** **** ** #python module to import** ** module = app:app** **** ** pythonpath = /root/playground** **** ** catch-exceptions = true** **** ** plugins-dir = /usr/lib64/uwsgi/** ** plugins = python** **** ** need-app = true** **** ** master = true** ** threads = 10* After starting uwsgi, first request to /test route completes succesfully, Second one stucking on command line execution and holds response forever. The first call output: *state 1** ** state 2** ** 21 Sep 16:02:48 ntpdate[19943]: adjust time server 78.46.53.11 offset -0.000224 sec** ** state 3** ** output: None** ** error: None* The second call output: *state 1** ** state 2*Hi, from the strace output it looks like the spawned process is blocked waiting for network data. Are you sure you do not have something like selinux (or at firewall level) that is blocking traffic ?
_______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
