You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7b96800
Browse filesBrowse the repository at this point in the historyBrowse files
[Python] Add ASan/LSan coverage for bindings and C++ integration (#1047)
* [Python] Add ASan/LSan coverage for bindings and C++ integration (#1027)
Add a coordinated sanitizer build mode, -Dtsfile.sanitizer=<checks>, that
instruments libtsfile and every Cython extension with the same checks. The
C++ library gets -fsanitize on compile and on the shared-library link and
keeps debug info and frame pointers; setup.py builds each extension with
-O1 -g -fno-omit-frame-pointer, links the sanitizer runtime, and verifies
with nm/readelf that every artifact is instrumented. Sanitizer builds never
produce a wheel.
The sanitizer compile flags must be re-applied after the bundled third-party
build resets CMAKE_CXX_FLAGS; previously they were discarded and only the
link step saw them. The C++-only ASan mode keeps its historical static-runtime
setup so an instrumented libtsfile cannot mix runtimes with the test binary.
Fix ownership defects the new checks expose:
- free STRING/TEXT value buffers and use the length-aware binary getter for
BLOB so embedded NUL bytes survive;
- free the writer-side schema structs, not only their members;
- free result-set metadata and schema arrays on every path;
- free the property array on the C wrapper's bad_alloc path;
- add tsfile_free_buffer so bindings release buffers with the allocating
module's CRT.
Add subprocess ownership scenarios (tree/table/dataset/Arrow reads, value
types and NULLs, early termination, exception cleanup, repeated open/close,
reader/result lifetime, file-object adapter), two positive controls, narrow
suppressions, and a Linux CI job. Leak reports are attributed by allocation
stack so only leaks reaching TsFile modules fail the run. Document build and
run commands, runtime preloading (libasan before libstdc++), symbolization,
and the suppression policy.
* [Python] Fix sanitizer workflow gaps and reader schema-array ownership
- Skip the ordinary pytest execution in the with-sanitizer Maven profile:
the instrumented extensions abort on import unless the sanitizer runtime
is preloaded, which Maven's test execution does not do, so
`mvn verify -Dtsfile.sanitizer=address` failed before running a test.
- Document the complete ASan/LSan command in python/CLAUDE.md, including
TSFILE_SANITIZER (without it test_sanitizer_ownership.py skips silently)
and the ASAN/LSAN options used by CI.
- Add tsfile_free_table_schema_array()/tsfile_free_device_schema_array()
so bindings release reader-owned schema arrays with libtsfile's
allocator, and release partial conversion results when a schema
conversion raises mid-loop.
- Point the C API value-getter docs at tsfile_free_buffer() and document
the binary getter's NULL-cell behavior.
- Note the nm/binutils wheel requirement and the test/verify limitation in
python/SANITIZER.md.
|`ENABLE_THREADS`| Multi-threaded read/write via pthreads |
71
73
|`ENABLE_ASAN`| AddressSanitizer (`OFF` by default) |
74
+
|`TSFILE_SANITIZER_CHECKS`|`-fsanitize=` list used by `ENABLE_ASAN` (default `address,undefined`) |
75
+
|`TSFILE_SANITIZER_SHARED_RUNTIME`| Link the sanitizer runtime dynamically into shared libraries; required when Python bindings preload it (`OFF` by default) |
0 commit comments