wagtail-transfer icon indicating copy to clipboard operation
wagtail-transfer copied to clipboard

CircularDependencyError messages are opaque

Open nimasmi opened this issue 3 years ago • 2 comments

On a large site with multiple links between pages, my users often report failed imports.

The error message is not shown to the user on the destination site at all, see #101.

Even if they were, the logs would be the best place to see these, but the logs only show the latest dependency, the one that raised the issue. Often it looks like:

 File "wagtail_transfer/operations.py", line 462, in run
    self._add_to_operation_order(operation, operation_order, [operation])
  File "wagtail_transfer/operations.py", line 571, in _add_to_operation_order
    self._add_to_operation_order(resolution, operation_order, path + [resolution])
  File "wagtail_transfer/operations.py", line 571, in _add_to_operation_order
    self._add_to_operation_order(resolution, operation_order, path + [resolution])
  File "wagtail_transfer/operations.py", line 567, in _add_to_operation_order
    raise CircularDependencyException()

With Sentry.io, which captures traceback frame context, I can see that the latest dependency is usually a soft one, but the dependency in the preceding frame is a hard one, and not resolvable.

I can also see:

{
    "operation": <wagtail_transfer.operations.CreateTreeModel` object at 0x7fcd5e6d5310>,
    "path" = [
        <wagtail_transfer.operations.CreateTreeModel object at 0x7fcd5ec56650>,
        <wagtail_transfer.operations.CreateTreeModel object at 0x7fcd5ec56150>,
        <wagtail_transfer.operations.CreateTreeModel object at 0x7fcd5e6d5310>,
    ],
    "resolution": <wagtail_transfer.operations.CreateTreeModel object at 0x7fcd5ec56150>,
}

Suggestion: If these objects had more descriptive __str__ methods, I'd have more information about them for debugging, e.g. at https://github.com/wagtail/wagtail-transfer/blob/a77c564bff8fa11e6a03c6e3fb4cd07e5cd85760/wagtail_transfer/operations.py#L720.

nimasmi avatar Jan 10 '22 16:01 nimasmi

@nimasmi did you find the cause for those error message? I'm having this error on random pages sometimes and I can't figure out what is the cause. If I repeat the import process for the same page 2,3 times, sometimes up to 5 times - it gets fixed somehow and the import process ends successfully.

jardev avatar Aug 10 '23 15:08 jardev

It was typically a page with a rich text link to a child page, or vice versa. It's interesting that repeat attempts seem to have a bulldozer effect.

nimasmi avatar Aug 10 '23 16:08 nimasmi