Hacker News new | ask | show | jobs
by scottlamb 480 days ago
> Could an unguarded TreeMap cause 3,200% utilization?

I've seen the same thing with an undersynchronized java.util.HashMap. This would have been in like 2009, but afaik it can still happen today. iirc HashMap uses chaining to resolve collisions; my guess was it introduced a cycle in the chain somehow, but I just got to work nuking the bad code from orbit [1] rather than digging in to verify.

I often interview folks on concurrency knowledge. If they think a data race is only slightly bad, I'm unimpressed, and this is an example of why.

[1] This undersynchronization was far from the only problem with that codebase.

1 comments

Oh no I didn't know this can happen with HashMaps too! Something to do with the linked list they use for collisions?
There's a dead comment replying to yours with this link: https://mailinator.blogspot.com/2009/06/beautiful-race-condi...

...which I don't think I've ever seen before, but nicely explains the problem I saw, and coincidentally is from the same year!