return FALSE; $r = well_tag_thread__update(array('id' => $id), $update); return $r; } function well_tag_thread_find($tagid, $page, $pagesize) { $arr = well_tag_thread__find(array('tagid' => $tagid), array('id' => -1), $page, $pagesize); return $arr; } function well_tag_thread_find_by_tid($tid, $page, $pagesize) { $arr = well_tag_thread__find(array('tid' => $tid), array(), $page, $pagesize); return $arr; } ?>c++ - Crash in StatsThread in unreal engine 4 during memory free operation - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c++ - Crash in StatsThread in unreal engine 4 during memory free operation - Stack Overflow

programmeradmin0浏览0评论

I am experiencing the following crash in a running instance of unreal engine 4 in editor game simulation:

Exception thrown at 0x00007FFD1E29551B (UE4Editor-Core.dll) in UE4Editor-Win64-DebugGame.exe: 0xC0000005: Access violation writing location 0x0000000000000010.

This is during the function:

FMEMORY_INLINE_FUNCTION_DECORATOR void FMemory::Free(void* Original)
{
  //...
  MEMORY_INLINE_GMalloc->Free(Original); // <- Here
}

I will pop the stack trace and threading details down the bottom. I have tried to create an MCVE, but i cannot. Minimal game instances do not seem to show this issue even with the same installed version of UE. (4.27). So something about the complexity of a large game is potentially causing the issue. Some additional observations though:

  1. Turning on statistics gathering of any type causes this to occur almost instantly:
  2. Using stat fps from the command console causes this to happen almost instantly.
  3. Using debug drawing (eg. DrawDebugPoint) from c++ causes this to happen much faster.
  4. Sometimes a system restart will eliminate this problem for a short time. \
  5. It never occurs in a "cooked" game (aka built in release and run without the editor). I suspect it is because this stat collection only occurs in the editor.
  6. Building for release or debug game editor seems to make no difference.
  7. Turning off "show stats" doubles the amount of time before the crash occurs.

I am not sure how to debug this, it appears to be something buggy, potentially in the UE system. Are there any suggestions about how to go about resolving this?


Additional Details

Stack trace:

    UE4Editor-Core.dll!__TBB_LockByte(unsigned char &)  Unknown
    UE4Editor-Core.dll!rml::internal::Block::freePublicObject(struct rml::internal::FreeObject *)   Unknown
    UE4Editor-Core.dll!scalable_free()  Unknown
    UE4Editor-Core.dll!FMemory::Free(void * Original) Line 80   C++
    UE4Editor-Core.dll!operator delete(void * Ptr, unsigned __int64 Size) Line 33   C++
    [Inline Frame] UE4Editor-Core.dll!TIndirectArray<TChunkedArray<FStatMessage,4096>::FChunk,TSizedDefaultAllocator<32>>::DestructAndFreeItems() Line 434  C++
    [Inline Frame] UE4Editor-Core.dll!TIndirectArray<TChunkedArray<FStatMessage,4096>::FChunk,TSizedDefaultAllocator<32>>::Empty(int) Line 340  C++
    UE4Editor-Core.dll!TIndirectArray<TChunkedArray<FStatMessage,4096>::FChunk,TSizedDefaultAllocator<32>>::~TIndirectArray<TChunkedArray<FStatMessage,4096>::FChunk,TSizedDefaultAllocator<32>>() Line 74  C++
    UE4Editor-Core.dll!FStatPacketArray::Empty() Line 619   C++
    [Inline Frame] UE4Editor-Core.dll!FStatPacketArray::{dtor}() Line 218   C++
    [Inline Frame] UE4Editor-Core.dll!TSparseArray<TSetElement<TTuple<__int64,FStatPacketArray>>,TSparseArrayAllocator<TSizedDefaultAllocator<32>,FDefaultBitArrayAllocator>>::RemoveAt(int) Line 299   C++
    UE4Editor-Core.dll!TSet<TTuple<__int64,FStatPacketArray>,TDefaultMapHashableKeyFuncs<__int64,FStatPacketArray,0>,FDefaultSetAllocator>::Remove(FSetElementId ElementId) Line 770    C++
    [Inline Frame] UE4Editor-Core.dll!TSet<TTuple<__int64,FStatPacketArray>,TDefaultMapHashableKeyFuncs<__int64,FStatPacketArray,0>,FDefaultSetAllocator>::TIterator::RemoveCurrent() Line 1577 C++
    [Inline Frame] UE4Editor-Core.dll!TMapBase<__int64,FStatPacketArray,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<__int64,FStatPacketArray,0>>::TIterator::RemoveCurrent() Line 904  C++
    UE4Editor-Core.dll!FStatsThreadState::AddToHistoryAndEmpty(FStatPacketArray & NewData) Line 998 C++
    UE4Editor-Core.dll!FStatsThread::Tick() Line 979    C++
    UE4Editor-Core.dll!FStatsThread::StatMessage(FStatPacket * Packet) Line 1007    C++
    [Inline Frame] UE4Editor-Core.dll!FStatMessagesTask::DoTask(ENamedThreads::Type) Line 1064  C++
    UE4Editor-Core.dll!TGraphTask<FStatMessagesTask>::ExecuteTask(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32>> & NewTasks, ENamedThreads::Type CurrentThread) Line 886   C++
    [Inline Frame] UE4Editor-Core.dll!FBaseGraphTask::Execute(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32>> & CurrentThread, ENamedThreads::Type) Line 524    C++
    UE4Editor-Core.dll!FNamedTaskThread::ProcessTasksNamedThread(int QueueIndex, bool bAllowStall) Line 710 C++
    UE4Editor-Core.dll!FNamedTaskThread::ProcessTasksUntilQuit(int QueueIndex) Line 602 C++
    UE4Editor-Core.dll!FStatsThread::Run() Line 906 C++
    UE4Editor-Core.dll!FRunnableThreadWin::Run() Line 86    C++
    UE4Editor-Core.dll!FRunnableThreadWin::GuardedRun() Line 27 C++

I am experiencing the following crash in a running instance of unreal engine 4 in editor game simulation:

Exception thrown at 0x00007FFD1E29551B (UE4Editor-Core.dll) in UE4Editor-Win64-DebugGame.exe: 0xC0000005: Access violation writing location 0x0000000000000010.

This is during the function:

FMEMORY_INLINE_FUNCTION_DECORATOR void FMemory::Free(void* Original)
{
  //...
  MEMORY_INLINE_GMalloc->Free(Original); // <- Here
}

I will pop the stack trace and threading details down the bottom. I have tried to create an MCVE, but i cannot. Minimal game instances do not seem to show this issue even with the same installed version of UE. (4.27). So something about the complexity of a large game is potentially causing the issue. Some additional observations though:

  1. Turning on statistics gathering of any type causes this to occur almost instantly:
  2. Using stat fps from the command console causes this to happen almost instantly.
  3. Using debug drawing (eg. DrawDebugPoint) from c++ causes this to happen much faster.
  4. Sometimes a system restart will eliminate this problem for a short time. \
  5. It never occurs in a "cooked" game (aka built in release and run without the editor). I suspect it is because this stat collection only occurs in the editor.
  6. Building for release or debug game editor seems to make no difference.
  7. Turning off "show stats" doubles the amount of time before the crash occurs.

I am not sure how to debug this, it appears to be something buggy, potentially in the UE system. Are there any suggestions about how to go about resolving this?


Additional Details

Stack trace:

    UE4Editor-Core.dll!__TBB_LockByte(unsigned char &)  Unknown
    UE4Editor-Core.dll!rml::internal::Block::freePublicObject(struct rml::internal::FreeObject *)   Unknown
    UE4Editor-Core.dll!scalable_free()  Unknown
    UE4Editor-Core.dll!FMemory::Free(void * Original) Line 80   C++
    UE4Editor-Core.dll!operator delete(void * Ptr, unsigned __int64 Size) Line 33   C++
    [Inline Frame] UE4Editor-Core.dll!TIndirectArray<TChunkedArray<FStatMessage,4096>::FChunk,TSizedDefaultAllocator<32>>::DestructAndFreeItems() Line 434  C++
    [Inline Frame] UE4Editor-Core.dll!TIndirectArray<TChunkedArray<FStatMessage,4096>::FChunk,TSizedDefaultAllocator<32>>::Empty(int) Line 340  C++
    UE4Editor-Core.dll!TIndirectArray<TChunkedArray<FStatMessage,4096>::FChunk,TSizedDefaultAllocator<32>>::~TIndirectArray<TChunkedArray<FStatMessage,4096>::FChunk,TSizedDefaultAllocator<32>>() Line 74  C++
    UE4Editor-Core.dll!FStatPacketArray::Empty() Line 619   C++
    [Inline Frame] UE4Editor-Core.dll!FStatPacketArray::{dtor}() Line 218   C++
    [Inline Frame] UE4Editor-Core.dll!TSparseArray<TSetElement<TTuple<__int64,FStatPacketArray>>,TSparseArrayAllocator<TSizedDefaultAllocator<32>,FDefaultBitArrayAllocator>>::RemoveAt(int) Line 299   C++
    UE4Editor-Core.dll!TSet<TTuple<__int64,FStatPacketArray>,TDefaultMapHashableKeyFuncs<__int64,FStatPacketArray,0>,FDefaultSetAllocator>::Remove(FSetElementId ElementId) Line 770    C++
    [Inline Frame] UE4Editor-Core.dll!TSet<TTuple<__int64,FStatPacketArray>,TDefaultMapHashableKeyFuncs<__int64,FStatPacketArray,0>,FDefaultSetAllocator>::TIterator::RemoveCurrent() Line 1577 C++
    [Inline Frame] UE4Editor-Core.dll!TMapBase<__int64,FStatPacketArray,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<__int64,FStatPacketArray,0>>::TIterator::RemoveCurrent() Line 904  C++
    UE4Editor-Core.dll!FStatsThreadState::AddToHistoryAndEmpty(FStatPacketArray & NewData) Line 998 C++
    UE4Editor-Core.dll!FStatsThread::Tick() Line 979    C++
    UE4Editor-Core.dll!FStatsThread::StatMessage(FStatPacket * Packet) Line 1007    C++
    [Inline Frame] UE4Editor-Core.dll!FStatMessagesTask::DoTask(ENamedThreads::Type) Line 1064  C++
    UE4Editor-Core.dll!TGraphTask<FStatMessagesTask>::ExecuteTask(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32>> & NewTasks, ENamedThreads::Type CurrentThread) Line 886   C++
    [Inline Frame] UE4Editor-Core.dll!FBaseGraphTask::Execute(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32>> & CurrentThread, ENamedThreads::Type) Line 524    C++
    UE4Editor-Core.dll!FNamedTaskThread::ProcessTasksNamedThread(int QueueIndex, bool bAllowStall) Line 710 C++
    UE4Editor-Core.dll!FNamedTaskThread::ProcessTasksUntilQuit(int QueueIndex) Line 602 C++
    UE4Editor-Core.dll!FStatsThread::Run() Line 906 C++
    UE4Editor-Core.dll!FRunnableThreadWin::Run() Line 86    C++
    UE4Editor-Core.dll!FRunnableThreadWin::GuardedRun() Line 27 C++
Share Improve this question edited Mar 18 at 22:35 Fantastic Mr Fox asked Mar 18 at 22:28 Fantastic Mr FoxFantastic Mr Fox 34k28 gold badges104 silver badges187 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

We found a workaround, this does not tell us why this happens and it severely limits some of the functionalities. But if you call:

FThreadStats::MasterDisableForever();

From somewhere in your game startup then this thread is never run and we never get this issue. Of course this means that you will not be able to utilize any of the stats.

Obviously a preferred solution would be to figure out why this crash happens in the first place rather than avoid it.

发布评论

评论列表(0)

  1. 暂无评论