rollbar/pyrollbar

Duplicate submissions to rollbar backend

mastergberry opened this issue · 7 comments

Hi.

We are using Pyramid for one of our websites, and we are noticing that rollbar seems to be submitting 2 instances of the same stack trace for each error that occurs on our website.

We followed the documentation to set it up found here: https://docs.rollbar.com/docs/python#pyramid

We are using the exception view config attribute to display an error page when something breaks: https://docs.pylonsproject.org/projects/pyramid/en/latest/api/view.html#pyramid.view.exception_view_config

I am not sure if this is causing potential issues or a conflict with the rollbar software and triggering a second notification to be sent off to the server?

Happy to provide any extra information as needed.

Thanks.

can you provide the snippet of your code, I just tried and I don't see the 2nd instance reported.

Effectively this is what we have:

from pyramid.httpexceptions import HTTPNotFound, HTTPBadRequest, HTTPBadGateway, HTTPInternalServerError, HTTPGatewayTimeout
from pyramid.view import exception_view_config

class ErrorView:

        @exception_view_config(context=HTTPBadRequest, renderer='badlion:templates/site/error.jinja2')
        def bad_request(self):
            self.request.response.status = 200
            return dict(
                response_code=400,
                msg='Bad Request',
                reason=(self.request.exc_info[1].detail if 'detail' in self.request.exc_info[1].__dict__ else "Unknown")
            )

        @exception_view_config(context=HTTPNotFound, renderer='badlion:templates/site/error.jinja2')
        def not_found(self):
            self.request.response.status = 200
            return dict(
                response_code=404,
                msg='Page Not found',
                reason=(self.request.response.detail if 'detail' in self.request.response.__dict__ else "Unknown")
            )

        @exception_view_config(context=HTTPInternalServerError, renderer='badlion:templates/site/error.jinja2')
        def internal_server_error(self):
            self.request.response.status = 200
            return dict(
                response_code=500,
                msg='Internal Error',
                reason=self.request.response.detail
            )

        @exception_view_config(context=HTTPBadGateway, renderer='badlion:templates/site/error.jinja2')
        def bad_gateway(self):
            self.request.response.status = 200
            return dict(
                response_code=502,
                msg='Internal Error',
                reason=(self.request.response.detail if 'detail' in self.request.response.__dict__ else "Unknown")
            )

        @exception_view_config(context=HTTPGatewayTimeout, renderer='badlion:templates/site/error.jinja2')
        def gateway_timout(self):
            self.request.response.status = 200
            return dict(
                response_code=504,
                msg='Page Took Too Long to Load',
                reason=(self.request.response.detail if 'detail' in self.request.response.__dict__ else "Unknown")
            )

Is there anything I can do from my side to debug what is triggering this second callback?

are you getting second callback for each case ? also are you getting second callback in your logs too ?

I only see a single exception in the logs. What do you mean by a second callback for the cases?

Hey @pawelsz-rb

I noticed today in my local dev environment the following line when launching the application with pserve

Rollbar already initialized. Ignoring re-init

I am not doing anything explicitly with pyrollbar and am just using the documentation with the ini file.

ok, we will take a look at that

Closing due to age.