cphillips83 / csharptest-net

Automatically exported from code.google.com/p/csharptest-net
0 stars 0 forks source link

Race condition in TransactionLog() c'tor #34

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Issue:
Race condition in TransactionLog.cs, TransactionLog's c'tor, between the 
`File.Exists(...)` call and the `new FileInfo(_options.FileName).Length` 
statement. A file can be deleted in between leading to an exception later.

What steps will reproduce the problem?
1. Set V2 options with "CreateFile = CreatePolicy.Always"
2. Add via something like (note the `using` usage)

    public void Add(MyEntity newItem)
    {            
        // Open the BPlusTree using these options
        using (var bpt = new BPlusTree<string, KeyEntity>(_options))
        {
            bpt.Add(newItem.key, newItem.Value);
        }
     }

3. Add about 100K entities in rapid fire via the Add(MyEntity newItem) call.

There is a 1% error chance (on a high performance SSD) so by the 100th of so 
addition, you'll hit the race condition.

What is the expected output? What do you see instead?
- See above

What version of the product are you using? On what operating system?
- Tip of HG repo

Please provide any additional information below.

- Not specific to this issue but at a project level, it would be nice if you 
had a forum or something where user's of this library could talk about 
uses/features/bugs. For example: A cool idea would be extending the storage to 
use Azure Blob Storage (in Page mode). Likely extending/replicating off the 
`BTreeFileStoreV2` class. A forum could facilitate this sort of a discussion. 
Or perhaps having a multi master write model (extending on that azure thought).

Original issue reported on code.google.com by sid...@outlook.com on 21 Jan 2014 at 3:53

GoogleCodeExporter commented 8 years ago
Intresting, I guess I never expected someone to open/close the BPlusTree for 
every write.  I'll see what can be done but the usage is somewhat abnormal.

Original comment by Grig...@gmail.com on 26 Jan 2014 at 5:58

GoogleCodeExporter commented 8 years ago
Issue moved to github:
https://github.com/csharptest/CSharpTest.Net.Collections/issues/5

Original comment by Grig...@gmail.com on 29 Jan 2015 at 5:43