question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Autocannon sends two extra bytes at the end of the body, breaking the protocol

See original GitHub issue

I’ve tested uWS HTTP server and passed little body in every http request. It produced strange results. I asked (https://github.com/uNetworking/uWebSockets.js/issues/228) creator of uWS why it happens and he researched what "autocannon sends two extra bytes at the end of the body, breaking the protocol. uWebSockets does not close the connection immediately, as it has a different parsing strategy. "

Can you fix it, please?

$ autocannon -c 100 -p 100 -d 10 -m POST -b '{"a":1}' http://0.0.0.0:8080
Running 10s test @ http://0.0.0.0:8080
100 connections with 100 pipelining factor

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Stat    β”‚ 2.5% β”‚ 50%  β”‚ 97.5% β”‚ 99%   β”‚ Avg      β”‚ Stdev    β”‚ Max        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Latency β”‚ 0 ms β”‚ 0 ms β”‚ 56 ms β”‚ 82 ms β”‚ 13.01 ms β”‚ 34.33 ms β”‚ 3618.88 ms β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Stat      β”‚ 1%  β”‚ 2.5% β”‚ 50%    β”‚ 97.5%  β”‚ Avg    β”‚ Stdev   β”‚ Min     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Req/Sec   β”‚ 0   β”‚ 0    β”‚ 1253   β”‚ 3683   β”‚ 1655.6 β”‚ 1489.25 β”‚ 26      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Bytes/Sec β”‚ 0 B β”‚ 0 B  β”‚ 231 kB β”‚ 678 kB β”‚ 305 kB β”‚ 274 kB  β”‚ 4.78 kB β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Req/Bytes counts sampled once per second.

17k requests in 10.15s, 3.05 MB read
7k errors (0 timeouts)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ghostcommented, Nov 20, 2019

You can clearly see in Wireshark that autocannon sends invalid HTTP in the case of post. It sends Content-length: 7 followed by 7 bytes of content followed by 2 invalid bytes, breaking the protocol, causing the connection to eventually fail

It works just fine in wrk, https://github.com/wg/wrk as that client actually follows HTTP.

The protocol is like this:

header: value rn header: value rn rnrn content

but autocannon sends

header: value rn header: value rn rnrn content rn <- those shouldn’t be there, they break the protocol, botching the entire benchmark as things deteriorate to HTTP1.0 kind of connection close

0reactions
GlenTikicommented, Nov 20, 2019

Oh, it looks like you’re correct. Thanks for investigating. We add those /r/n for simpler logic for pipelining reasons, I think. I don’t think we realised it was invalid. I’ll put together a fix.

Thanks again!

On Wed 20 Nov 2019, 3:34 p.m. Matteo Collina, notifications@github.com wrote:

I’m happy to take a PR, I’m currently swamped. Il 20 nov 2019, 16:32 +0100, Alex Hultman notifications@github.com, ha scritto:

β€” You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

β€” You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mcollina/autocannon/issues/229?email_source=notifications&email_token=ABUWMBZWJPHG3A6U6LZNDEDQUVKGXA5CNFSM4JPCTER2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEESMGZA#issuecomment-556057444, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUWMBZADJES6DM2N2JUORLQUVKGXANCNFSM4JPCTERQ .

Read more comments on GitHub >

github_iconTop Results From Across the Web

api documentation for autocannon (v0.16.5)
requestIterator (requests, defaults); function autocannon.run (opts, cb) ... setHeadersAndBody(headers, body)`: Used to modify the both the headers and body ...
Read more >
hex - Decoding Thrift Object what are these extra bytes?
Everything sent and everything returned in a Thrift RPC call is packaged in a struct. Every field in a struct has a 1...
Read more >
Exploring the quality attribute and performance ...
about data fetching, focusing more on the experience for the API consumer. ... The open source HTTP benchmarking tool AutoCannon [2] was used...
Read more >
X-COM: UFO Defense Strategy Guide v1.11 - Csabi_B
Title: Strategy Guide 1.11 for X-COM: Enemy Unknown (PSX) Description: Strategic and tactical tips and lists. Revision Log: 1.11 I added ...
Read more >
Ruleset Reference Nightly (OpenXcom)
Determines number and type of starting X-Com soldiers. If a mod contains more than one type of soldiers, this can also be specified...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found