Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BlobObject.create() executing in spawned tasks gets stuck #2032

Closed
r10s opened this issue Oct 20, 2020 · 7 comments · Fixed by #2040
Closed

BlobObject.create() executing in spawned tasks gets stuck #2032

r10s opened this issue Oct 20, 2020 · 7 comments · Fixed by #2040
Labels
blocker bug Something is not working

Comments

@r10s
Copy link
Member

r10s commented Oct 20, 2020

i am failing to login on my android 4.4 testphone with a testrun.org-account, neither a burner account nor a dedicated account runs through configure, things are stuck at 60% or at once - either things are far slower and i did not wait long enough or sth. else is wrong. might be an android or a core problem, not sure.

i also verified that the current f-droid 1.12.5 works on the same phone with the same testrun.org-account - yip, no problems here, things run through in 2 seconds or so.

EDIT: trying over with the recent non-dev-gplay release, https://testrun.org/deltachat-gplay-release-1.13.5.apk, same thing, stuck at 60%. cancelling and restarting and things are stuck before any percentage is shown, however, that might be a different issue.

@r10s
Copy link
Member Author

r10s commented Oct 20, 2020

a first log: (the ATTTTTT comes from additional prints i inserted for testing) https://gist.github.com/r10s/75baaa916fdc639916112aa71770b9ab:

  • last print seems to be the statement "Trying ..." at
    info!(context, "Trying: {}", inf);
    (for imap-thread) and
    info!(context, "Trying: {}", inf);
    (for smtp-thread)
  • the info about success or error a few lines below is not printed, so the imap-thread seems to be lost in imap.connect somewhere - i'll do another try with more prints there
  • similar for smtp.connect - also that does not return, no success nor error printed there

@r10s
Copy link
Member Author

r10s commented Oct 21, 2020

using another address, things are stuck at 20%, i do not manage to configure any account using core47 and the android4.4 phone (core45 works). might be sth. is wrong with my rust-environment, or arm32bit compiled-app is wrong somehow. hm.

log for that: https://gist.github.com/r10s/efa56041964cf4764865f5031e8cc182

anyone else experiencing similar issues with https://testrun.org/deltachat-gplay-release-1.13.5.apk ?

@r10s
Copy link
Member Author

r10s commented Oct 21, 2020

might be sth. is wrong with my rust-environment

i deinstalled my whole rust-stack and reinstalled it, exactly the same. so we can probably exclude that for now.

the rust toolchain is unchanged between working core45 and not-working core47 (both 1.45.0 (no typo, we are currently using the same version numbers as rust))

things are still stuck at the lines mentioned above, i am a bit out of ideas for now.

@r10s
Copy link
Member Author

r10s commented Oct 21, 2020

we're getting closer.

i suspected the new threads added to the configure() process. i do knot know why, i had just the feeling :)

i removed the thread for update_device_chats_handle and did smtp_config_task before imap - and voilà: things work again :) this is the hack: 7e3029a

will try another pass to find out if it is only related to update_device_chats_handle or smtp_config_task. EDIT: it seems to be related to update_device_chats_handle only, this hack is also working: https://github.com/deltachat/deltachat-core-rust/compare/search-bug

k, trying to call update_device_chats() without an extra thread let the whole thing stuck again.

👉👉👉 so, all in all, it is update_device_chats() that it responsible for the stucking. i will have a closer look at that 🧐

maybe it is the !include_bytes macro - it seems to put things on the stack - and the welcome image is about 100k - maybe that is too much to have on the stack on tiny devices. maybe better use the heap... EDIT: no, this seems not to be the issue.

@link2xt link2xt transferred this issue from deltachat/deltachat-android Oct 22, 2020
@link2xt
Copy link
Collaborator

link2xt commented Oct 22, 2020

Same issue in OpenBSD and NetBSD running on qemu: some tests creating blobs in a spawned task get stuck.

Apparently the problem is this code: https://github.com/async-rs/async-std/blob/11196c853dc42e86d608c4ed29af1a8f0c5c5084/src/fs/file.rs#L314

Following workaround fixes the problem for me:

diff --git a/src/blob.rs b/src/blob.rs
index e58e047e..030d135e 100644
--- a/src/blob.rs
+++ b/src/blob.rs
@@ -63,6 +63,7 @@ impl<'a> BlobObject<'a> {
                 blobname: name.clone(),
                 cause: err.into(),
             })?;
+        let _ = file.flush().await;
         let blob = BlobObject {
             blobdir,
             name: format!("$BLOBDIR/{}", name),

@link2xt link2xt changed the title current master failing to login on android 4.4 testphone BlobObject.create() executing in spawed tasks gets stuck Oct 22, 2020
@r10s r10s added blocker bug Something is not working labels Oct 22, 2020
@r10s
Copy link
Member Author

r10s commented Oct 22, 2020

@link2xt i can confirm, the suggested fix also works for android4.4 🤗

i added a details log with some print-statements and the corresponding codelines at https://gist.github.com/r10s/f3307958418806368fc47f6410336838

@link2xt link2xt changed the title BlobObject.create() executing in spawed tasks gets stuck BlobObject.create() executing in spawned tasks gets stuck Oct 23, 2020
@r10s
Copy link
Member Author

r10s commented Oct 23, 2020

closed by #2040

@r10s r10s closed this as completed Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker bug Something is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants