[PDB-2252] PuppetDB should not be slurping all request bodies to a string Created: 2015/12/10  Updated: 2016/03/17  Resolved: 2016/01/26

Status: Closed
Project: PuppetDB
Component/s: None
Affects Version/s: PDB 3.2.2
Fix Version/s: PDB 4.0.0

Type: Bug Priority: Normal
Reporter: Ryan Senior Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
supports PDB-2348 Drop terminus command checksums? Open
Epic Link: Memory Use - Phase 1
Story Points: 2
Sprint: PuppetDB 2016-01-13, PuppetDB 2016-01-27


Currently we are always slurping the full InputStream in the body of the request into a String (see here for the code). This is being done on ALL incoming requests. This is bad for several reasons. One is with the new code that rejects payloads that are too large. If we always slurp it in, we could get a payload too large for the String of it to fit in memory. If we need to parse the JSON, it's much better to just pass in the stream. If we can avoid converting to a string entirely (i.e. transfer the data to AMQ in raw bytes) that's even better.

After this is fixed, we should be able to accept arbitrarily large POST bodies and reject them properly. This should also be faster and more memory efficient.

Generated at Tue Jan 21 20:27:54 PST 2020 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.