Skip to content

Provider fixes#709

Draft
bzeller wants to merge 3 commits into
openSUSE:masterfrom
bzeller:provider-fixes
Draft

Provider fixes#709
bzeller wants to merge 3 commits into
openSUSE:masterfrom
bzeller:provider-fixes

Conversation

@bzeller

@bzeller bzeller commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

No description provided.

bzeller added 3 commits March 4, 2026 14:20
Replaces safe_strtonum to ensure protocol integrity and safe handling of non-null-terminated string views.
…e architecture to prevent crashes during asynchronous operations and ensure resource integrity.

Lifecycle & Stability:
   - Fixed a potential use-after-free by migrating ProvideRequest to hold its owner as a WeakRef. This prevents ProvideQueue from dereferencing dangling pointers if an item is destroyed while its request is still active.
   - Refactored all callback sites in ProvideQueue to use a safe "lock-and-check" pattern when accessing the request owner.
   - Resolved a memory leak in _activeItems where cancelled requests were not properly dequeued because the lookup reference was cleared too early. The request object is now kept alive until the worker confirms cancellation.
   - Hardened immediateShutdown to explicitly clear all queues after notifying owners, ensuring a clean state after worker termination.

Cache Implementation:
   - Corrected the inverted logic in the file cache death timer. Files are now properly evicted only after the 20-second timeout, rather than immediately.
   - Added logic to reset an entry's death timer if the file is re-accessed while still in the cache, preventing premature eviction.
   - Added a regression test case http_prov_cache_eviction to verify the timing-sensitive cache behavior.
…performance architecture using modern C++20 features.

  Protocol Engine Improvements:
   - Replaced macro-heavy switch-case parsing with a data-driven engine using SortedSchema definitions.
   - Implemented constexpr FNV-1a hashing for header names, enabling $O(\log F)$ binary search lookup via std::lower_bound.
   - Used consteval constructors to ensure all protocol schemas are sorted and checked for hash collisions strictly at compile time, with zero runtime overhead.
   - Consolidated parsing into a single-pass populate function that uses a stack-allocated std::bitset to track mandatory fields efficiently.
   - Improved diagnostic accuracy by linking error messages directly to the schema's typeName, ensuring protocol violations report the correct message context.

  Testing & Validation:
   - Added ProvideMessage_test.cc with 100% round-trip coverage for all 13 protocol message codes.
   - Verified correct handling of multi-value headers, extension headers (forward compatibility), and type-safe data conversion.
   - Implemented strict enforcement of complex protocol rules, such as the mandatory verification triplet in Attach messages.
@bzeller
bzeller requested a review from mlandres March 4, 2026 13:25
@bzeller
bzeller marked this pull request as draft March 5, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant