How to solve the address issue if I restart an external service inside python with flask? -


i using flask build python web service, example, set flask port 8080 this:

@app.route('/data', methods=['post']) def data_construct():     os.system('sh restart.sh') if __name__ == '__main__':     app.debug = true     app.run(host='0.0.0.0', port=8080) 

and restart.sh used restarting external service, after send http post request /data, restart completed, after while, error:

traceback (most recent call last): file "hello.py", line 87, in <module>    app.run(host='0.0.0.0', port=8080) file "/home/work/.jumbo/lib/python2.7/site-packages/flask/app.py", line 739, in run    run_simple(host, port, self, **options) file "/home/work/.jumbo/lib/python2.7/site-packages/werkzeug/serving.py", line 613, in run_simple    test_socket.bind((hostname, port)) file "/home/work/.jumbo/lib/python2.7/socket.py", line 224, in meth   return getattr(self._sock,name)(*args) socket.error: [errno 98] address in use 

the 'restart.sh' (storage c++-complied program):

killall storage nohup ./storage & 

and find external service starting using port 8080 not supposed (its original port still in use), how solve problem?


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -