Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Logging exceptions prevent responses on App Engine with Flask #816

Closed
@brianmhunt

Description

@brianmhunt

I have what I expect is the quintessential setup with Google App Engine + Flask + Raven, so I would expect this to be a common problem.

The issue is that when one calls e.g. logging.error with Raven capturing logging the Flask endpoint never completes. It just hangs. Example for reproduction is below.

I did a little debugging and Flask, for its part, seems to finish its wsgi_app requests as expected, so the problem seems to be with Google App Engine.

I am running OS X 10.11.6, App Engine 1.9.38 development app server via homebrew.

Steps to reproduce (minimum working example)

  1. mkdir ae-sentry
  2. cd ae-sentry
  3. virtualenv pyve
  4. ./pyve/bin/pip install raven[flask]

Then create:

appengine_config.py

from os import path
from google.appengine.ext import vendor
vendor.add(path.abspath(path.join(path.dirname(__file__), 'pyve')))

app.yaml

application: dummy
version: test
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /.*
  script: app.app

libraries:
- name: ssl
  version: latest

app.py

import sys
import logging

sys.path.insert(0, 'pyve')

from flask import Flask, make_response
from raven.contrib.flask import Sentry

app = Flask('test')

sentry = Sentry(app, logging=True, level=logging.ERROR)
# Note, we get SENTRY_DSN from environment

@app.route('/')
def test():
    # Comment the following logging.exception and the endpoint works.
    # Uncomment it, and it never completes.
    #  logging.exception("Boo!")
    return make_response("ok")

Finally, reproduce at will with dev_appserver.py . and opening localhost:8080 in a browser.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions