Skip to content

Improve StorageService Resource Ownership and Document Shared Contracts - #244

Merged
enteriaza merged 3 commits into
masterfrom
storage-service-common-standardization
Oct 23, 2026
Merged

enteriaza merged 3 commits into
masterfrom
storage-service-common-standardization

Conversation

@enteriaza

Copy link
Copy Markdown
Collaborator

Description

Summary

Improve resource ownership and failure-path cleanup in StorageService, clarify shared path-helper contracts, and document a proposed systemd host abstraction for future consideration.

Changes

  • Listener socket ownership: Use DisposableOwnership<Socket> in StorageVatpListenerService to ensure sockets are disposed if binding or listening fails.
  • ArticleIndex initialization: Transfer writer connection ownership only after reader initialization succeeds, preventing _writer from retaining a disposed connection after initialization failure.
  • Initialization failure cleanup: Dispose unpublished ArticleIndexDatabase instances when initialization fails.
  • Regression tests: Add coverage for listener bind failures and ArticleIndex initialization failures.
  • Path-helper documentation: Clarify the responsibilities and limitations of ApplicationLocalPath and StorageRelativePath, including lexical path containment and filesystem-related limitations.
  • Systemd design proposal: Document potential Common systemd abstractions and the lifecycle, readiness, retry, and notification failure-policy differences that must be resolved before extraction.

Validation

  • Release x64 solution build: passed, 0 warnings and 0 errors.
  • StorageService tests: 443 passed.
  • Common ownership and path-helper tests: 21 passed.
  • dotnet format VectorNNTPD.slnx --verify-no-changes: passed.

Scope

This PR does not implement a shared systemd abstraction or change BackFiller lifecycle management. The systemd document is a design proposal only; consolidation remains dependent on agreement about readiness and failure-handling contracts.

Testing Notes

The regression tests cover listener bind failure and ArticleIndex initialization failure. They do not directly exercise socket disposal after bind failure or the specific OpenReaders() failure that motivated the ownership-transfer ordering. These remain potential opportunities for stronger coverage.

- Adopt DisposableOwnership for listener socket creation and ArticleIndex writer initialization
- Dispose ArticleIndex databases when initialization fails before publication
- Add regression tests for listener bind failures and index initialization failures
- Clarify ApplicationLocalPath and StorageRelativePath contracts
- Document proposed Common systemd host abstraction and outstanding lifecycle policy differences
@enteriaza enteriaza self-assigned this Oct 23, 2026
@enteriaza enteriaza added the enhancement New feature or request label Oct 23, 2026
- Use `using var` to guarantee database disposal on assertion failures
- Preserve the explicit double-dispose check for idempotency
- Ensure cleanup runs even if the explicit `Dispose()` throws
- Reduce CPU-sink benchmark batch from 384 to 64 articles
- Use the default worker control interval instead of 1 ms polling
- Preserve 1/2/4/8-worker throughput measurements
- Avoid Linux CI timeouts without weakening hang detection
@enteriaza
enteriaza merged commit 077ef7f into master Oct 23, 2026
7 checks passed
@enteriaza
enteriaza deleted the storage-service-common-standardization branch October 23, 2026 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants