diff --git a/src/core/json/json_value.cc b/src/core/json/json_value.cc index 76cd67d18..c191e3f8a 100644 --- a/src/core/json/json_value.cc +++ b/src/core/json/json_value.cc @@ -741,8 +741,10 @@ JSON::defines_any(std::initializer_list keys) const -> bool { return true; } - static std::vector cache; - cache.reserve(size); + // If we re-use the vector across threads, then we will segfault + thread_local std::vector cache; + cache.clear(); + cache.resize(size); for (std::size_t index = 0; index < size; index++) { cache[index] = items[index].fast_hash();