Flask on request

Recently, I am developing a flash drive / api application for Windows Server and have seen some strange problems.

When someone makes a request to a URL, sometimes (for example, 3-4 out of 10 times) it will hang. All I have to do to execute this request is go to the command line, where I start the Flask server and send an interrupt signal. (I'm on the windows, so basically "Ctrl + C"). I searched Google for a while, but I believe that none of the solutions apply. Here is what I tried:

  • add threaded=true to app.run() , as suggested here , doesn't work.
  • In this link , the author mentioned that some browsers can simultaneously run multiple requests and confuse the server. This probably doesn't apply here, since I tried to make a request from the python requests library and still see the server freezes.
  • Using Gevent or Tornado to serve the application, as stated in here , also does not work.
  • Tried on both python 3 and python 2.7, had the same problem.

I have almost the same setup on my local machine (win7 64bit) and everything just works fine. (The server that has the problem is Windows Server 2012)

I would like to share some code, but I doubt very much that this will be a problem with the code, as it works fine in place.

Has anyone experienced the same thing before?

+6
source share
2 answers

After checking with a colleague (I think I should have done this before ..), it seems that the command line tool itself is a problem ... (I can’t believe it). After it was configured to run as a scheduled Windows task, it made several hundred requests and did not experience any problems.

+4
source

Can you tell me the steps that you sent the command line tool as a scheduled Windows task. Faced with the same problem with the WSGI server flask on a Windows Server computer. The flash API has crashed so many times. Only for request 500 with an interval of 2 seconds, as verified.

0
source

Source: https://habr.com/ru/post/985821/


All Articles