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

416 range error #389

Closed
mtrezza opened this issue Aug 12, 2020 · 9 comments · Fixed by #402
Closed

416 range error #389

mtrezza opened this issue Aug 12, 2020 · 9 comments · Fixed by #402
Labels

Comments

@mtrezza
Copy link

mtrezza commented Aug 12, 2020

Issue

I see a significant amount of 416 Range Not Satisfiable logs with our CDN. These errors only occur in the iOS app with Nuke, not in the Android app with Glide, which is loading the same images. However, I have not seen any issues with image loading in the app and there are no user complaints about images not loading.

Logs

Status Timestamp Remote IP Size Path
416 2020-07-31 01:55:42 (REDACTED) 598 Bytes (REDACTED)

The "size" in the logs which I assume is the requested range is always around 400 - 600 Bytes for these 416 errors.
For successful CDN responses, "size" is the actual image size, like several KB.

Question

Are there any cases in which Nuke uses range requests?

@kean
Copy link
Owner

kean commented Aug 12, 2020

Hi, yes, by default Nuke uses range requests and this error code is most likely related to them. To disable it, you can set isResumableDataEnabled to false on the pipeline configuration. However, it would be great to investigate and try to fix it.

@kean
Copy link
Owner

kean commented Aug 12, 2020

Nuke has a very simple algorithm for setting requested ranges, I'm not sure what can be wrong with the range.

@kean
Copy link
Owner

kean commented Aug 21, 2020

Hey, @mtrezza. Any updates on this one?

@mtrezza
Copy link
Author

mtrezza commented Aug 21, 2020

Unfortunately not. Our CDN provider does not log the specific ranges that produce these 416 errors. We will have to implement a log client side in Nuke, but not sure how to do this in a quick way other than forking Nuke.

@cjmconie
Copy link

cjmconie commented Sep 15, 2020

Hi, I am experiencing a similar issue.

It seems to appear when there are concurrent requests, for example inside a UICollectionView displaying a grid of UICollectionViewCells each having a UIImageView . I'm using Nuke.loadImage(with:into:). ImagePipeline is unmodified. Images are being requested directly from Firebase Storage. The error from Nuke is: Failed to load image data: Response status code was unacceptable: 416

Customising the ImagePipeline by setting isResumableDataEnabled as false resolves the issue.

Nuke 9.1.1 | Xcode 11.7 | Swift 5.2.4

Is there any more information I can provide to help?

@mattczech
Copy link

Hello, I'm also seeing occasional 416 errors.

In my case, I'm loading images stored in S3. Each 416 that I've observed is a result of Nuke requesting a starting byte count that is equal to the size of the image.

I'm using a UICollectionView to display a grid of images with Nuke.loadImage(with:into:). No modifications to the pipeline.

When I've seen the error, I've observed the following:

  • The image exists in the URLCache and it's not expired.
  • The collection view's initial layout occurs, cells are configured and images start loading. During this, one of the cells starts loading a different image.
  • This cancels the original request while it's loading from the cache. It looks like the received data is then saved to ResumableData. The next time this image is loaded, it attempts to resume that request but since the full image data was saved as resumable data, it sends a range header with the starting offset equal to the size of the image, which is one byte past the last byte in the image.

Nuke 9.1.2

@mtrezza
Copy link
Author

mtrezza commented Nov 14, 2020

Well researched! That looks like a bug, if that is really the case.

@kean kean added the bug label Nov 15, 2020
@kean
Copy link
Owner

kean commented Nov 16, 2020

Hi, @mattczech. Thank you for providing this info. I went through the code and it does seem to be the case that the situation you are describing is possible. I'm going to address this issue in the upcoming release.

@kean
Copy link
Owner

kean commented Nov 16, 2020

@kean kean closed this as completed in #402 Nov 17, 2020
kean added a commit that referenced this issue Nov 17, 2020
#389 Fix an issue where fully downloaded data will sometimes be saved as resumable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants