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

Can't backup because of broken attachment: size mismatch #139

Closed
1 task done
AhegaHOE opened this issue Oct 19, 2022 · 30 comments
Closed
1 task done

Can't backup because of broken attachment: size mismatch #139

AhegaHOE opened this issue Oct 19, 2022 · 30 comments
Labels
bug Probable bug

Comments

@AhegaHOE
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Bug description

I cannot use the backup functionality. Everytime i'm trying to make a backup it fails with the following message.

IMG_20221019_132514

Steps to reproduce

  1. Settings
  2. Chats
  3. Chat backups
  4. Create backup

Molly version

v5.52.5-1-FOSS

Android version

Android 13

Device

Google Pixel 6

Link to debug log

https://debuglogs.org/android/5.52.5/161649a5785d6347132b83872e22607214d126445d33c663d25433ed1aa9023d

@valldrac valldrac added bug Probable bug upstream This is an issue in Signal, should be reported to Signal-Android labels Dec 12, 2022
@CharlotteCross1998
Copy link

This is still happening on v6.3.6-1-FOSS.
Android 12, Samsung S10.

@valldrac
Copy link
Member

This is still happening on v6.3.6-1-FOSS. Android 12, Samsung S10.

Sorry for that. Can you share the debug log please? In Settings > Help > Debug log.

@CharlotteCross1998
Copy link

This is still happening on v6.3.6-1-FOSS. Android 12, Samsung S10.

Sorry for that. Can you share the debug log please? In Settings > Help > Debug log.

Hi, here you go.
https://debuglogs.org/android/6.3.6/2036548dcee2003dc2886f70bd2a48c0e9ddd1512b9194bb22a658dc77b1e96a

@Trigus42
Copy link

Trigus42 commented Jan 3, 2023

@CharlotteCross1998
Copy link

I don't really know the codebase or anything so I may be really off base, but both of our logs have

java.io.IOException: Size mismatch!

@valldrac
Copy link
Member

valldrac commented Jan 5, 2023

This is a known issue in Signal. The problem is that there is at least one attachment saved in the database whose metadata is corrupted and it's blocking the backup when the application tries to read it.

You can try to delete the broken attachment. To do so, go to Settings > Data and Storage > Manage storage > Review storage and search for one file that cannot be open. Probably the thumbnail will be shown black. Once you delete it from the database, the backup will work again.

@Trigus42
Copy link

Trigus42 commented Jan 6, 2023

I have a whole lot of attachments. I can't possibly go trough all of them by hand. Would it be possible to implement a workaround to search and delete them or to ignore the corrupted media (skip with a warning or include anyways) during a backup?

@CharlotteCross1998
Copy link

This is a known issue in Signal. The problem is that there is at least one attachment saved in the database whose metadata is corrupted and it's blocking the backup when the application tries to read it.

You can try to delete the broken attachment. To do so, go to Settings > Data and Storage > Manage storage > Review storage and search for one file that cannot be open. Probably the thumbnail will be shown black. Once you delete it from the database, the backup will work again.

Signal is able to backup just fine, so I'm a bit confused as to why signal works but not Molly?

@valldrac
Copy link
Member

valldrac commented Jan 6, 2023

Signal is able to backup just fine, so I'm a bit confused as to why signal works but not Molly?

As I said, you probably have one broken attachment saved in Molly but not in Signal.

@CharlotteCross1998
Copy link

Signal is able to backup just fine, so I'm a bit confused as to why signal works but not Molly?

As I said, you probably have one broken attachment saved in Molly but not in Signal.

I restored from backup created by signal so they must have the same attachments no?

@valldrac
Copy link
Member

valldrac commented Jan 6, 2023

I restored from backup created by signal so they must have the same attachments no?

Haven't received any attachment since the restore? If so, please do a test. Try to restore the same backup file in Signal itself, and see if you got the same issue.

@CharlotteCross1998
Copy link

I restored from backup created by signal so they must have the same attachments no?

Haven't received any attachment since the restore? If so, please do a test. Try to restore the same backup file in Signal itself, and see if you got the same issue.

I have received new attachments since moving to molly, but this issue has always been prevalent, even before I did receive a new attachment Not sure what version I started with. Would it be possible to implement code that skips broken attachments and warn the user that X amount of attachments weren't backed up due to being corrupt?

@AhegaHOE
Copy link
Author

AhegaHOE commented Jan 7, 2023

What currupts the attachment and how do you know when they are corrupted and break the back up? Maybe i can look into fixing it.

@AhegaHOE
Copy link
Author

AhegaHOE commented Jan 10, 2023

I restored from backup created by signal so they must have the same attachments no?

Haven't received any attachment since the restore? If so, please do a test. Try to restore the same backup file in Signal itself, and see if you got the same issue.

I have received new attachments since moving to molly, but this issue has always been prevalent, even before I did receive a new attachment Not sure what version I started with. Would it be possible to implement code that skips broken attachments and warn the user that X amount of attachments weren't backed up due to being corrupt?

After using Molly myself for a while now I had no issues until I restored a backup. After restoring it kept wining and wouldn't back up. Is it the same for y'all? Maybe it's something wrong when restoring the backup that breaks it?

@valldrac
Copy link
Member

I'm going to start investigating this. I was reluctant to do so because it seemed to be a Signal issue. If I don't find the root cause, I will implement a workaround anyway. Thanks for the reporting.

If you find any more particular cases that leads to this bug, please add it here. It will speed up the troubleshooting.

@nordisch-dev
Copy link

nordisch-dev commented Feb 7, 2023

I have the same issue. I do not know exactly since when but it may happen only since restoring my old backup.

LineageOS 19.1
Android 12
Molly v6.9.2-1-FOSS
Device Fairphone 3

https://debuglogs.org/android/6.9.2/a8df403c7722a3ce839f1545051625f1b1ed5483b647aadc316956d1eb5640a6

I have too many attachements to search in. But I will try to find any broken attachements.

@valldrac valldrac changed the title Can't backup Can't backup because of broken attachment: size mismatch Feb 14, 2023
@valldrac
Copy link
Member

Found a couple of places that could cause attachments to be badly recorded in the database. I'm not familiar with that codebase so I'd rather not touch anything.

Instead I added a quick workaround that deletes the broken attachment while the backup is running. It has no side effects as the attachment cannot be read anyway. The backup will still fail but next backup should work fine since the broken attachment has been deleted, assuming there is only one broken attachment. If there are more, it would take more attempts.

@nordisch-dev
Copy link

As many times as I've restarted the backup now, I think that for me the fix didn't work and it's probably some other error with the database and there are no broken attachements.

@Trigus42
Copy link

Trigus42 commented Feb 17, 2023

Same here. I have run it 5 times, but the backup always fails at 95.8% and still the same error message:
https://debuglogs.org/android/6.11.7/303603b6bb2ab977638cb4c35190c91efa71e629590ee00249c9e70f5858322f

@Trigus42
Copy link

As far as I'm aware it is not yet released officially and (I think) it will be included in the next release.

Should be in 6.11: https://github.com/mollyim/mollyim-android/wiki/Changelog

@AhegaHOE
Copy link
Author

Didn't see that a new release dropped. I'm gonna check if it works for me.

@AhegaHOE
Copy link
Author

After running it for 4-5 times it still doesn't work for me.

Debug Log: https://debuglogs.org/android/6.11.7/ceef5fe8d90d6f155ef8c8e6b48e4eb2e8e397daaed989dba3fad3d4106eb286

@CharlotteCross1998
Copy link

@valldrac
Copy link
Member

Please refer to my previous comment #139 (comment) to understand the solution, as this is my second attempt to fix this.

@CharlotteCross1998
Copy link

@AhegaHOE
Copy link
Author

Latest release still fails to backup.
Logs: https://debuglogs.org/android/6.14.5/c3283c0557f242a634cee380f98137591427b9acff0fe5b124861a018dabdbd0

For me it works now...
https://debuglogs.org/android/6.14.5/b55791dfe4e5b7657e0ba30a3e78b45be66dc7ccad2d134344f4e5f992673898

@Trigus42
Copy link

Latest release still fails to backup. Logs: https://debuglogs.org/android/6.14.5/c3283c0557f242a634cee380f98137591427b9acff0fe5b124861a018dabdbd0

It currently only deletes one broken attachment at a time, so you might need to start the backup multiple times. What is important is, that it shouldn't always fail at the same percentage.

@CharlotteCross1998
Copy link

Latest release still fails to backup. Logs: https://debuglogs.org/android/6.14.5/c3283c0557f242a634cee380f98137591427b9acff0fe5b124861a018dabdbd0

It currently only deletes one broken attachment at a time, so you might need to start the backup multiple times. What is important is, that it shouldn't always fail at the same percentage.

Failed at 98.3% then 98.6% then 98.6% again, then completed. Would be a bit user friendlier if it handled all the broken attachments at once, but as of right now it seems to be working at least, thanks.

@valldrac
Copy link
Member

Would be a bit user friendlier if it handled all the broken attachments at once, but as of right now it seems to be working at least, thanks.

You're correct in that I did a "quick" fix. There are more effective methods to address this issue.

@notdeadyett
Copy link

I am still having this issue and can't get past 95.6% no matter what I do. Version 6.40.1-FOSS

@valldrac valldrac reopened this Dec 12, 2023
@valldrac valldrac mentioned this issue Dec 12, 2023
1 task
@valldrac valldrac removed the upstream This is an issue in Signal, should be reported to Signal-Android label Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Probable bug
Development

No branches or pull requests

6 participants