Skip to content

stop_ongoing() doesn't work if called too soon #8628

Description

@WofWca
  • Operating System (Linux/Mac/Windows/iOS/Android): All
  • Core Version: 2.59.0
  • Client Version: 2.59.1

Expected behavior

add_transport is cancelled.

Actual behavior

info!(self, "No ongoing process to stop.",);

In practice this means that pressing "Cancel" doesn't actually cancel anything.

Steps to reproduce the problem

  1. Call rpc.add_transport_from_qr
  2. Immediately (or almost immediately) call stop_ongoing_process.

The problem is that there are quite a few awaits before the alloc_ongoing.

let cancel_channel = self.alloc_ongoing().await?;

The biggest one is probably stop_io

self.stop_io().await;

This bug definitely affects Desktop

https://github.com/deltachat/deltachat-desktop/blob/820deb5fcb0b0f350fce1041122dddad60196948/packages/frontend/src/components/dialogs/ConfigureProgressDialog.tsx#L65-L88

And most likely also Android, but I didn't try:

https://github.com/deltachat/deltachat-android/blob/8a389bdf24c773fc7153bc86088316bdeaa952cb/src/main/java/org/thoughtcrime/securesms/InstantOnboardingActivity.java#L583-L598

I see two options:

  • Redesign the API. Such that the user can stop a process by its revocation handle / token / signal. Can be either a parameter provided to add_transport or its return value (although add_transport doesn't return until it's finished).
  • Offload the problem to users (client devs). Tell them in the docs that they need to wait for at least one ConfigureProgress (or whatever else) event before they can call stop_ongoing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions