Skip to content

SetupRunner.ensure_recovery is called needlessly when attempting to join an already-joined grid #220

@crwood

Description

@crwood

An anonymous user writes:

Sometimes Twisted crashes after you accept an invite from the same machine which generated it.

Traceback:

--- <exception caught here> ---
gridsync/invite.py:117:receive
gridsync/invite.py:104:_run_setup
gridsync/setup.py:308:run
gridsync/setup.py:263:ensure_recovery
gridsync/tahoe.py:643:upload
]

Although I can't seem to reproduce this, after reviewing the relevant code paths, it looks like the error above is being caused by a race condition introduced after the grid_already_joined pyqtSignal fires: when the user closes the "You are already connected" message box (triggered by the grid_already_joined signal for folderless invites), the underlying InviteReceiver and enclosed SetupRunner objects are destroyed (or at least their last remaining references are are removed, prompting GC). Because the ensure_recovery upload is scheduled after the grid_already_joined signal fires, this can result in the premature termination of upload operation (and thus the error message seen above).

This can be fixed simply by scheduling the ensure_recovery call before emitting the grid_already_joined signal -- or, better, emitting it only for newly-joined grids (which is, arguably, how it should have worked in the first place; there's no reason to re-upload files that have already been uploaded).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions