Skip to content

BUG-144 - Remote Shared-Directory Requests Can Freeze Large Shared Profiles

Summary

A remote peer requesting the shared-directory list could make a large shared profile spend minutes building pseudo-directory names. The sampled stacks were inside SendSharedDirectories -> GetPseudoDirName -> ShouldBeShared, and the verbose log showed thousands of Using Pseudoname lines emitted at roughly 14-20 directories per second.

The expensive path was response serialization. It repeatedly asked the normal sharing predicate whether parent directories were shared, which can fall back to filesystem identity probes. That fallback is valid for configuration mutation and duplicate-prevention paths, but it is too expensive for packet generation.

Fix

  • Added a request-local shared-directory response snapshot using exact normalized directory keys.
  • Switched SendSharedDirectories to generate pseudo names from that snapshot instead of calling the full ShouldBeShared path for every parent segment.
  • Preserved the pseudo-name reverse map used by later peer file-list requests.
  • Replaced per-directory pseudo-name debug spam with one summary line that reports candidates, emitted pseudo dirs, duplicates, collisions, unlisted dirs, and elapsed milliseconds.

Deferred Work

Per-peer response caching and rate limiting were reviewed but not added in this slice. The pseudo-directory response is coupled to the reverse lookup map used for later peer requests, so caching should be added only with a versioned mapping contract if the fast snapshot path is still insufficient in live testing.

Acceptance Criteria

  • [x] Shared-directory response generation does not use filesystem identity probes for normal pseudo-name construction.
  • [x] Duplicate directory candidates are suppressed.
  • [x] Duplicate pseudo names are made unique.
  • [x] Later pseudo-name lookup remains populated for accepted outbound entries.
  • [x] Verbose logging is bounded to one response summary line.

Implementation Evidence

  • d668e1d3 BUG-142 speed shared directory responses
  • 9b9f1e0 BUG-142 cover shared directory response names
  • 5f34c259 BUG-142 summarize shared directory response logs

The implementation commits above were pushed with the already-reserved BUG-142 prefix before this record was corrected to BUG-144. This item is the authoritative record for the shared-directory response freeze.

Validation Evidence

  • python -m emule_workspace test native --suite-name parity --config Release --platform x64 --build-output-mode ErrorsOnly passed 806 tests and 5,055 assertions.
  • Debug x64 app build through python -m emule_workspace build app --variant main --config Debug --platform x64 --build-output-mode ErrorsOnly at 20260605T065850Z-build-app.
  • Release x64 app build through python -m emule_workspace build app --variant main --config Release --platform x64 --build-output-mode ErrorsOnly at 20260605T065915Z-build-app.