-
Notifications
You must be signed in to change notification settings - Fork 25
Description
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).