tsenart/vegeta — pull request #30 by timjnh (2013-10-30 18:42:43+00:00)
Title: Concurrency resolution

Hey,
I found that at high request rates when targets contained different auth info (e.g. http://timj:welcome@mytarget.com) we'd see cases where requests were sent with the wrong auth headers. For example we'd see that a request with timj:welcome would be made with authorization headers for otheruser:unwelcome. This resulted in 403s, etc.

I tried for quite a while to come up with a simple repro case but was unsuccessful. It seems you need live-ish requests with lots of variability in response times. In my tests I found that it took a request rate of 50/s or higher to show the problem.

I eventually discovered that it's because the Header instances (and possibly the targets) are shared across threads leading to concurrency problems. The attached diff passes the target/header info around as strings and Request/Header instances are created at the last moment.

-Tim