Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Larry Martell Newsgroups: comp.lang.python Subject: Broken pipe from gevent/pywsgi.py Date: Tue, 3 May 2016 16:36:22 -0400 Lines: 71 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de wTN8j2LZRxqXV5JhIoyxEQSUcO6XGige0pz0yNFWhDjg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'broken': 0.03; 'received:209.85.223': 0.03; 'error:': 0.05; "'',": 0.07; 'false,': 0.07; '(1,': 0.09; 'python': 0.10; "skip:' 30": 0.15; "'w'": 0.16; 'googled': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:Broken': 0.16; 'time-out': 0.16; 'skip:{ 20': 0.18; 'try:': 0.18; 'to:name:python-list@python.org': 0.20; 'fix': 0.21; 'gateway': 0.22; 'occurs': 0.22; 'pipe': 0.22; 'pass': 0.22; 'seems': 0.23; 'this:': 0.23; 'import': 0.24; '(most': 0.24; 'requests': 0.25; 'error': 0.27; 'message- id:@mail.gmail.com': 0.27; 'this.': 0.28; "skip:' 10": 0.28; 'workaround': 0.29; 'subject:/': 0.30; 'server.': 0.30; 'skip:s 30': 0.31; 'anyone': 0.32; 'skip:_ 10': 0.32; 'getting': 0.33; 'traceback': 0.33; "skip:' 20": 0.34; 'file': 0.34; 'except': 0.34; 'server': 0.34; 'received:google.com': 0.35; 'skip:" 50': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'mode': 0.36; 'to:addr :python-list': 0.36; 'received:209': 0.38; 'skip:p 20': 0.38; 'why': 0.39; 'does': 0.39; 'subject:from': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'further': 0.62; 'places': 0.64; 'saw': 0.77; 'main:': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=9kuq8tyyVYH7ggNm2T9zz7F/kKa0t5QvqHv2QkpselY=; b=0fJ6JCW8MYoJ9OggrgJiUwbIMINeuCdSYB+ANwq9mrDaTIOVAyBJJHISw3X3+jtqiL cP95ituPqHRSmrF7E0cbgaRbCpIsm53Lx44OK+DA8za8cmm093ZrkDAQ6QzchQsyoNPo cA9/yUG4MlB5UuqXF9WLNtKTuWLLDKtJhZSaZ0sYtwyDhyfd+sWLN6KrbBQTO99Cu8Wt bWPP7uuIjKO2sce9Hw5WO/c/6k0e0t+EyaBj6S1yDmQI414ZnzyWAY2hU/4Ih1hPomH6 dNvSLOPTrG5CYBUo8NYzTqWy0IYdLCza9T+jQ7s4/0Mmh7soOvx6Tr78V9wHGvctzHLp EnfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=9kuq8tyyVYH7ggNm2T9zz7F/kKa0t5QvqHv2QkpselY=; b=SLqAvceg+G+oel9x8J7g4/lXJdQIQyAI+tGqOYhAZBXWdnnNvzcnDO4Ig6ZwfzLaAk sOj4PYjA+f49j0YTwWNEghLqiXR1DDZRzr2O/g8vgXUo/n+S003nGM9PQ0ocdExrrsSy p7ytnswxcj4/nMVCuPZghsS1oBmdSqF+5/aViiZqyR8xaRvea7OLWcpRMBpA5uHM9QaR AinuF6UOfXBV3DV0l6a+qJ5zuXFDZeaiWEh6UZeV7mmRBTwGhKpBIVYoKPVPxN5yxpOF fVg8Cir8I6ryWwi+Pz1/QK6jqH1U4b7tzoMqDTV+hVazyFfy1xz94zeaksSJviFaQtuk CCVA== X-Gm-Message-State: AOPr4FU4ZfgBChHcHb1IEB7QO+w5gB9WuxAe8OR4ZaDAbLb+HU4+Q/vUPnrfbad6sVp0KS8y5+qMBiY6TXLZNQ== X-Received: by 10.107.63.214 with SMTP id m205mr5951647ioa.15.1462307822084; Tue, 03 May 2016 13:37:02 -0700 (PDT) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: Xref: csiph.com comp.lang.python:108097 I have a python server that has this in the main: from gevent import pywsgi try: httpd = pywsgi.WSGIServer(('0.0.0.0', 8000), app) httpd.serve_forever() except KeyboardInterrupt: pass Recently we began getting HTTPError: 504 Server Error: Gateway Time-out on requests to the server. Looking in the logs I saw this: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line 508, in handle_one_response self.run_application() File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line 495, in run_application self.process_result() File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line 486, in process_result self.write(data) File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line 380, in write self._write_with_headers(data) File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line 400, in _write_with_headers self._sendall(towrite) File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line 355, in _sendall self.socket.sendall(data) File "/usr/local/lib/python2.7/dist-packages/gevent/socket.py", line 460, in sendall data_sent += self.send(_get_memory(data, data_sent), flags) File "/usr/local/lib/python2.7/dist-packages/gevent/socket.py", line 437, in send return sock.send(data, flags) error: [Errno 32] Broken pipe {'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': '*/*', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate', 'HTTP_CONNECTION': 'close', 'HTTP_HOST': 'bekku.bbmsc.com', 'HTTP_USER_AGENT': 'python-requests/2.9.1', 'HTTP_X_FORWARDED_FOR': '192.168.10.5', 'HTTP_X_REAL_IP': '192.168.10.5', 'PATH_INFO': '/readings', 'QUERY_STRING': 'target=2225217193085335062&tool=HM', 'REMOTE_ADDR': '172.17.42.1', 'REMOTE_PORT': '41708', 'REQUEST_METHOD': 'GET', 'SCRIPT_NAME': '', 'SERVER_NAME': 'fdffcd119506', 'SERVER_PORT': '8000', 'SERVER_PROTOCOL': 'HTTP/1.0', 'SERVER_SOFTWARE': 'gevent/1.0 Python/2.7', 'wsgi.errors': ', mode 'w' at 0x7f4c299bc1e0>, 'wsgi.input': , 'wsgi.multiprocess': False, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0)} failed with error Once this occurs it seems that no further requests are served. I googled this and found many places where people said this was happening, and many places where people explained why it was happening, but no place did I find a way to fix or workaround this. Does anyone know how to get it to continue processing after this occurs?