Skip to content

fix(storage): a partial PageFileConfig gets LockTimeout.Default, not Immediate (#322) - #329

Open
CaffeinatedCoder wants to merge 1 commit into
EntglDb:mainfrom
CaffeinatedCoder:fix/322-partial-config-lock-timeout
Open

CaffeinatedCoder wants to merge 1 commit into
EntglDb:mainfrom
CaffeinatedCoder:fix/322-partial-config-lock-timeout

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Collaborator

Closes #322

Problem

new PageFileConfig { AllowMultiProcessAccess = true } (the example in the Normalize() doc comment) opens with default(LockTimeout), whose values equal LockTimeout.Immediate (0 ms / 0 ms / 0 writers). Normalize() fills in PageSize and GrowthBlockSize but not LockTimeout, and the engine cannot tell "not set" from "fail fast on purpose", so every contended lock fails at once.

Change

Option 1 from the issue:

  • LockTimeout records whether any of its properties was set (internal bool IsSpecified). The three init accessors set it, so Immediate, Default, From(...) and any object initializer count as set; default(LockTimeout) and new LockTimeout() do not. Equality and GetHashCode stay on the three values.
  • PageFileConfig.Normalize() replaces an unset LockTimeout with LockTimeout.Default. StorageEngine already calls Normalize() on every config.
  • Doc comments on LockTimeout, PageFileConfig.LockTimeout and Normalize() say so.

No public API change. The presets already set LockTimeout.Default, so their behaviour is unchanged.

Tests

PageFileConfigLockTimeoutTests.StorageEngine_PartialConfigWithoutLockTimeout_GetsDefault_ExplicitImmediateIsKept opens a StorageEngine with an initializer config that leaves LockTimeout unset (expects Default), and with an explicit Immediate and From(0, 0, 0) (both kept). It fails on main (Actual: LockTimeout(Read=0ms, Write=0ms, MaxWriters=0)).

Full suite on one machine under heavy load: the failures were lock-timeout tests from the class #302 addresses, a different set in each run, and the same happened on plain main (10 failures). Every failing test class, run alone on this branch: 140 passed, twice.

🤖 Generated with Claude Code

…Immediate (EntglDb#322)

A PageFileConfig built with an object initializer that does not set
LockTimeout opened with default(LockTimeout), whose values equal
LockTimeout.Immediate, so every contended lock failed at once.

LockTimeout now records whether any of its properties was set (not part
of equality), and Normalize() replaces an unset value with
LockTimeout.Default, as it already does for PageSize and GrowthBlockSize.
An explicit Immediate or From(0, 0, 0) is kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Production — c1ab12a7 Deployed Oct 28, 2026 by CaffeinatedCoder via build_and_publish #804
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.

A PageFileConfig built with an object initializer gets LockTimeout.Immediate: every lock fails at once under contention

1 participant