Uploaded image for project: 'Cost Management'
  1. Cost Management
  2. COST-4575

[Sentry] - MaybeEncodingError when custom exception classes are raised

XMLWordPrintable

    • False
    • None
    • False
    • Low

      We see a MaybeEncodingError raised from billboard when trying to unpickle our custom exception classes.

      MaybeEncodingError: Error sending result: ''(1, <ExceptionInfo: TrinoStatementExecError()>, None)''. Reason: ''PicklingError("Can\'t pickle <class \'koku.trino_database.TrinoStatementExecError\'>: it\'s not the same object as koku.trino_database.TrinoStatementExecError")''.
        File "billiard/pool.py", line 366, in workloop
          put((READY, (job, i, result, inqW_fd)))
        File "billiard/queues.py", line 366, in put
          self.send_payload(ForkingPickler.dumps(obj))
        File "billiard/reduction.py", line 56, in dumps
          cls(buf, protocol).dump(obj)

      This seems to only happen on custom exception classes that accept parameters. As an example, this has long happened with ExtendedDeadlockDetected but only recently started happening with TrinoStatementExecError after I changed it to accept arguments.

      Extensive research on this PicklingError returns many inconclusive recommendations, some of which are outdated.

      The current plan is to add a _reduce_ method to our custom exception classes to give deterministic unpicking of the objects.

              rh-ee-sdoran Sam Doran
              rh-ee-sdoran Sam Doran
              Pedro Lopez Perez Pedro Lopez Perez
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: