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

write a minidump if ziti-edge-tunnel crashes on windows #1084

Merged
merged 2 commits into from
Jan 10, 2025

Conversation

dovholuknf
Copy link
Member

writes a mini crash dump with thread info file on unhandled exceptions

@dovholuknf dovholuknf requested a review from a team as a code owner January 9, 2025 20:47
@dovholuknf
Copy link
Member Author

tested by adding this to static void WINAPI if_change_cb(PVOID CallerContext, PMIB_IPINTERFACE_ROW Row, MIB_NOTIFICATION_TYPE NotificationType) {:

        int* p = NULL;
        *p = 42;

After execution you see this is stdout:

minidump created at: D:\git\github\openziti\ziti-tunnel-sdk-c\build\cwdming\programs\ziti-edge-tunnel\logs\service\ziti-edge-tunnel.crash.dmp

Open the dmp with WinDbg and run !analyze -v and useful output pops out:


STACK_TEXT:  
000000c5`7c5ff0c0 00007fff`03b62b39     : 00000283`61333620 00000000`00000000 00000283`00000003 00000283`5f327710 : ziti_edge_tunnel!if_change_cb+0x108
000000c5`7c5ff2d0 00007fff`03b61390     : 00007fff`053ea5f0 00000000`00000002 00000283`5f33da10 00000000`00000002 : winnsi!NsiRpcRegisterChangeNotificationEx+0x1619
000000c5`7c5ff470 00007fff`053e2cfe     : 00000283`5f33dda0 00000000`00000000 00000283`5f33da10 00000283`5f33db01 : winnsi!NsiRpcRegisterChangeNotification+0x60
000000c5`7c5ff4f0 00007fff`053e2e84     : 00000283`5f33da10 00000283`61333620 00000000`00000002 00007ff7`b898bcca : IPHLPAPI!InternalRegisterChangeNotification+0x9a
000000c5`7c5ff550 00007ff7`b898b099     : 00000000`0000000a 000000c5`7c5ff610 00000000`00000000 00000000`00000000 : IPHLPAPI!NotifyIpInterfaceChange+0xc4
000000c5`7c5ff590 00007ff7`b8984dcf     : 00007ff7`b91a5200 00000000`01004064 000000c5`7c5ff960 000000c5`7c5ff9a0 : ziti_edge_tunnel!tun_open+0x442
000000c5`7c5ff7b0 00007ff7`b8986f27     : 00007ff7`b91a5200 00000000`01004064 00007ff7`02004064 00000283`61333dd0 : ziti_edge_tunnel!run_tunnel+0x105
000000c5`7c5ffa30 00007ff7`b89856a3     : 000000c5`00000000 00000283`5f732560 000000c5`7c5ffb90 00007ff7`b8985c6e : ziti_edge_tunnel!run+0x793
000000c5`7c5ffb40 00007ff7`b8985753     : 00007ff7`b8fdf320 00007ff7`00000000 00000283`5f732560 00000000`00000427 : ziti_edge_tunnel!commandline_run+0x121
000000c5`7c5ffba0 00007ff7`b8989fbc     : 00007ff7`b8fdf0e0 00000000`00000003 00000283`5f732548 00000004`00000000 : ziti_edge_tunnel!commandline_run+0x1d1
000000c5`7c5ffc00 00007ff7`b8981340     : 00007ff7`00000004 00000283`5f732540 00000000`00000000 00000000`00000000 : ziti_edge_tunnel!main+0xe3
000000c5`7c5ffc40 00007ff7`b8981146     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ziti_edge_tunnel+0x1340
000000c5`7c5ffcc0 00007fff`0782259d     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ziti_edge_tunnel+0x1146
000000c5`7c5ffd00 00007fff`0970af38     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : kernel32!BaseThreadInitThunk+0x1d
000000c5`7c5ffd30 00000000`00000000     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x28


STACK_COMMAND:  ~0s; .ecxr ; kb

FAULTING_SOURCE_LINE:  D:/git/github/openziti/ziti-tunnel-sdk-c/programs/ziti-edge-tunnel/netif_driver/windows/tun.c

FAULTING_SOURCE_FILE:  D:/git/github/openziti/ziti-tunnel-sdk-c/programs/ziti-edge-tunnel/netif_driver/windows/tun.c

FAULTING_SOURCE_LINE_NUMBER:  450

FAULTING_SOURCE_CODE:  
   446:     int rc = GetIpForwardEntry2(&rt);
   447:     if (rc == NO_ERROR) {
   448: 
   449:     int* p = NULL;
>  450:     *p = 42;
   451: 
   452:         if (default_rt.InterfaceIndex != rt.InterfaceIndex) {
   453:             ZITI_LOG(INFO, "default route is now via if_idx[%d]", rt.InterfaceIndex);
   454:             default_rt.InterfaceIndex = rt.InterfaceIndex;
   455:             default_rt.InterfaceLuid = rt.InterfaceLuid;

@dovholuknf dovholuknf merged commit 5ef54ac into main Jan 10, 2025
11 checks passed
@dovholuknf dovholuknf deleted the write-minidump-on-crash branch January 10, 2025 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants