Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]Maximum number of transactions reached in 5.0.18, but 5.0.13 #2444

Closed
mirror222 opened this issue Mar 9, 2024 · 5 comments
Closed

[BUG]Maximum number of transactions reached in 5.0.18, but 5.0.13 #2444

mirror222 opened this issue Mar 9, 2024 · 5 comments
Labels

Comments

@mirror222
Copy link

mirror222 commented Mar 9, 2024

LiteDB : 5.0.18 Windows 11 x64

I ran a simple test with the following code and found that the latest version (5.0.18) throws a "Maximum number of transactions reached" error, but the older version 5.0.13 does not.


using LiteDB;

namespace ConsoleApp1
{
    class Program
    {
        internal class MyKeyValue
        {
            [BsonId]
            public int Id { get; set; } 
            public string? Key { get; set; }   
            public BsonValue? Value { get; set; } 
        }

        private static void Main(string[] args)
        {
            using (var db = new LiteDatabase(new ConnectionString(":memory:")))
            {
                var _kvs = db.GetCollection<MyKeyValue>();
                var tasks = new List<Task>();

                for (int i = 0; i < 150; i++)
                {
                    var tmp = i;

                    tasks.Add(Task.Run(() =>
                     {
                         var item = new MyKeyValue()
                         {
                             Key = "KEY" + tmp,
                             Value = tmp,
                         };

                         var w = _kvs.Insert(item) > 0;
                         var r = _kvs.FindOne(x => x.Key == "KEY" + tmp);   //throw error  HERE

                         Console.WriteLine($"{tmp} {w} {r.Value}");
                     }));
                }

                Task.WaitAll(tasks.ToArray());
            }
        }
    }
}
@mirror222 mirror222 added the bug label Mar 9, 2024
@mirror222
Copy link
Author

Fix #2435

@avataron
Copy link

avataron commented Apr 1, 2024

I've installed the 5.0.19 from Nuget and this problem keeps occurring.
I had to load all entries to a collection to mitigate this problem, in order to avoid the FindOne() and FindById().

@mirror222
Copy link
Author

I've installed the 5.0.19 from Nuget and this problem keeps occurring.
I had to load all entries to a collection to mitigate this problem, in order to avoid the FindOne() and FindById().

see
#2435

@avataron
Copy link

avataron commented Apr 1, 2024

I've installed the 5.0.19 from Nuget and this problem keeps occurring.
I had to load all entries to a collection to mitigate this problem, in order to avoid the FindOne() and FindById().

see #2435

Yeah, I read that before. In the end of that, someone says "Note that we rolled this fix into 5.0.19 and found that it resolves (...)" but as I stated, the 5.0.19 still throws bug to me.

@GalensGan
Copy link

same issue for me with v5.0.19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants