Fix race condition in APCFileStorage
Summary:
APCFileStorage can have two threads. One in
APCFileStorage::put(), and another in
APCFileStorage::addFile(). addFile() can push a value into m_chunks,
which can trigger a resize. While that resizing is happening, put()
can read from the vector, and read garbage. In particular, in debug
builds, it will read a trash fill value. It uses this value to
construct a pointer, and storing to that garbage value will trigger a
segfault.
It's not safe to push back on a std::vector concurrently like
this. Switch to using tbb::concurrent_vector instead. I don't know why
this hasn't been a problem until now.
Reviewed By: colavitam
Differential Revision:
D26643350
fbshipit-source-id:
f333e001959129ae0a090fbeaac1f2e2897a2602