mirror of
https://github.com/facebook/sapling.git
synced 2024-10-05 14:28:17 +03:00
really weird std::optional + delayed destructor bug
Summary: my eden-dev on my M1 is always crashing on `eden stop` with this trace: ``` Assertion failed: (dd_->guardCount_ > 0), function ~DestructorGuard, file DelayedDestructionBase.h, line 96. *** Aborted at 1648171587 (Unix time, try 'date -d 1648171587') *** *** Signal 6 (SIGABRT) (0x1bb2fd9b8) received by PID 31226 (pthread TID 0x115a58580) (maybe from PID 31226, UID 501) (code: 0), stack trace: *** I0324 18:26:27.215606 6572327 EdenServer.cpp:1574] mount point "/Users/kmancini/t-fbsource" stopped V0324 18:26:27.215625 6572327 EdenMount.cpp:800] beginning shutdown for EdenMount /Users/kmancini/t-fbsource 0 edenfs#macosx-arm64 0x000000010626a968 _ZN5folly10symbolizer17getStackTraceSafeEPmm + 36 1 edenfs#macosx-arm64 0x000000010611739c _ZN5folly10symbolizer21SafeStackTracePrinter15printStackTraceEb + 108 2 edenfs#macosx-arm64 0x000000010603e854 _ZN5folly10symbolizer12_GLOBAL__N_118innerSignalHandlerEiP9__siginfoPv + 232 3 edenfs#macosx-arm64 0x000000010603c9d4 _ZN5folly10symbolizer12_GLOBAL__N_113signalHandlerEiP9__siginfoPv + 108 4 libsystem_platform.dylib 0x00000001bb3484e4 _sigtramp + 56 5 libsystem_pthread.dylib 0x00000001bb330eb0 pthread_kill + 288 6 libsystem_c.dylib 0x00000001bb26e314 abort + 164 7 libsystem_c.dylib 0x00000001bb26d72c err + 0 8 edenfs#macosx-arm64 0x0000000105148ab0 _ZN5folly22DelayedDestructionBase15DestructorGuardD2 (45261a919d
)Ev + 180 9 edenfs#macosx-arm64 0x0000000105143438 _ZN5folly22DelayedDestructionBase15DestructorGuardD1 (19e5072be0
)Ev + 28 10 edenfs#macosx-arm64 0x0000000104df1eb0 _ZNSt3__124__optional_destruct_baseIN5folly22DelayedDestructionBase15DestructorGuardELb0EED2 (45261a919d
)Ev + 44 11 edenfs#macosx-arm64 0x0000000104df1e74 _ZNSt3__123__optional_storage_baseIN5folly22DelayedDestructionBase15DestructorGuardELb0EED2 (45261a919d
)Ev + 28 12 edenfs#macosx-arm64 0x0000000104df1e48 _ZNSt3__120__optional_copy_baseIN5folly22DelayedDestructionBase15DestructorGuardELb0EED2 (45261a919d
)Ev + 28 13 edenfs#macosx-arm64 0x0000000104df1e1c _ZNSt3__120__optional_move_baseIN5folly22DelayedDestructionBase15DestructorGuardELb0EED2 (45261a919d
)Ev + 28 14 edenfs#macosx-arm64 0x0000000104df1df0 _ZNSt3__127__optional_copy_assign_baseIN5folly22DelayedDestructionBase15DestructorGuardELb0EED2 (45261a919d
)Ev + 28 15 edenfs#macosx-arm64 0x0000000104df1dc4 _ZNSt3__127__optional_move_assign_baseIN5folly22DelayedDestructionBase15DestructorGuardELb0EED2 (45261a919d
)Ev + 28 16 edenfs#macosx-arm64 0x0000000104df1d98 _ZNSt3__18optionalIN5folly22DelayedDestructionBase15DestructorGuardEED2 (45261a919d
)Ev + 28 17 edenfs#macosx-arm64 0x0000000104df1bb8 _ZNSt3__18optionalIN5folly22DelayedDestructionBase15DestructorGuardEED1 (19e5072be0
)Ev + 28 18 edenfs#macosx-arm64 0x0000000104df3364 _ZN8facebook4eden9RpcServer17RpcAcceptCallbackD2 (45261a919d
)Ev + 60 19 edenfs#macosx-arm64 0x0000000104df0bd0 _ZN8facebook4eden9RpcServer17RpcAcceptCallbackD1 (19e5072be0
)Ev + 28 20 edenfs#macosx-arm64 0x0000000104df0bfc _ZN8facebook4eden9RpcServer17RpcAcceptCallbackD0Ev + 28 21 edenfs#macosx-arm64 0x0000000102dfc330 _ZN5folly18DelayedDestruction16onDelayedDestroyEb + 88 22 edenfs#macosx-arm64 0x0000000105148aec _ZN5folly22DelayedDestructionBase15DestructorGuardD2 (45261a919d
)Ev + 240 23 edenfs#macosx-arm64 0x0000000105143438 _ZN5folly22DelayedDestructionBase15DestructorGuardD1 (19e5072be0
)Ev + 28 24 edenfs#macosx-arm64 0x0000000104dedf3c _ZNSt3__124__optional_destruct_baseIN5folly22DelayedDestructionBase15DestructorGuardELb0EE5resetEv + 40 25 edenfs#macosx-arm64 0x0000000104dede20 _ZN8facebook4eden9RpcServer17RpcAcceptCallback13acceptStoppedEv + 416 26 edenfs#macosx-arm64 0x000000010514c260 _ZZN5folly17AsyncServerSocket14RemoteAcceptor4stopEPNS_9EventBaseEPNS0_14AcceptCallbackEENK3$_1clEv + 44 27 edenfs#macosx-arm64 0x000000010514c228 _ZN5folly6detail8function14FunctionTraitsIFvvEE9callSmallIZNS_17AsyncServerSocket14RemoteAcceptor4stopEPNS_9EventBaseEPNS6_14AcceptCallbackEE3$_1EEvRNS1_4DataE + 32 28 edenfs#macosx-arm64 0x0000000101fc287c _ZN5folly6detail8function14FunctionTraitsIFvvEEclEv + 40 29 edenfs#macosx-arm64 0x0000000105d3b40c _ZN5folly9EventBase20FunctionLoopCallback15runLoopCallbackEv + 32 30 edenfs#macosx-arm64 0x0000000105d3476c _ZN5folly9EventBase16runLoopCallbacksERN5boost9intrusive4listINS0_12LoopCallbackENS2_18constant_time_sizeILb0EEEvvvEE + 120 31 edenfs#macosx-arm64 0x0000000105d31ef0 _ZN5folly9EventBase16runLoopCallbacksEv + 88 32 edenfs#macosx-arm64 0x0000000105d336a8 _ZN5folly9EventBase8loopBodyEib + 1396 33 edenfs#macosx-arm64 0x0000000105d31c10 _ZN5folly9EventBase8loopOnceEi + 44 34 edenfs#macosx-arm64 0x000000010201a700 _ZN8facebook4eden10EdenServer14performCleanupEv + 2004 35 edenfs#macosx-arm64 0x0000000101fb8d80 _ZN8facebook4eden11runEdenMainEONS0_8EdenMainEiPPc + 3240 36 edenfs#macosx-arm64 0x0000000101f5e56c main + 56 37 dyld 0x00000001159e50f4 start + 520 (safe mode, symbolizer not available) ``` for some reason the destructor is being called twice even though the constructor is only called once. this makes the delated destructor count double decrement and hit its internal assert. I think this is because std::optional is directly calling the destructor on the value maybe and so it is being double destructed. keeping a direct member variable gets rid of the crash. This probably deserves a follow up to understand why std::optional is doing this. Reviewed By: xavierd Differential Revision: D35134797 fbshipit-source-id: 6b9184c878962b7f773f6be55ac70a83dc00fa42
This commit is contained in:
parent
45d88665a8
commit
7ba3360a97
@ -481,7 +481,7 @@ void RpcServer::RpcAcceptCallback::acceptError(
|
||||
void RpcServer::RpcAcceptCallback::acceptStopped() noexcept {
|
||||
// We won't ever be accepting any connection, it is now safe to delete
|
||||
// ourself, release the guard.
|
||||
guard_.reset();
|
||||
{ auto guard = std::move(guard_); }
|
||||
}
|
||||
|
||||
auth_stat RpcServerProcessor::checkAuthentication(
|
||||
|
@ -398,7 +398,7 @@ class RpcServer : public std::enable_shared_from_this<RpcServer> {
|
||||
* Hold a guard to ourself to avoid being deleted until the callback is
|
||||
* removed from the AsyncServerSocket.
|
||||
*/
|
||||
std::optional<folly::DelayedDestruction::DestructorGuard> guard_;
|
||||
folly::DelayedDestruction::DestructorGuard guard_;
|
||||
};
|
||||
|
||||
// main event base that is used for socket interactions. Do not block this
|
||||
|
Loading…
Reference in New Issue
Block a user