3 ms·
this is not Ruby. This is unicorn doing some dumb stuff
by rantwasp 6y ago
this is not Ruby. This is unicorn doing some dumb stuff
- jrockway 6y agoI'm not sure what difference it makes. Ultimately, all memory gets reused (you don't throw out your 32GB DIMM after you've written 32GB to it), so some tooling is required to manage the reuse. You can read this story and say "I wouldn't reuse a per-request data structure between requests" or especially "if I did, I wouldn't pass it to a background thread", but it doesn't get at the core of the problem -- if your program has multiple threads of execution, you need some way to check that there isn't unexpected sharing. One way is a tool like ThreadSanitizer, run your tests against it, run 1% of your production traffic against it, and you have a higher probability of detecting data races. Another way is to have some sort of structured concurrency (see "goroutines considered harmful" which was on HN just the other day). Ultimately, I don't think one can ever be happy about "there was a giant security hole in our app, and we only found out because a customer noticed it and reported it to us, it turns out it was in a random library that we didn't even write and so now that we found this everything is fine!" Everything is not fine, and this will just happen again.