{"action":"created","issue":{"url":"https://api.github.com/repos/celluloid/celluloid/issues/693","labels_url":"https://api.github.com/repos/celluloid/celluloid/issues/693/labels{/name}","comments_url":"https://api.github.com/repos/celluloid/celluloid/issues/693/comments","events_url":"https://api.github.com/repos/celluloid/celluloid/issues/693/events","html_url":"https://github.com/celluloid/celluloid/issues/693","id":119366297,"number":693,"title":"bug synchronization with conditions","user":{"login":"kostya","id":95060,"avatar_url":"https://avatars.githubusercontent.com/u/95060?v=3","gravatar_id":"","url":"https://api.github.com/users/kostya","html_url":"https://github.com/kostya","followers_url":"https://api.github.com/users/kostya/followers","following_url":"https://api.github.com/users/kostya/following{/other_user}","gists_url":"https://api.github.com/users/kostya/gists{/gist_id}","starred_url":"https://api.github.com/users/kostya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kostya/subscriptions","organizations_url":"https://api.github.com/users/kostya/orgs","repos_url":"https://api.github.com/users/kostya/repos","events_url":"https://api.github.com/users/kostya/events{/privacy}","received_events_url":"https://api.github.com/users/kostya/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-29T15:49:39Z","updated_at":"2015-11-29T18:56:43Z","closed_at":"2015-11-29T18:56:42Z","body":"i need some synchronization by hands, i used conditions for this\r\n\r\nsimplified example:\r\n\r\n```ruby\r\nrequire 'bundler/setup'\r\nrequire 'celluloid/current'\r\n\r\nclass A\r\n  include Celluloid\r\n\r\n  def bla(x, sig)\r\n    sleep(x)\r\n    sig.signal(x)\r\n  end\r\nend\r\n\r\na = A.new\r\nconditions = []\r\n\r\n[1, 2, 1.5].each do |s|\r\n  c = Celluloid::Condition.new\r\n  a.async.bla(s, c)\r\n  conditions << c\r\nend\r\n\r\np conditions.map &:wait\r\n```\r\n\r\nbut get a error\r\n```\r\ncelluloid-0.17.2/lib/celluloid/mailbox.rb:63:in `sleep': No live threads left. Deadlock? (fatal)\r\n```"},"comment":{"url":"https://api.github.com/repos/celluloid/celluloid/issues/comments/160449582","html_url":"https://github.com/celluloid/celluloid/issues/693#issuecomment-160449582","issue_url":"https://api.github.com/repos/celluloid/celluloid/issues/693","id":160449582,"user":{"login":"tarcieri","id":797,"avatar_url":"https://avatars.githubusercontent.com/u/797?v=3","gravatar_id":"","url":"https://api.github.com/users/tarcieri","html_url":"https://github.com/tarcieri","followers_url":"https://api.github.com/users/tarcieri/followers","following_url":"https://api.github.com/users/tarcieri/following{/other_user}","gists_url":"https://api.github.com/users/tarcieri/gists{/gist_id}","starred_url":"https://api.github.com/users/tarcieri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tarcieri/subscriptions","organizations_url":"https://api.github.com/users/tarcieri/orgs","repos_url":"https://api.github.com/users/tarcieri/repos","events_url":"https://api.github.com/users/tarcieri/events{/privacy}","received_events_url":"https://api.github.com/users/tarcieri/received_events","type":"User","site_admin":false},"created_at":"2015-11-29T18:56:42Z","updated_at":"2015-11-29T18:56:42Z","body":"Conditions are level triggered. You need to be in a synchronized state to use them correctly. The API was changed at one point so they could be used across threads, but incorrectly so races like this crop up. They should probably be changed back so they're \"pinned\" to a particular actor/thread.\r\n\r\nWe should probably add a big warning to the documentation about this as the API is effectively unsafe in its current form.\r\n\r\nIn your example, you're kicking off an actor, the conditions are firing, but when you're not watching, and since they're level triggered you miss the events, then wait, but nothing else happens, so: deadlock.\r\n\r\nYou shouldn't use futures with that API either. Use:\r\n\r\n`a.future.bla`"}}