Skip to content

Deadlock when reusing redis connection #18

@stephankaag

Description

@stephankaag

Works:

  i = 0
  threads = [1, 2].collect do
    Thread.new do
      Redis::Semaphore.new("foo", :redis => Redis.new(:db => 15)).lock do
        i += 1
      end
    end
  end
  threads.each &:join
  i.should == 2

Deadlocks:

  i = 0
  threads = [1, 2].collect do
    Thread.new do
      Redis::Semaphore.new("foo", :redis => @redis).lock do
        i += 1
      end
    end
  end
  threads.each &:join
  i.should == 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions