element-x-android icon indicating copy to clipboard operation
element-x-android copied to clipboard

Sending image hangs indefinitely

Open derat opened this issue 7 months ago • 1 comments

Steps to reproduce

  1. Open an existing 1:1 room with another user on the same homeserver.
  2. Tap the "+" icon in the bottom-left corner.
  3. Tap "Photo & Video Library".
  4. Tap an image.
  5. Tap the send button.

Outcome

What did you expect?

The image should be sent to the other user.

What happened instead?

The "Sending..." dialog and animated spinner are displayed indefinitely (or at least for the two minutes that I've waited). After I click "Cancel", the send button no longer responds to taps. I get the same results after closing the image activity and trying again.

Image

This happens when sending to different users on my homeserver. I'm able to send image attachments to the same users without any problems from Element Web v1.11.99.

It doesn't appear to be connectivity-related; I see the same behavior on cellular and wifi. I believe that this worked for me in the past.

Your phone model

Pixel 7a

Operating system version

Android 15

Application version and app store

Element X 25.04.3 (Play Store)

Homeserver

Synapse 1.128.0

Will you send logs?

Yes

Are you willing to provide a PR?

No

derat avatar May 06 '25 15:05 derat

This doesn't appear to happen consistently. Immediately after filing this issue, I killed and restarted Element X and was able to send the same image to the same user successfully.

I've sent logs with a description referencing this issue number and including timestamps of when the hanging and successful attempts occurred.

If/when I see this again, I'll check whether restarting Element X resolves the problem.

derat avatar May 06 '25 15:05 derat

Having the exact same issue and it isn't persistent. Even if the image is shot inside Element X it won't send.

Your phone model: Pixel 8 Pro

Operating system version: Android 15 (BP1A.250405.007.B1)

Application version and app store: Element X 25.05.3 (Play Store)

VikingOwl91 avatar May 25 '25 11:05 VikingOwl91

Update: Force-Stop and restart the app seems to fix the problem.

VikingOwl91 avatar May 25 '25 13:05 VikingOwl91

I still see this frequently with Element X 25.06.2 from the Play Store. Every time it's happened, I've been able to send the image without any trouble after force-stopping and restarting the app.

derat avatar Jun 22 '25 15:06 derat

@derat am looking through element-x-android debug logs and can't find any which match up to this report. is there a matrix ID or something I can look for?

ara4n avatar Jul 30 '25 14:07 ara4n

@ara4n, thanks for the reply. I still encounter this regularly, so I just sent debug logs again from the app after triggering it. I included #4685 in the description.

derat avatar Jul 30 '25 15:07 derat

thanks, have found the rageshake now and correlated it here.

ara4n avatar Jul 30 '25 15:07 ara4n

In the report that I just sent, I attempted to send a photo taken within Element X. From within the conversation view:

  • tap + button
  • tap Take photo
  • tap photo button to take photo
  • tap photo button again to confirm photo
  • tap send button without adding a caption

derat avatar Jul 30 '25 15:07 derat

Right - it looks like this was fixed in https://github.com/matrix-org/matrix-rust-sdk/pull/4195, which has been sitting behind a feature flag on EXA since November but unfortunately was overlooked for being enabled by default. It's unclear why it's biting some people more than others.

To test, please enable developer settings in the app (tap the version number in Settings 7 times) and then try toggling on the "Media upload through send queue" setting and seeing if you can reproduce it.

Sorry for the sequence of fails here (failure to triage, failure to respond, fixing the bug ages ago, failing to remove the featureflag on the fix...), and thanks for being reactive now.

ara4n avatar Jul 30 '25 17:07 ara4n

Thanks for following up on this! So far, the results seem promising:

  • Tried to send an image from "Photo & Video Library" without changing anything; it hung as before.
  • Enabled the "media upload through send queue" setting.
  • Tried to send the image again (without restarting the activity); it still hung.
  • Killed the activity (but not the process, as I understand it) by swiping up in the Android task switcher.
  • Relaunched the activity.
  • Was able to send the same image successfully.

Previously, I had to force-stop the process via "App info" before I'd be able to send again. Since that wasn't necessary this time, I'm hopeful that the send-queue setting improved things and that an activity restart was necessary to pick up the change -- does that sound plausible to you?

I'm not sure what the conditions were for this to start failing before; I'd be able to send images immediately after starting the app but it'd begin consistently hanging at some later point. It's still working now, but I've created a reminder to test this again tomorrow. I'll leave another comment here when I've done that.

derat avatar Jul 30 '25 19:07 derat

fab, thanks for testing; please let us know if it sticks. unsurprised you had to restart the app for it to take effect.

ara4n avatar Jul 30 '25 19:07 ara4n

I'd say it shouldn't need to restart the app to take effect, so it might be something else. Please continue testing and reporting, as we can't reproduce on our side for now.

ganfra avatar Jul 30 '25 20:07 ganfra

@ganfra: Thanks, I'll continue testing and will update this issue. I'm at a loss as to what triggers this as well: I typically see it whenever I try to send an image if I haven't already force-stopped the app recently, but someone else on the same homeserver using a Pixel 8 tells me that they've never experienced the problem when sending images to me. It's unclear to me what's causing the difference in outcomes.

derat avatar Jul 30 '25 21:07 derat

I think that this is unfortunately still broken. "Media upload through send queue" is still checked, but sending images (both photos taken within Element and ones from my media library) is hanging again now.

derat avatar Jul 31 '25 20:07 derat

ugh, thanks for the update. please can you rageshake again after reproing it and we'll chase.

ara4n avatar Jul 31 '25 22:07 ara4n

Sure, just triggered it again and sent logs with issue #4685 in the description.

derat avatar Jul 31 '25 22:07 derat

Thanks for the rageshake, but can you go to dev settings and :

  1. Enable Send Queue trace logs
  2. Set the Tracing log level to Trace

Then try to repro and rageshake again! Thanks

ganfra avatar Aug 01 '25 08:08 ganfra

@ganfra: Sure, I've updated those settings. I restarted the app per the UI which made the problem go away like usual, but I'll keep testing until it comes back and then I'll rageshake and comment here -- probably won't take more than a day or so.

derat avatar Aug 01 '25 10:08 derat

I've been trying several times per day to reproduce this, but haven't seen it again yet. I'll continue trying. If it hasn't shown up again after a week, I think it'd be safe to say that the frequency is at least greatly reduced by "Media upload through send queue".

derat avatar Aug 03 '25 12:08 derat

I finally just saw this again! I triggered it around 2025-08-04 15:35 UTC by sending a small image from my photo library to another user on the same homeserver. I sent logs with Issue #4685 in the description. Please let me know if there's anything else that you need from my end.

derat avatar Aug 04 '25 15:08 derat

I took a look at the logs and sadly, there's nothing there that could help us debug the issue:

// Entering the media preview screen
2025-08-04T15:37:13.791834Z DEBUG elementx: [Lifecycle] onResume AttachmentsPreviewNode | 
// Lots of timeline loading logs here, but nothing related to the media upload or sending the media event
...
// After 20s a dialog of some kind is dismissed (I guess the 'Sending...' one)
2025-08-04T15:37:32.226573Z TRACE elementx: OnDispose progressDialog | 
2025-08-04T15:37:33.196149Z DEBUG elementx: Do not delete the uri | 
...
// Then exiting the media preview screen
2025-08-04T15:37:33.919078Z DEBUG elementx: [Lifecycle] onPause AttachmentsPreviewNode | 
2025-08-04T15:37:33.919760Z DEBUG elementx: [Lifecycle] onDestroy AttachmentsPreviewNode | 

Maybe we'll need to add some extra logs to catch this bug. When you tried this, was the send queue for media uploads enabled or disabled?

jmartinesp avatar Aug 08 '25 07:08 jmartinesp

Thanks for taking a look. "Media upload through send queue" was enabled (and has been since 2025-07-30 -- I haven't made any settings changes since then apart from enabling Send Queue logs on 2025-08-01 as requested above).

derat avatar Aug 08 '25 10:08 derat

For whatever it's worth: even though I've still seen this a few times since enabling "Media upload through send queue" (as mentioned above), the frequency seems like it's been greatly reduced. Previously, the app seemed like it would consistently get into this state after just one or two days. Now, sending images at least works more often than not. I'm happy to provide more information if you can think of anything else that'd help debug this, but it'll be tougher for me to repro the issue.

derat avatar Aug 22 '25 11:08 derat