willnorris / willnorris/imageproxy

cache with concurrent requests

Open
#187 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
4k
Forks
513
PR merge metrics
No merged PRs in 30d

Description

I have a page with big slider and thumbs under it. I put resized images in both, but source images are the same.
Source images goes from s3. And thumbs are not loading with error. In verbose mode I see following:

31.07.2019 16:52:342019/07/31 13:52:34 request: {Method:GET URL:https://someminio.com/dev/5b067fd85d773_799bad5a3b514f096e69bbc4a7896cd9.jpg#200x200,fit Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 Header:map[Accept:[image/*] User-Agent:[willnorris/imageproxy]] Body:<nil> GetBody:<nil> ContentLength:0 TransferEncoding:[] Close:false Host:someminio.com Form:map[] PostForm:map[] MultipartForm:<nil> Trailer:map[] RemoteAddr: RequestURI: TLS:<nil> Cancel:<nil> Response:<nil> ctx:<nil>} (served from cache: true)
31.07.2019 16:52:342019/07/31 13:52:34 content-type not allowed: "text/html"

If I turn cache off everything is ok. I assume that second request arrives when cache is in progress and somehow damage it

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with caching enabled and concurrent requests for the same S3 image, using the verbose request output as a reference. Trace the cache path that reports the response as served from cache and compare it with a request made with caching disabled. Done means concurrent thumbnail requests return the image successfully without the text/html content-type error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.