[PR #3385] [CLOSED] [Engine] avoid hanging on PleReader initialization failures #4606

Closed
opened 2026-11-07 15:37:47 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3385
Author: @j-luwierski
Created: 10/20/2026
Status: ❌ Closed

Base: main ← Head: codex/ple-reader-init-beta


📝 Commits (1)

  • 9f4b65f ngram: avoid draining nonexistent reads after initialization failures

📊 Changes

3 files changed (+136 additions, -1 deletions)

View changed files

📝 CMakeLists.txt (+19 -0)
📝 src/ngram/ple_reader.cpp (+3 -1)
➕ tests/platform/ple_reader_lifecycle.cpp (+114 -0)

📄 Description

Problem and result

On current upstream main, PleReader::open() still hangs during cleanup if read-buffer allocation fails or if a reader is reopened with a table range beyond EOF. The failed open() never returns its existing error. After this change, it closes cleanly and a later valid open/read succeeds.

Retested the report in #3045, which was closed during the 0.2.0-beta tracker reset. The original PR #3046 was also closed in that reset.

Approach

Publish the in-flight slot count only after the buffers and free-slot list are ready, and reset the count when closing. Add Linux CPU-only lifecycle coverage for normal reads, failed reopen, and injected allocation failure in caller-thread and I/O-worker modes. The allocation failure uses link-time posix_memalign wrapping and does not add production fault-injection behavior.

Validation

Linux x86_64, GCC 14.2.0, CUDA 13.4.92, NVIDIA RTX 4070 Ti SUPER; base revision e88ee39d1d6be6e3364183af3b39b62a7ed6f211, candidate revision 9f4b65fc.

Passed:

  • CPU: cmake -S . -B build/ple-reader-beta -DSTRATA_BUILD_TESTS=ON -DSTRATA_WERROR=ON; cmake --build build/ple-reader-beta --target ple_reader_lifecycle_test direct_file_async_test -j2; and ctest --test-dir build/ple-reader-beta --output-on-failure -R '^(ple_reader_(reads|reopen|alloc)_(caller|threaded)|direct_file_async_test)$': targets built and all 7 tests passed.
  • CUDA: cmake -S . -B build/ple-reader-cuda -DSTRATA_BUILD_TESTS=ON -DSTRATA_WERROR=OFF -DSTRATA_ENABLE_CUDA=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda-13.4/bin/nvcc; cmake --build build/ple-reader-cuda --target strata ple_reader_lifecycle_test direct_file_async_test -j2: all targets built.
  • CUDA CTest: ctest --test-dir build/ple-reader-cuda --output-on-failure -R '^(ple_reader_(reads|reopen|alloc)_(caller|threaded)|direct_file_async_test)$': all 7 tests passed.
  • Reproduced on unchanged base revision e88ee39d: both read controls passed; reopen and injected alloc cases timed out after 2 seconds in caller and threaded modes (4 hangs).
  • git diff --check origin/main...HEAD: passed.

Failed:

  • With STRATA_WERROR=ON, the CUDA build command cmake --build build/ple-reader-cuda --target strata ple_reader_lifecycle_test direct_file_async_test -j2 stopped on -Werror=misleading-indentation in unchanged src/core/layer.cpp. The CUDA build passed with WERROR disabled; warnings are outside this change.

Not run:

  • HIP and SYCL builds: hipcc, dpcpp and icpx are unavailable.
  • Windows runtime checks and real model inference.

Limits

The reproduction uses a synthetic file and real DirectFile I/O on Linux; it verifies initialization and recovery behavior, not a production memory-pressure incident or model inference.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/3385 **Author:** [@j-luwierski](https://github.com/j-luwierski) **Created:** 10/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `codex/ple-reader-init-beta` --- ### 📝 Commits (1) - [`9f4b65f`](https://github.com/Niko1221/Strata/commit/9f4b65fca612185d912e2c10abb85c84c9bd4846) ngram: avoid draining nonexistent reads after initialization failures ### 📊 Changes **3 files changed** (+136 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+19 -0) 📝 `src/ngram/ple_reader.cpp` (+3 -1) ➕ `tests/platform/ple_reader_lifecycle.cpp` (+114 -0) </details> ### 📄 Description ## Problem and result On current upstream main, `PleReader::open()` still hangs during cleanup if read-buffer allocation fails or if a reader is reopened with a table range beyond EOF. The failed `open()` never returns its existing error. After this change, it closes cleanly and a later valid open/read succeeds. ## Related discussion Retested the report in [#3045](https://github.com/Niko1221/Strata/issues/3045), which was closed during the 0.2.0-beta tracker reset. The original PR [#3046](https://github.com/Niko1221/Strata/pull/3046) was also closed in that reset. ## Approach Publish the in-flight slot count only after the buffers and free-slot list are ready, and reset the count when closing. Add Linux CPU-only lifecycle coverage for normal reads, failed reopen, and injected allocation failure in caller-thread and I/O-worker modes. The allocation failure uses link-time `posix_memalign` wrapping and does not add production fault-injection behavior. ## Validation Linux x86_64, GCC 14.2.0, CUDA 13.4.92, NVIDIA RTX 4070 Ti SUPER; base revision `e88ee39d1d6be6e3364183af3b39b62a7ed6f211`, candidate revision `9f4b65fc`. **Passed:** - CPU: `cmake -S . -B build/ple-reader-beta -DSTRATA_BUILD_TESTS=ON -DSTRATA_WERROR=ON`; `cmake --build build/ple-reader-beta --target ple_reader_lifecycle_test direct_file_async_test -j2`; and `ctest --test-dir build/ple-reader-beta --output-on-failure -R '^(ple_reader_(reads|reopen|alloc)_(caller|threaded)|direct_file_async_test)$'`: targets built and all 7 tests passed. - CUDA: `cmake -S . -B build/ple-reader-cuda -DSTRATA_BUILD_TESTS=ON -DSTRATA_WERROR=OFF -DSTRATA_ENABLE_CUDA=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda-13.4/bin/nvcc`; `cmake --build build/ple-reader-cuda --target strata ple_reader_lifecycle_test direct_file_async_test -j2`: all targets built. - CUDA CTest: `ctest --test-dir build/ple-reader-cuda --output-on-failure -R '^(ple_reader_(reads|reopen|alloc)_(caller|threaded)|direct_file_async_test)$'`: all 7 tests passed. - Reproduced on unchanged base revision `e88ee39d`: both read controls passed; `reopen` and injected `alloc` cases timed out after 2 seconds in caller and threaded modes (4 hangs). - `git diff --check origin/main...HEAD`: passed. **Failed:** - With `STRATA_WERROR=ON`, the CUDA build command `cmake --build build/ple-reader-cuda --target strata ple_reader_lifecycle_test direct_file_async_test -j2` stopped on `-Werror=misleading-indentation` in unchanged `src/core/layer.cpp`. The CUDA build passed with WERROR disabled; warnings are outside this change. **Not run:** - HIP and SYCL builds: `hipcc`, `dpcpp` and `icpx` are unavailable. - Windows runtime checks and real model inference. ## Limits The reproduction uses a synthetic file and real DirectFile I/O on Linux; it verifies initialization and recovery behavior, not a production memory-pressure incident or model inference. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:37:47 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4606
No description provided.