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

FlatHashSet<StringView>.emplace error on x64 #871

Open
ikkentim opened this issue Feb 16, 2024 · 3 comments
Open

FlatHashSet<StringView>.emplace error on x64 #871

ikkentim opened this issue Feb 16, 2024 · 3 comments
Assignees
Labels
bug Something isn't working nightly

Comments

@ikkentim
Copy link

ikkentim commented Feb 16, 2024

Describe the bug
When adding a command name to the commands set, I get a debug assertion when running the cmdlist command. This only happens on x64. It works fine on x86.

To Reproduce
Tested on Windows

void onConsoleCommandListRequest(FlatHashSet<StringView>& commands)
{
    commands.emplace("foobar");
}

(repro repo https://github.com/ikkentim/open.mp-repro-x64-error/blob/ea41b85c3a49423b1b71bb2d0285e30706a9b029/main.cpp#L55C1-L58C3 )

  • run the cmdlist command in the server console
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Debug Assertion Failed!

Program: D:\openmp\x64\omp-server.exe
File: minkernel\crts\ucrt\src\appcrt\heap\debug_heap.cpp
Line: 904

Expression: _CrtIsValidHeapPointer(block)

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.

(Press Retry to debug the application)

---------------------------
Abort   Retry   Ignore   
---------------------------
ntdll.dll!00007ffb7308a412()
ntdll.dll!00007ffb7304cf3c()
ntdll.dll!00007ffb72fee1f5()
KernelBase.dll!00007ffb70cb4efb()
ucrtbased.dll!00007ffa8294e852()
ucrtbased.dll!00007ffa8294ca91()
ucrtbased.dll!00007ffa82950275()
ucrtbased.dll!00007ffa82950988()
test.dll!robin_hood::detail::NodeAllocator<nonstd::sv_lite::basic_string_view<char,std::char_traits<char>>,4,16384,1>::addOrFree(void * ptr, unsigned __int64 q) Line 551
test.dll!robin_hood::detail::Table<1,80,nonstd::sv_lite::basic_string_view<char,std::char_traits<char>>,void,robin_hood::hash<nonstd::sv_lite::basic_string_view<char,std::char_traits<char>>,void>,std::equal_to<nonstd::sv_lite::basic_string_view<char,std::char_traits<char>>>>::rehashPowerOfTwo(unsigned __int64 numBuckets, bool forceFree) Line 2247
test.dll!robin_hood::detail::Table<1,80,nonstd::sv_lite::basic_string_view<char,std::char_traits<char>>,void,robin_hood::hash<nonstd::sv_lite::basic_string_view<char,std::char_traits<char>>,void>,std::equal_to<nonstd::sv_lite::basic_string_view<char,std::char_traits<char>>>>::increase_size() Line 2455
test.dll!robin_hood::detail::Table<1,80,nonstd::sv_lite::basic_string_view<char,std::char_traits<char>>,void,robin_hood::hash<nonstd::sv_lite::basic_string_view<char,std::char_traits<char>>,void>,std::equal_to<nonstd::sv_lite::basic_string_view<char,std::char_traits<char>>>>::insertKeyPrepareEmptySpot<const nonstd::sv_lite::basic_string_view<char,std::char_traits<char>> &>(const nonstd::sv_lite::basic_string_view<char,std::char_traits<char>> & key) Line 2366
test.dll!robin_hood::detail::Table<1,80,nonstd::sv_lite::basic_string_view<char,std::char_traits<char>>,void,robin_hood::hash<nonstd::sv_lite::basic_string_view<char,std::char_traits<char>>,void>,std::equal_to<nonstd::sv_lite::basic_string_view<char,std::char_traits<char>>>>::emplace<std::string &>(std::string & args) Line 1800
test.dll!TestComponent::onConsoleCommandListRequest(robin_hood::detail::Table<1,80,nonstd::sv_lite::basic_string_view<char,std::char_traits<char>>,void,robin_hood::hash<nonstd::sv_lite::basic_string_view<char,std::char_traits<char>>,void>,std::equal_to<nonstd::sv_lite::basic_string_view<char,std::char_traits<char>>>> & commands) Line 85

Expected behavior
No error, a list of available commands in the console window

Commit hash in master
4c53721

specifically this build https://github.com/openmultiplayer/open.mp/actions/runs/7776007038 : open.mp-win-x64-v1.2.0.2670-1-g4c537213

@ikkentim ikkentim added bug Something isn't working nightly labels Feb 16, 2024
@Hual
Copy link
Collaborator

Hual commented Feb 17, 2024

Are you building the component with the debug runtime (/MDd)?

@ikkentim
Copy link
Author

Ah yes, I was building with debug runtime. I build it with release runtime now and it's fine. Turns out I'm just an idiot.

Thanks for you help :)

@Hual
Copy link
Collaborator

Hual commented Mar 8, 2024

This should still be improved

@Hual Hual reopened this Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working nightly
Projects
None yet
Development

No branches or pull requests

3 participants