CI: save a minidump if it hangs on shutdown
This commit is contained in:
@@ -415,12 +415,14 @@ jobs:
|
|||||||
- name: Check p2pool.log
|
- name: Check p2pool.log
|
||||||
run: |
|
run: |
|
||||||
cd build/RelWithDebInfo
|
cd build/RelWithDebInfo
|
||||||
|
Remove-Item p2pool.cache -Force
|
||||||
findstr /C:"Synchronization finished successfully" p2pool.log
|
findstr /C:"Synchronization finished successfully" p2pool.log
|
||||||
|
|
||||||
- name: Archive p2pool.log
|
- name: Archive p2pool.log
|
||||||
|
if: '!cancelled()'
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: p2pool_windows_data_leaks
|
name: p2pool_windows_data_leaks
|
||||||
path: |
|
path: |
|
||||||
build/RelWithDebInfo/*.log
|
build/RelWithDebInfo/p2pool.*
|
||||||
build/RelWithDebInfo/data/
|
build/RelWithDebInfo/data/
|
||||||
|
|||||||
@@ -436,12 +436,14 @@ jobs:
|
|||||||
- name: Check p2pool.log
|
- name: Check p2pool.log
|
||||||
run: |
|
run: |
|
||||||
cd build/RelWithDebInfo
|
cd build/RelWithDebInfo
|
||||||
|
Remove-Item p2pool.cache -Force
|
||||||
findstr /C:"Synchronization finished successfully" p2pool.log
|
findstr /C:"Synchronization finished successfully" p2pool.log
|
||||||
|
|
||||||
- name: Archive p2pool.log
|
- name: Archive p2pool.log
|
||||||
|
if: '!cancelled()'
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: p2pool_windows_data_leaks
|
name: p2pool_windows_data_leaks
|
||||||
path: |
|
path: |
|
||||||
build/RelWithDebInfo/*.log
|
build/RelWithDebInfo/p2pool.*
|
||||||
build/RelWithDebInfo/data/
|
build/RelWithDebInfo/data/
|
||||||
|
|||||||
@@ -137,6 +137,27 @@ void show_top_10_allocations()
|
|||||||
VirtualFree(buf, 0, MEM_RELEASE);
|
VirtualFree(buf, 0, MEM_RELEASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DWORD WINAPI minidump_and_crash_thread(LPVOID param)
|
||||||
|
{
|
||||||
|
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|
||||||
|
|
||||||
|
const size_t delay = reinterpret_cast<size_t>(param);
|
||||||
|
Sleep(static_cast<DWORD>(delay));
|
||||||
|
|
||||||
|
HANDLE h = CreateFile(TEXT("p2pool.dmp"), GENERIC_ALL, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||||
|
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), h, MiniDumpWithHandleData, nullptr, nullptr, nullptr);
|
||||||
|
CloseHandle(h);
|
||||||
|
|
||||||
|
TerminateProcess(GetCurrentProcess(), 123);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void minidump_and_crash(size_t delay)
|
||||||
|
{
|
||||||
|
CreateThread(nullptr, 0, minidump_and_crash_thread, reinterpret_cast<LPVOID>(delay), 0, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
FORCEINLINE static void add_alocation(void* p, size_t size)
|
FORCEINLINE static void add_alocation(void* p, size_t size)
|
||||||
{
|
{
|
||||||
if (!track_memory) {
|
if (!track_memory) {
|
||||||
|
|||||||
@@ -2185,6 +2185,11 @@ void SideChain::prune_old_blocks()
|
|||||||
|
|
||||||
m_pool->print_hosts();
|
m_pool->print_hosts();
|
||||||
m_pool->stop();
|
m_pool->stop();
|
||||||
|
|
||||||
|
#ifdef DEV_TRACK_MEMORY
|
||||||
|
// Give it 1 minute to shut down, otherwise save a minidump
|
||||||
|
minidump_and_crash(60 * 1000);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -358,6 +358,7 @@ FORCEINLINE bool get_dns_txt_records(const std::string& host, T&& callback) { re
|
|||||||
|
|
||||||
#ifdef DEV_TRACK_MEMORY
|
#ifdef DEV_TRACK_MEMORY
|
||||||
void show_top_10_allocations();
|
void show_top_10_allocations();
|
||||||
|
void minidump_and_crash(size_t delay);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // namespace p2pool
|
} // namespace p2pool
|
||||||
|
|||||||
Reference in New Issue
Block a user