-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
constexpr
mutex
constructor
#3824
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Thanks, this looks great! I pushed extremely minor changes. Having thought about this extensively during the previous PR, I think that this change is correct and safe, and it's a good simplification too. |
This comment was marked as outdated.
This comment was marked as outdated.
Unfortunately, I need to pull this from the merge batch. It's causing the internal build to consistently fail with:
I don't know what's causing this yet. |
I've had to push an additional commit to avoid a
|
Thanks for fixing this unfixable bug!!! 😻 😻 😻 |
It turns out that the STL requires you to place the DLLs into the directory of the executable; else, msvcp140.dll will be taken from C:\Windows\System32 (which is unsupported). This was discovered because of the recent constexpr mutex change; see [microsoft/STL#3824][]. Especially the fuzzer unit tests fail completely with the mutex changes. [microsoft/STL#3824]: microsoft/STL#3824 Differential Revision: https://reviews.llvm.org/D158221
This reverts commit 8d18fec. Conflicts: * stl/inc/xthreads.h * stl/src/cond.cpp * stl/src/mutex.cpp * stl/src/primitives.hpp
microsoft/STL#3824 introduces constexpr mutex. An older version of msvcp140.dll will lead to ```A dynamic link library (DLL) initialization routine failed```. This error can be encountered if using conda Python since conda packages msvc dlls and these are older right now. This PR disables the constexpr mutex so that ort package can work with older msvc dlls. Thanks @snnn for the discovery.
microsoft/STL#3824 introduces constexpr mutex. An older version of msvcp140.dll will lead to ```A dynamic link library (DLL) initialization routine failed```. This error can be encountered if using conda Python since conda packages msvc dlls and these are older right now. This PR disables the constexpr mutex so that ort package can work with older msvc dlls. Thanks @snnn for the discovery.
microsoft/STL#3824 introduces constexpr mutex. An older version of msvcp140.dll will lead to ```A dynamic link library (DLL) initialization routine failed```. This error can be encountered if using conda Python since conda packages msvc dlls and these are older right now. This PR disables the constexpr mutex so that ort package can work with older msvc dlls. Thanks @snnn for the discovery.
microsoft/STL#3824 microsoft/STL#4000 microsoft/STL#4339 Add escape hatch due to STL change resulting in issues with binary compatibility. https://github.com/microsoft/STL/wiki/Changelog "Fixed bugs: Fixed mutex's constructor to be constexpr. #3824 #4000 #4339 Note: Programs that aren't following the documented restrictions on binary compatibility may encounter null dereferences in mutex machinery. You must follow this rule: When you mix binaries built by different supported versions of the toolset, the Redistributable version must be at least as new as the latest toolset used by any app component. You can define _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR as an escape hatch."
STL updates Mutex Fix microsoft/STL#3824 microsoft/STL#4000 microsoft/STL#4339 Add escape hatch due to STL change resulting in issues with binary compatibility. https://github.com/microsoft/STL/wiki/Changelog "Fixed bugs: Fixed mutex's constructor to be constexpr. #3824 #4000 #4339 Note: Programs that aren't following the documented restrictions on binary compatibility may encounter null dereferences in mutex machinery. You must follow this rule: When you mix binaries built by different supported versions of the toolset, the Redistributable version must be at least as new as the latest toolset used by any app component. You can define _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR as an escape hatch."**Description**
See [MSVC-PR-490940][] and [LLVM-D158221][]. It turns out that the STL requires you to place the DLLs into the directory of the executable; else, `msvcp140.dll` will be taken from `C:\Windows\System32` (which is unsupported). This was discovered because of the recent constexpr mutex change; see [microsoft/STL#3824][]. Especially the fuzzer unit tests fail completely with the mutex changes. [MSVC-PR-490940]: https://dev.azure.com/devdiv/DevDiv/_git/msvc/pullrequest/490940 [LLVM-D158221]: https://reviews.llvm.org/D158221 [microsoft/STL#3824]: microsoft/STL#3824
Fixes #2285.
Because this might cause problem in complicated (and formally forbidden) scenarios (see discussion in #3770), I chose to make this opt-in via the_USE_CONSTEXPR_MUTEX_CONSTRUCTOR
macro. If_USE_CONSTEXPR_MUTEX_CONSTRUCTOR
is not defined,mutex
will call_Mtx_init_in_situ
as before.For the same reason, I changedstl_critical_section_win7
andstl_condition_variable_win7
back to polymorphic classes, even though their vptrs are no longer accessed. (If_USE_CONSTEXPR_MUTEX_CONSTRUCTOR
is defined, nostl_critical_section_win7
object will be created.)