Signal-android: Images get corrupted on send sometimes

Created on 13 Jul 2019  路  8Comments  路  Source: signalapp/Signal-Android


Bug description

Sometimes I get messages from the sender where images get corrupted. Looks like immense JPEG artifacts with green tint.
The images are recorded with an external camera and look just fine. Also images which are not recorded on the smartphone of the sender get corrupted sometimes.

Steps to reproduce

  • Seems to happen when the sender has weak signal or no connection to the internet
  • happens from time to time
  • Resending sometimes sends the image just fine

Expected result:
Images don't get corrupted

Screenshots

signal-2019-07-11-082240

Device info


Device: samsung SM-G903F (S5 neo)
Android version: 6.0.1
Signal version: 4.41.6

Happens also on older signal versions

Link to debug log

https://debuglogs.org/ae4e78e357fce9a4ca76c4d055358e92a80c98b5b09ce466345c4819a5f21ca2

Most helpful comment

Alrighty, so we figured it out. In poor network conditions, uploads will fail. But we compress before every upload attempt. So images end up getting overly compressed on bad networks. This was hard to find because newer android versions have some optimizations in bitmap compression where it won't overly-compress images, so this only happens on older android versions. We'll likely break compression out to a separate job from the upload job to fix this. Thanks!

All 8 comments

Given that we don't process the images on the receiver side, this is likely a problem where something goes wrong with image compression on the sender side.

Sorry, accidentally submitted last comment too soon.

Here's something to test:

  • Have the sender attempt sending a small photo (say, 640x480 jpg) which we wouldn't need to compress, and see if that comes through ok.
  • Have the sender attempt sending a very large photo (a jpg > 4k resolution), which we would compress, and see if that comes through artifacted.

Also, if you could get a debuglog from the sender afterwards, that would be great.

the log is from afterwards directly. Also the same image sent directly afterwards comes through fine, so it's not really reproducible or image size dependent

Is the log from the sender's side? I see no logs indicating an attachment upload.

Also, can you tell me the dimensions and size of the image? I basically need to know if it's over the threshold that we'd compress the image. If it isn't, then it could be a rendering problem on the receiver's side.

Sender side, yes. Strange, she collected the log straight afterwards. Will try to get a better one the next time this happens.

The image was 1932px*2576px. 780kB.

Ok, so after finding some other people with the same issue, I'm relatively confident this has something to do with the image compression. I forgot that we will re-encode all images as a cheap way to strip out any EXIF data. I'll try to see if this is a problem with Glide or if it's a problem with the phone's built-in image encoding.

Alrighty, so we figured it out. In poor network conditions, uploads will fail. But we compress before every upload attempt. So images end up getting overly compressed on bad networks. This was hard to find because newer android versions have some optimizations in bitmap compression where it won't overly-compress images, so this only happens on older android versions. We'll likely break compression out to a separate job from the upload job to fix this. Thanks!

Sounds good. Glad to help

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vvug picture vvug  路  3Comments

FeuRenard picture FeuRenard  路  3Comments

ilikenwf picture ilikenwf  路  3Comments

wesinator picture wesinator  路  3Comments

5boro picture 5boro  路  3Comments