Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad $schema in request blocks the application #197

Open
ppanero opened this issue Sep 25, 2018 · 0 comments
Open

Bad $schema in request blocks the application #197

ppanero opened this issue Sep 25, 2018 · 0 comments

Comments

@ppanero
Copy link
Member

ppanero commented Sep 25, 2018

When the $schema of the application doesn't exists or is not found the resolve_from_url fucntion fails (also because is not found on the store attribute).

The non-graceful failure leaves a SQL connection open that blocks the application and does not allow any consequent query.

Stacktrace:

Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 2309, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/lib/python2.7/site-packages/werkzeug/wsgi.py", line 826, in __call__
    return app(environ, start_response)
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 2309, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 2295, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1741, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/lib64/python2.7/site-packages/flask/views.py", line 88, in view
    return self.dispatch_request(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/invenio_rest/views.py", line 240, in dispatch_request
    *args, **kwargs
  File "/usr/lib64/python2.7/site-packages/flask/views.py", line 158, in dispatch_request
    return meth(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/invenio_records_rest/views.py", line 419, in need_record_permission_decorator
    return f(self, record=record, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/invenio_records_rest/views.py", line 598, in post
    record = self.record_class.create(data, id_=record_uuid)
  File "/usr/lib/python2.7/site-packages/invenio_records/api.py", line 179, in create
    record.validate(**kwargs)
  File "/usr/lib/python2.7/site-packages/invenio_records/api.py", line 126, in validate
    _records_state.validate(self, self['$schema'], **kwargs)
  File "/usr/lib/python2.7/site-packages/invenio_records/ext.py", line 41, in validate
    **kwargs
  File "/usr/lib/python2.7/site-packages/jsonschema/validators.py", line 541, in validate
    cls(schema, *args, **kwargs).validate(instance)
  File "/usr/lib/python2.7/site-packages/jsonschema/validators.py", line 129, in validate
    for error in self.iter_errors(*args, **kwargs):
  File "/usr/lib/python2.7/site-packages/jsonschema/validators.py", line 105, in iter_errors
    for error in errors:
  File "/usr/lib/python2.7/site-packages/jsonschema/_validators.py", line 212, in ref
    scope, resolved = validator.resolver.resolve(ref)
  File "/usr/lib/python2.7/site-packages/jsonschema/validators.py", line 375, in resolve
    return url, self._remote_cache(url)
  File "/usr/lib/python2.7/site-packages/functools32/functools32.py", line 400, in wrapper
    result = user_function(*args, **kwds)
  File "/usr/lib/python2.7/site-packages/jsonschema/validators.py", line 385, in resolve_from_url
    raise RefResolutionError(exc)
jsonschema.exceptions.RefResolutionError: ('Connection aborted.', BadStatusLine("''",))

I can provide access to a sentry event with breadcrumps etc. Migth be usefull to debug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants