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

Videos fail to send #4243

Open
Destinyg133 opened this issue Feb 7, 2025 · 11 comments
Open

Videos fail to send #4243

Destinyg133 opened this issue Feb 7, 2025 · 11 comments
Labels
A-Media O-Occasional Affects or can be seen by some users regularly or most users rarely S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect Something isn't working: bugs, crashes, hangs and other reported problems

Comments

@Destinyg133
Copy link

Destinyg133 commented Feb 7, 2025

Steps to reproduce

Some videos fail to send
I will include log, hopefully it can help
They can be sent using element-android normally but with EXA it just fails or goes into neverending loop

logs.2025-02-07-11.log
logcat.log

Outcome

What did you expect?

To send video files normally

What happened instead?

Neverendinf loop if media optimisation is off or failed to send message if its on

Your phone model

mi10t

Operating system version

No response

Application version and app store

synapse 1.123

Homeserver

No response

Will you send logs?

Yes

Are you willing to provide a PR?

No

@Destinyg133 Destinyg133 added the T-Defect Something isn't working: bugs, crashes, hangs and other reported problems label Feb 7, 2025
@jmartinesp
Copy link
Member

I see:

matrix_sdk::http_client::native: Sending request num_attempt=1 | crates/matrix-sdk/src/http_client/native.rs:55 | spans: send_attachment > send_attachment > prepare_and_send_attachment > send{server_versions=[V1_0, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V1_9, V1_10, V1_11] config=RequestConfig { timeout: 532s } request_id="REQ-51" method=POST uri="https://domain.tld/_matrix/media/v3/upload" request_size="63.4 MiB" status=502 response_size="0 B" status=502 response_size="0 B" status=502 response_size="0 B" status=502 response_size="0 B" status=502 response_size="0 B" status=502 response_size="0 B" status=502 response_size="0 B"}

So you're getting a 502 status code from the homeserver. This status code is usually returned for errors with federation, could you confirm whether the room you're uploading the videos too is in the same HS as you or on a different one? There might be some issue in the SDK preventing uploading media through federation from working properly.

Another option is the 502 could mean the file is too large, but AFAICT this is only used in the /download endpoint when HS can't serve a media that large, not for uploading media.

@jmartinesp jmartinesp added the X-Needs-Info This issue is blocked awaiting information from the reporter label Feb 7, 2025
@Destinyg133
Copy link
Author

I see:

matrix_sdk::http_client::native: Sending request num_attempt=1 | crates/matrix-sdk/src/http_client/native.rs:55 | spans: send_attachment > send_attachment > prepare_and_send_attachment > send{server_versions=[V1_0, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V1_9, V1_10, V1_11] config=RequestConfig { timeout: 532s } request_id="REQ-51" method=POST uri="https://domain.tld/_matrix/media/v3/upload" request_size="63.4 MiB" status=502 response_size="0 B" status=502 response_size="0 B" status=502 response_size="0 B" status=502 response_size="0 B" status=502 response_size="0 B" status=502 response_size="0 B" status=502 response_size="0 B"}

So you're getting a 502 status code from the homeserver. This status code is usually returned for errors with federation, could you confirm whether the room you're uploading the videos too is in the same HS as you or on a different one? There might be some issue in the SDK preventing uploading media through federation from working properly.

Another option is the 502 could mean the file is too large, but AFAICT this is only used in the /download endpoint when HS can't serve a media that large, not for uploading media.

Hi

Not using federation. Its my homeserver and room is from that homeserver
File size is 150mb if it helps
Like I said. It works on Element-Android but not with ElementX

@jmartinesp
Copy link
Member

jmartinesp commented Feb 10, 2025

After checking the related synapse code and confirming nothing should be returning a 502 status code I asked the synapse backend team about this issue and they said it would most likely be caused the file being larger than your synapse's max_upload_size config field, which would cause it to drop the connection and your reverse proxy returns a 502 status code when that happens.

Could you double check if that's the case? Maybe it's working on EA because the video is compressed with higher compression and passes this check?

@Destinyg133
Copy link
Author

After checking the related synapse code and confirming nothing should be returning a 502 status code I asked the synapse backend team about this issue and they said it would most likely be caused the file being larger than your synapse's max_upload_size config field, which would cause it to drop the connection and your reverse proxy returns a 502 status code when that happens.

Could you double check if that's the case? Maybe it's working on EA because the video is compressed with higher compression and passes this check?

Already tried uploading other much bigger files, they seem to upload fine
Videos seem to be problem
Even some smaller ones

@jmartinesp
Copy link
Member

Then I'm sorry to ask again, but could you give us some more info about the videos (format, codec, size maybe?) and upload additional logs when you receive an error uploading them? Sadly, we need some more info to debug this issue.

@Destinyg133
Copy link
Author

Destinyg133 commented Feb 10, 2025

Then I'm sorry to ask again, but could you give us some more info about the videos (format, codec, size maybe?) and upload additional logs when you receive an error uploading them? Sadly, we need some more info to debug this issue.

This one was done using matrix.org HS. Error also happend

logcat (1).log
https://github.com/user-attachments/assets/9d4e7ca4-6886-4b3d-b482-f02a3a948008

Image

@jmartinesp
Copy link
Member

Thanks for the logs and video! I think I found the issue:

02-10 16:44:15.737 21648 22013 E TranscodeEngine: Unexpected error while transcoding.
02-10 16:44:15.737 21648 22013 E TranscodeEngine: java.lang.IllegalStateException: Timestamps must be monotonically increasing: 0, 0

Which should be fixed by #4247 once merged (should, but I couldn't confirm it does because I can't reproduce the issue, not even with your video).

If you want to double check, you can download the APK in the PR to test the fix, just take into account this will be installed as a separate app and it's in debug mode, so performance is way worse than on an officially released one.

@jmartinesp jmartinesp added S-Major Severely degrades major functionality or product features, with no satisfactory workaround O-Occasional Affects or can be seen by some users regularly or most users rarely A-Media and removed X-Needs-Info This issue is blocked awaiting information from the reporter labels Feb 10, 2025
@Destinyg133
Copy link
Author

Thanks for the logs and video! I think I found the issue:

02-10 16:44:15.737 21648 22013 E TranscodeEngine: Unexpected error while transcoding.
02-10 16:44:15.737 21648 22013 E TranscodeEngine: java.lang.IllegalStateException: Timestamps must be monotonically increasing: 0, 0

Which should be fixed by #4247 once merged (should, but I couldn't confirm it does because I can't reproduce the issue, not even with your video).

If you want to double check, you can download the APK in the PR to test the fix, just take into account this will be installed as a separate app and it's in debug mode, so performance is way worse than on an officially released on

Same thing. Still not working

logcat (1).log

@jmartinesp
Copy link
Member

I'm sorry to hear that, could you try again with this one instead?

Here we try to use a time interpolator that forces the timestamps to be linear, which should fix the issue, but I'm not sure if that could break the video somehow. I'm also trying to find the affected OS version, which I suspect is some faulty vendor's implementation of some codec in Android 12, but I couldn't reproduce it using an emulator.

@Destinyg133
Copy link
Author

I'm sorry to hear that, could you try again with this one instead?

Here we try to use a time interpolator that forces the timestamps to be linear, which should fix the issue, but I'm not sure if that could break the video somehow. I'm also trying to find the affected OS version, which I suspect is some faulty vendor's implementation of some codec in Android 12, but I couldn't reproduce it using an emulator.

Now its just neverending loop of sendings (it never stops)
No error this time
I will still include log cause it has a lot of audio error trying again etc

logcat (3).log

@Destinyg133
Copy link
Author

@jmartinesp hi, any news or if you have suggestion if i can try anything to help you rule out issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Media O-Occasional Affects or can be seen by some users regularly or most users rarely S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect Something isn't working: bugs, crashes, hangs and other reported problems
Projects
None yet
Development

No branches or pull requests

2 participants