openmultiplayer / openmultiplayer/open.mp

FlatHashSet<StringView>.emplace error on x64

Open
#871 6 comments 0 reactions 1 assignee View on GitHub

@AmyrAhmady is already working on this.

Since Feb 16, 2024.

bug nightly
Dominant language
C++
Stars
641
Forks
208
PR merge metrics
No merged PRs in 30d

Description

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
4c5372132e08bce1b28489ee12be738f6bb24d98

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.