Skip to content
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

std::chrono::current_zone crashes on MSVC builds #3500

Open
rogerorr opened this issue Apr 6, 2022 · 8 comments
Open

std::chrono::current_zone crashes on MSVC builds #3500

rogerorr opened this issue Apr 6, 2022 · 8 comments
Assignees
Labels
bug MS/Windows Microsoft or Windows specific issues

Comments

@rogerorr
Copy link

rogerorr commented Apr 6, 2022

The simple program in https://godbolt.org/z/Gs35jzodK that compiles:

#include <chrono>

int main() {
  (void)std::chrono::current_zone();
}

crashes on MSVC builds with error :
Program returned: 3221226505
(this is STATUS_STACK_BUFFER_OVERRUN)

@mattgodbolt mattgodbolt added bug MS/Windows Microsoft or Windows specific issues labels Apr 6, 2022
@mattgodbolt
Copy link
Member

Thanks! We've had reports but couldn't work out what the error message was. We're trying to work out what in our sandboxing code might be causing this.

@rogerorr
Copy link
Author

rogerorr commented Apr 6, 2022

I'm not sure why it fails with that error.
But I note that calling std::chrono::current_zone() on my own Windows machine loads some DLLs:

Load DLL at 00007FF97AF30000 C:\WINDOWS\SYSTEM32\icu.dll
Load DLL at 00007FF99CB60000 C:\WINDOWS\System32\ucrtbase.dll
Load DLL at 00007FF99C740000 C:\WINDOWS\System32\msvcp_win.dll
Load DLL at 00007FF99B3D0000 C:\WINDOWS\SYSTEM32\kernel.appcore.dll

@rogerorr
Copy link
Author

rogerorr commented Apr 6, 2022

So, using https://godbolt.org/z/7j38r36sT:

#include <chrono>
#include <iostream>
#include <stdexcept>
#include <typeinfo>

int main() {
    std::cout << "Test" << std::endl;
    try {
      (void)std::chrono::current_zone();
    } catch (const std::exception& ex) {
      std::cout << typeid(ex).name() << ": " << ex.what() << std::endl;
    }
}

I get output:

Program returned: 0
   Test
   class std::system_error: The specified module could not be found.

Does your sandboxed env offer icu.dll?

@mattgodbolt
Copy link
Member

Thanks @rogerorr - we've asked the MS team to look in and see if there's something missing. Super helpful, thanks :)

@StephanTLavavej
Copy link

https://github.com/microsoft/STL/wiki/VS-2019-Changelog#vs-2019-1610

While the STL generally provides all features on all supported versions of Windows, leap seconds and time zones (which change over time) require OS support that was added to Windows 10. Specifically, updating the leap second database requires Windows 10 version 1809 or later, and time zones require icu.dll which is provided by Windows 10 version 1903/19H1 or later. This applies to both client and server OSes; note that Windows Server 2019 is based on Windows 10 version 1809.

If the VMs are using Windows Server 2019, that would explain this - it's too old for time zones. Windows Server 2022 will work (that's what the STL's own test VMs use).

@mattgodbolt
Copy link
Member

Thanks all! We'll see about the OS!

@timmy-ms
Copy link
Contributor

timmy-ms commented Jun 3, 2022

We are currently blocked by the version of Windows that Kubernetes supports. As soon as we can upgrade to Server 2022 we will. Until then there is nothing we can do here sadly. :(

@timmy-ms timmy-ms self-assigned this Jun 6, 2022
@haephrati
Copy link

I had the same problems on certain Windows machines that just crashed when any timezone is set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug MS/Windows Microsoft or Windows specific issues
Projects
None yet
Development

No branches or pull requests

5 participants