Skip to content

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

Open

Description

@CaffeinatedCoder

What happens

A PageFileConfig built with an object initializer, for example new PageFileConfig { AllowMultiProcessAccess = true } (the pattern the Normalize() doc comment uses as its example), opens with LockTimeout(Read=0ms, Write=0ms, MaxWriters=0), which is LockTimeout.Immediate. Every lock then fails at once under any contention.

Normalize() fills in PageSize and GrowthBlockSize from Default, but not LockTimeout. default(LockTimeout) has the same value as LockTimeout.Immediate, so the engine cannot tell "not set" from "fail fast on purpose".

Measured on main (0450b97): new BLiteEngine(path, new PageFileConfig { AllowMultiProcessAccess = false }), then 4 tasks × 50 auto-committing InsertAsync on one collection: 150 of 200 inserts throw TimeoutException. The same workload with PageFileConfig.Default throws none.

Why it matters

Possible fixes

  1. Give LockTimeout a hidden "was set" flag (set by Immediate, Default, From and the init accessors), and have Normalize() replace an unset value with LockTimeout.Default. Equality stays on the three values.
  2. Or make Immediate distinguishable from default some other way, and document that default(LockTimeout) means "use the default".
  3. At minimum, correct the two doc comments so they say that an initializer without LockTimeout gets Immediate.

Connected

Activity

  1. added
    severity/mediumSpace leak, inconsistency or failure in a narrow scenario
    and removed on Oct 18, 2026
  2. mrdevrobot commented on Oct 18, 2026

    @mrdevrobot
    Contributor

    Reproduced on 0450b97: 150 of 200 concurrent inserts time out with an object-initializer config, because Normalize() leaves LockTimeout at default(LockTimeout) (= Immediate). Medium; workaround: start from a preset with with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpackage/coreAffects BLite.Coreseverity/mediumSpace leak, inconsistency or failure in a narrow scenario

    Type

    No type

    Projects

    • Status
      Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions