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

Rollbar interprets empty tuple in 'server.history.args' as a CircularReference #402

Open
ezra-agathos opened this issue Jan 27, 2022 · 0 comments

Comments

@ezra-agathos
Copy link

ezra-agathos commented Jan 27, 2022

System: macOS Catalina 10.15.7
Python: 3.6.13
Rollbar: 0.15.0

Problem

We use pyrollbar to capture error/exception information on python modules which run as jobs. On rollbar, we are seeing many reports that show something like this:

{
    "body": {
        ...
        "server": {
           ...,
            "history": [
                  {
                    "timestamp": 1643242402.460253, 
                    "args": [], 
                    "format": "script args: ***********"
                  }, 
                  {
                    "timestamp": 1643242416.966411, 
                    "args": [], 
                    "format": "*********"
                  }, 
                  {
                    "timestamp": 1643242428.563935, 
                    "args": "<CircularReference type:(tuple) ref:(server.history.1.args)>", 
                    "format": "**********"
                  },
                  ...
             ],
             ...
         },
         ...
     }
}

Below is the code that sets up the logger:

...
 if settings.ROLLBAR_API_KEY:
        rollbar.init(
            settings.ROLLBAR_API_KEY,
            settings.ROLLBAR_ENVIRONMENT,
            scrub_fields=settings.ROLLBAR_SCRUB_FIELDS,
        )
        # Send to rollbar all WARNING or higher logs
        rollbar_warn_logger = rollbar.logger.RollbarHandler()
        rollbar_warn_logger.setLevel(logging.WARNING)
        rollbar_warn_logger.addFilter(f)
        log.addHandler(rollbar_warn_logger)
        ...

Expectation

From what I understand, our code throws exceptions without any additional arguments. I would have expected that all instances of () would have been interpreted to a [] when converted to rolllbar payload.

Additional Information

The data is transformed to payload in _build_payload (line 1339, rollbar/init.py). Stepping through this, I noticed that the data didn't have any CircularReferences until after transformation via traverse (line 88 rollbar/lib/traverse.py). It appears that the id function is used to hash the key argument to a unique identifier inside memo. However, the id function will always return the same value for an empty tuple input. I couldn't find documentation on how to properly add an empty tuple to an allowed circular types - though I think this issue may be somewhat similar?: #286

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

No branches or pull requests

1 participant