[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openldap-technical
Subject:    Re: LMDB: What goes "wrong" when a process is suspended during a transaction?
From:       Howard Chu <hyc () symas ! com>
Date:       2021-01-17 13:46:07
Message-ID: 081c3b2b-d422-e62a-9702-586e8a4d345f () symas ! com
[Download RAW message or body]

Antti K wrote:
> Good evening from Germany.
> 
> 
> The LMDB "Caveats" documentation mentions:
> 
>> Avoid suspending a process with active transactions. These would then be
>> "long-lived" as above. Also read transactions suspended when writers commit
>> could sometimes see wrong data.
> 
> Questions:
> 
>  - What does "wrong data" mean?  What guarantees are broken?
> 
>    Is potentially undefined behaviour ("read returns junk"),

Yes.
>    or isolation
>    weakening ("transaction reads value actually written after the transaction
>    started"),

No.

>    or something else?
> 
>  - If I do find myself in that unfortunate situation, how screwed am I?
> 
>    For example, say someone spelled SIGSTP wrong, and suspended my program with
>    an uncatchable SIGSTOP instead, and so I could not wait for transactions to
>    complete before being suspended.  My program simply catches a SIGCONT, with
>    transactions in flight.  What can it do to maintain correctness?

Nothing. The severity is unpredictable, but it will be worse the more write
txns commit while the reader is suspended.

Note that the window of opportunity for this problem is tiny - the process must
actually be suspended while running the txn_begin() function. Once the txn_begin
returns, the reader is completely safe. Chances of any real programs running into
this problem are quite small.
> 
> Guidance kindly appreciated.
> 
> 
> -- Antti
> 


-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic