Modify LocalLifetime destructor to clear local cache#2670
Conversation
`destroy(getWrapper())` re-enters `ThreadLocalPtr::get()` while TLS destructors are already running. This crashes sometimes, see e.g. facebook#2002. Instead avoid re-entering `ThreadLocal` in the TLS destructor and only clears the local fast-path cache `getLocalCache().object = nullptr`, which is sufficient to prevent stale reuse. Signed-off-by: Henri Menke <henri@henrimenke.de>
|
Hi @hmenke! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
I will never sign a CLA! This patch is offered under the Developer Certificate of Origin. Do with that what you want. |
destroy(getWrapper())re-entersThreadLocalPtr::get()while TLS destructors are already running. This crashes sometimes, see e.g. #2002. Instead avoid re-enteringThreadLocalin the TLS destructor and only clears the local fast-path cachegetLocalCache().object = nullptr, which is sufficient to prevent stale reuse.fixes #1252 , fixes #2002