Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upSeveral unbounded ioutil.ReadAll calls with HTTP request/responses #3228
Comments
This comment has been minimized.
This comment has been minimized.
|
This is especially interesting for remote-read as it has the highest potential to nuke Prometheus. |
This comment has been minimized.
This comment has been minimized.
|
Indeed. Ping @tomwilkie for thoughts since I noticed a couple of these in remote storage. |
tomwilkie
added
the
component/remote storage
label
Sep 28, 2017
This comment has been minimized.
This comment has been minimized.
|
Yeah we should bound them with a I want to get 2.0 merged in before fixing this kind of bug though, as I don't want it to get lost in the merge. |
tomwilkie
added
the
component/service discovery
label
Sep 28, 2017
This comment has been minimized.
This comment has been minimized.
|
Makes sense for me. Just so it's tracked here, do you know what a sane upper bound could be? |
This comment has been minimized.
This comment has been minimized.
|
I'll gather some stats from our Cortex but I don't image more than 10Mb. |
This comment has been minimized.
This comment has been minimized.
|
@tomwilkie: See the MaxBytesReader function from the |
adamdecaf
referenced this issue
Jul 12, 2018
Open
wrap remote triton and marathon reads in an io.LimitReader #4376
This comment has been minimized.
This comment has been minimized.
|
I created #4376 (sorry about commit spam above). @tomwilkie did you ever find a better limit? I just picked 10mb. Also, I wasn't sure what to pick as a limit for |
mdlayher commentedSep 28, 2017
Did a quick
grepand filtered out vendored code and tests, and found a few instances of unboundedioutil.ReadAllcalls. Since some of these accept HTTP request and response bodies, it may be a good idea to set some sane upper bound to avoid limitless memory consumption.I suspect a few MiB of data might be okay in the worst case, but I'm not super familiar with e.g. the remote read/write traffic.
If this isn't a concern, feel free to close the issue. Just wanted to make sure it was noted.