fix(c++): EdgeIter property misalignment causing IO errors and crashes during chunk traversal #2
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.
Summary
Fixes a critical bug in
EdgeIterwhere property values become misaligned during segmented iteration or when crossing chunk boundaries, leading to incorrect data access, IO errors, and crashes.Problem
The
EdgeIterclass maintains two state layers that can become desynchronized:vertex_chunk_index_andcur_offset_AdjListPropertyArrowChunkReaderhas its ownvertex_chunk_index_,chunk_index_,seek_offset_, and cachedchunk_table_This desynchronization manifests in several critical ways:
Symptoms observed:
it.property<T>()and(*it).property<T>()Failed to open ... part10/chunk0when accessing non-existent chunksRoot Cause
Three key methods had synchronization issues:
property()method: Calledreader.seek(cur_offset_)without ensuring the reader was positioned at the correct vertex chunkoperator*()method: Similar issue - didn't synchronize property readers to the current chunk before seekingoperator++()boundary crossing: Usedreader.next_chunk()which could fail and leave readers in stale statesSolution
Ensure property readers are always synchronized with the iterator's
vertex_chunk_index_before any seek operation:Key changes:
reader.seek_chunk_index(vertex_chunk_index_)before seeking inproperty()methodoperator*()before creating Edge objectsreader.next_chunk()with robustreader.seek_chunk_index()inoperator++()error handlingTesting
Added comprehensive test case in
test_graph.ccthat validates:The test specifically covers the reported bug scenario of jumping to position 2000+ and verifying property alignment.
Impact
This fix ensures that:
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
apache.jfrog.iowget -c REDACTED -P /tmp/(dns block)esm.ubuntu.com/usr/lib/apt/methods/https(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.