wagtail / wagtail-transfer

Content transfer for Wagtail

Home Page:https://wagtail.github.io/wagtail-transfer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CircularDependencyError messages are opaque

nimasmi opened this issue · 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

class CreateTreeModel(CreateModel):
.

@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.

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.