Fix InMemoryCircularBuffer merge failure with large CircularMB#2439
Open
cincuranet wants to merge 1 commit into
Open
Fix InMemoryCircularBuffer merge failure with large CircularMB#2439cincuranet wants to merge 1 commit into
cincuranet wants to merge 1 commit into
Conversation
When collecting with /InMemoryCircularBuffer and /CircularMB:N where N is larger than ~256, PerfView collection succeeds but the subsequent KernelTraceControl merge fails (e.g. CreateMergedTraceFile returns 0x80280012), and the requested memory grows quadratically. The buffering-mode branch of GetProperties overwrote properties->BufferSize with m_CircularBufferMB. BufferSize is a per-buffer size in KB, so a megabyte value was being written into a kilobyte field. This made each ETW buffer far larger than the OS maximum buffer size, which the relogger later chokes on during merge, and it contradicted the MinimumBuffers computation on the line above (which divides by the 64 KB quantum). It also corrupted the Attach round-trip that reconstructs buffer settings when stopping the session. Remove the erroneous assignment so BufferSize stays at the per-buffer quantum (m_BufferQuantumKB) set earlier, matching the file-based and real-time paths. MinimumBuffers alone now sizes the in-memory pool, so (MinimumBuffers * BufferSize) == m_CircularBufferMB megabytes as intended. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When collecting with
/InMemoryCircularBufferand/CircularMB:NwhereNis larger than ~256, PerfView collection succeeds but the subsequent KernelTraceControl merge fails (e.g. CreateMergedTraceFile returns0x80280012), and the requested memory grows quadratically.The buffering-mode branch of
GetPropertiesoverwroteproperties->BufferSizewithm_CircularBufferMB.BufferSizeis a per-buffer size in KB, so a megabyte value was being written into a kilobyte field. This made each ETW buffer far larger than the OS maximum buffer size, which the relogger later chokes on during merge, and it contradicted theMinimumBufferscomputation on the line above (which divides by the 64 KB quantum). It also corrupted the Attach round-trip that reconstructs buffer settings when stopping the session.Remove the erroneous assignment so
BufferSizestays at the per-buffer quantum (m_BufferQuantumKB) set earlier, matching the file-based and real-time paths.MinimumBuffersalone now sizes the in-memory pool, so(MinimumBuffers * BufferSize) == m_CircularBufferMBmegabytes as intended.