Skip to content

locking-take occassionally grabs the same item twice #1

@weavejester

Description

@weavejester

I haven't finished my investigation, but I wanted to confirm that this sort of thing shouldn't be happening. I have 8 threads, which all have the same queue object, and I'm using locking-take to take an item off the queue, which is then deleted on success, and unlocked in a finally clause.

Occassionally, I'm getting the following debug logs:

:take   {:id 14720, :thread "clojure-agent-send-off-pool-0", :time 1575506781782}
:take   {:id 14720, :thread "clojure-agent-send-off-pool-7", :time 1575506781786}
:unlock {:id 14720, :thread "clojure-agent-send-off-pool-7", :time 1575506781821}
:unlock {:id 14720, :thread "clojure-agent-send-off-pool-0", :time 1575506781839}

So in this case thread 0 performs a locking take, and gets item 14720. Shortly after, thread 7 performs a locking take, and also gets item 14720.

My understanding is a locking-take should not be able to take the same item as another thread, if it has not yet been unlocked. Is this correct, or am I misunderstanding what locking-take does?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions