Giter Site home page Giter Site logo

Comments (3)

madelson avatar madelson commented on August 17, 2024

Thanks for reporting @Tom4Real . Do you have a repro? Any theories as to what is happening? Anything non-default about your Postgres setup (eg pgbouncer)?

Can you show a snippet of your code?

from distributedlock.

madelson avatar madelson commented on August 17, 2024

@Tom4Real any update here?

from distributedlock.

madelson avatar madelson commented on August 17, 2024
    [Test]
    public async Task Repro()
    {
        var key = new PostgresAdvisoryLockKey("MyLockName", allowHashing: true);
        var conn = TestingPostgresDb.DefaultConnectionString;
        var lock1 = new PostgresDistributedLock(key, conn);
        var lock2 = new PostgresDistributedLock(key, conn);
        var lock3 = new PostgresDistributedLock(key, conn);
        var counter = 0;
        await Task.WhenAll(new[] { lock1, lock2, lock3 }.Select(l => Task.Run(async () =>
        {
            await using (await l.AcquireAsync())
            {
                var c = Interlocked.Increment(ref counter);
                if (c != 1) { throw new Exception("concurrent acquisition!"); }
                await Task.Delay(1000);
                Interlocked.Decrement(ref counter);
            }
        })));
    }

Attempted to reproduce with the above code. It does not repro for me. @Tom4Real please let me know if you're still observing this and can share additional detail. For now I'm closing this as not reproducible.

from distributedlock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.