Pull requests / #3046

#3046 ngram: avoid draining nonexistent reads after initialization failures

open · @j-luwierski · 0 commentaires · Sur GitHub

AMD / HIPNVIDIA / CUDAWindowsLinux

Description

## Title

Resolves #3045

## Summary

`PleReader::open()` can block forever during cleanup before submitting any reads: slab allocation failure publishes a nonzero slot count with no free slots, and failed reopen inherits the previous slot count after close cleared the free slots. Both paths wait for completions that cannot exist. Failed initialization now returns the existing error, closes the file and permits a later valid open.

## What changed

- Publish `max_inflight` only after the slab and free-slot list are initialized.
- Reset `max_inflight` when closing the reader.
- Add a Linux CPU-only lifecycle test with caller-thread and I/O-worker cases. Link-time `posix_memalign` wrapping injects a one-shot ENOMEM without adding production fault-injection settings. CTest timeouts turn the former hangs into bounded failures.

Successful row reads, page-straddling rows, close with outstanding reads, repeated close and read-after-recovery are covered. The I/O scheduling, cache, kernels, row bytes, defaults and public API remain unchanged.

## Validation

Linux x86_64, GCC 14.2.0; isolated branch from directly fetched upstream main `477ac13cbe8e582c20484871ce459d20d82df09d`.

- CMake CPU build with `STRATA_BUILD_TESTS=ON` and `STRATA_WERROR=ON`: built `ple_reader_lifecycle_test` and `direct_file_async_test`.
- CTest: all 7 selected tests passed (6 lifecycle cases and existing DirectFile async test). Successful reads are compared byte-for-byte against an independent fixture pattern.
- Compiled the same lifecycle test against unchanged upstream: both normal-read controls passed; allocation and reopen cases timed out after 2 seconds in both caller and threaded modes (4 timeouts).
- `git diff --check` passed.

## Extra Notes

Draft; no review requested. AGENTS.md requires builds of every affected backend before review. Full CUDA/HIP/SYCL engine builds have not been run; HIP and SYCL compilers are unavailable here. Windows runtime behavior and real model inference were not tested. These are injected/API error-path tests, not a measured production memory-pressure incident.

Searched open issues and PRs. #2991 concerns temporary-file collisions in another selftest; #2623 concerns prefetch matching. This change addresses initialization bookkeeping only.

Sur le site

Liens install, modèles, releases.