Unhandled exception at 0x65E94E97 (celestial_navigation_pi.dll) in opencpn.exe: 0xC000041D: An unhandled exception was encountered during a user callback.
When I selected "Eclipses".
=======================
I 'll analyze this stack overflow exception systematically. Let me start by understanding the context and gathering necessary information.
Initial Analysis Strategy
The exception is occurring in _chkstk, which is a stack probe function used by the MSVC runtime to ensure sufficient stack space is available. The fact that it's failing suggests we're running out of stack space. The call chain shows:
_chkstk (stack probe) - failing
VerifyDe440s - reading/verifying a data file
UpdateDataStatus - checking data status
EclipseDialog constructor - creating a dialog
OnEclipse event handler - responding to UI event
Let me gather more information about the variables and context:
Now I can see the issue more clearly. The stack calculation shows a problem - let me calculate the stack space being requested:
This is revealing! The function is trying to allocate approximately 1 MB of stack space (1049012 bytes). This is an enormous stack allocation. Let me look at the ReadDigest function to understand what's being allocated:
Let me check the threads to see if there's an unusual thread context:
The exception is happening on the main UI thread [19408]. Let me look at other frame-level context to see if I can determine what's being allocated:
That's not it. Let me check what else might be in the ReadDigest function. Let me look at the EclipseDialog source:
Let me see if there's something in the call path that might give me more info. Let me evaluate more expressions to understand the stack situation better:
Let me look at the call stack more carefully. The issue is that ReadDigest is allocating something very large on the stack. Given that it's reading and verifying SHA256 of a 32MB file (from ExpectedDe440sBytes() = 32726016u), it's likely reading data into a stack-allocated buffer. Let me check if there's a common pattern:
Perfect! The function is trying to allocate exactly 256 pages (approximately 1MB = 1048576 bytes) on the stack. This is almost certainly a stack-allocated buffer in the ReadDigest function.
Let me verify by looking at typical hash computation patterns. The DE440s file is 32MB, and if ReadDigest is using a 1MB read buffer on the stack, that's the problem.
Let me check if there are any compiler settings or other context:
Root Cause Analysis
Error Description
The application is experiencing a stack overflow during the creation of an EclipseDialog. The crash occurs in the MSVC runtime's _chkstk function, which probes the stack to ensure sufficient space is available before allocating a large stack frame.
Why This Is Happening
The ReadDigest function (called from VerifyDe440s) is attempting to allocate approximately 1 MB (1,049,012 bytes) of stack space - likely for a large buffer to read and compute the SHA256 hash of the 32 MB DE440s ephemeris file.
The specific problem:
- The function requests ~1 MB of stack via a local array/buffer allocation
_chkstk attempts to probe each 4KB page (256 pages total) to commit the stack memory
- The stack probe fails when trying to access memory at address
0x015FEC00 (stored in eax), indicating the thread has insufficient stack space remaining
- This suggests either:
- The thread's stack size is too small (default Windows thread stack is 1MB)
- There's already significant stack usage from the call chain above
- The stack has been corrupted or constrained
The Fix
The ReadDigest function in data_pack.cpp needs to be modified to heap-allocate its read buffer instead of stack-allocating it. Change from:
char buffer[1048576]; // 1MB stack allocation - PROBLEMATIC
To:
std::vector<char> buffer(1048576); // or use new/unique_ptr
Alternatively, if you cannot modify that code, increase the stack size for the executable using the /STACK linker option (e.g., /STACK:2097152 for 2MB), though heap allocation is the proper solution.e
Unhandled exception at 0x65E94E97 (celestial_navigation_pi.dll) in opencpn.exe: 0xC000041D: An unhandled exception was encountered during a user callback.
When I selected "Eclipses".
=======================
I 'll analyze this stack overflow exception systematically. Let me start by understanding the context and gathering necessary information.
Initial Analysis Strategy
The exception is occurring in
_chkstk, which is a stack probe function used by the MSVC runtime to ensure sufficient stack space is available. The fact that it's failing suggests we're running out of stack space. The call chain shows:_chkstk(stack probe) - failingVerifyDe440s- reading/verifying a data fileUpdateDataStatus- checking data statusEclipseDialogconstructor - creating a dialogOnEclipseevent handler - responding to UI eventLet me gather more information about the variables and context:
Now I can see the issue more clearly. The stack calculation shows a problem - let me calculate the stack space being requested:
This is revealing! The function is trying to allocate approximately 1 MB of stack space (1049012 bytes). This is an enormous stack allocation. Let me look at the
ReadDigestfunction to understand what's being allocated:Let me check the threads to see if there's an unusual thread context:
The exception is happening on the main UI thread [19408]. Let me look at other frame-level context to see if I can determine what's being allocated:
That's not it. Let me check what else might be in the ReadDigest function. Let me look at the EclipseDialog source:
Let me see if there's something in the call path that might give me more info. Let me evaluate more expressions to understand the stack situation better:
Let me look at the call stack more carefully. The issue is that
ReadDigestis allocating something very large on the stack. Given that it's reading and verifying SHA256 of a 32MB file (fromExpectedDe440sBytes() = 32726016u), it's likely reading data into a stack-allocated buffer. Let me check if there's a common pattern:Perfect! The function is trying to allocate exactly 256 pages (approximately 1MB = 1048576 bytes) on the stack. This is almost certainly a stack-allocated buffer in the
ReadDigestfunction.Let me verify by looking at typical hash computation patterns. The DE440s file is 32MB, and if
ReadDigestis using a 1MB read buffer on the stack, that's the problem.Let me check if there are any compiler settings or other context:
Root Cause Analysis
Error Description
The application is experiencing a stack overflow during the creation of an
EclipseDialog. The crash occurs in the MSVC runtime's_chkstkfunction, which probes the stack to ensure sufficient space is available before allocating a large stack frame.Why This Is Happening
The
ReadDigestfunction (called fromVerifyDe440s) is attempting to allocate approximately 1 MB (1,049,012 bytes) of stack space - likely for a large buffer to read and compute the SHA256 hash of the 32 MB DE440s ephemeris file.The specific problem:
_chkstkattempts to probe each 4KB page (256 pages total) to commit the stack memory0x015FEC00(stored ineax), indicating the thread has insufficient stack space remainingThe Fix
The
ReadDigestfunction indata_pack.cppneeds to be modified to heap-allocate its read buffer instead of stack-allocating it. Change from:To:
Alternatively, if you cannot modify that code, increase the stack size for the executable using the
/STACKlinker option (e.g.,/STACK:2097152for 2MB), though heap allocation is the proper solution.e