{"action":"created","issue":{"url":"https://api.github.com/repos/celluloid/timers/issues/58","labels_url":"https://api.github.com/repos/celluloid/timers/issues/58/labels{/name}","comments_url":"https://api.github.com/repos/celluloid/timers/issues/58/comments","events_url":"https://api.github.com/repos/celluloid/timers/issues/58/events","html_url":"https://github.com/celluloid/timers/issues/58","id":129220756,"number":58,"title":"timeout is buggy in JRuby","user":{"login":"TiagoCardoso1983","id":215707,"avatar_url":"https://avatars.githubusercontent.com/u/215707?v=3","gravatar_id":"","url":"https://api.github.com/users/TiagoCardoso1983","html_url":"https://github.com/TiagoCardoso1983","followers_url":"https://api.github.com/users/TiagoCardoso1983/followers","following_url":"https://api.github.com/users/TiagoCardoso1983/following{/other_user}","gists_url":"https://api.github.com/users/TiagoCardoso1983/gists{/gist_id}","starred_url":"https://api.github.com/users/TiagoCardoso1983/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TiagoCardoso1983/subscriptions","organizations_url":"https://api.github.com/users/TiagoCardoso1983/orgs","repos_url":"https://api.github.com/users/TiagoCardoso1983/repos","events_url":"https://api.github.com/users/TiagoCardoso1983/events{/privacy}","received_events_url":"https://api.github.com/users/TiagoCardoso1983/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":26,"created_at":"2016-01-27T17:55:19Z","updated_at":"2016-01-28T13:22:29Z","closed_at":null,"body":"First I thought it was celluloid-io sockets, but then I realized that in Jruby, timeouts will not always be triggered. Here is a simple script:\r\n\r\n```ruby\r\nrequire 'time'\r\nrequire 'celluloid/io'\r\n\r\n\r\nclass Tester\r\n  include Celluloid::IO\r\n  def initialize\r\n    @sock = TCPSocket.new(\"localhost\", 80)\r\n  end\r\n\r\n  def test_timeout\r\n    begin\r\n      timeout(2) do\r\n         # option 1\r\n         # @sock.wait_readable\r\n         # option 2\r\n         # sleep 3\r\n         # option 3 \r\n         loop do\r\n            sleep 1\r\n         end\r\n      end\r\n    rescue Celluloid::Task::TimeoutError\r\n      puts \"successfull timeout fetch: #{Time.now}\"\r\n      retry\r\n    ensure\r\n      puts \"#{$!.class} #{$!.message}\" if $!\r\n    end\r\n  end\r\n\r\nend\r\n\r\n\r\nputs \"starting the actor...\"\r\nt = Tester.new\r\nt.async(:test_timeout)\r\nsleep\r\n\r\n# Option 1\r\n# Both MRI 2.1 and jruby 9.0.5.0\r\n....\r\nsuccessfull timeout fetch: 2016-01-27 18:50:47 +0100\r\nsuccessfull timeout fetch: 2016-01-27 18:50:49 +0100\r\nsuccessfull timeout fetch: 2016-01-27 18:50:51 +0100\r\nsuccessfull timeout fetch: 2016-01-27 18:50:53 +0100\r\nsuccessfull timeout fetch: 2016-01-27 18:50:55 +0100\r\nsuccessfull timeout fetch: 2016-01-27 18:50:57 +0100\r\nsuccessfull timeout fetch: 2016-01-27 18:50:59 +0100\r\nsuccessfull timeout fetch: 2016-01-27 18:51:01 +0100\r\n\r\n\r\n(hangs at some point...)\r\n\r\n\r\n# Option 2\r\n# MRI 2.1 and JRUBY-9.0.5.0\r\nstarting the actor...\r\nsuccessfull timeout fetch: 2016-01-27 18:49:12 +0100\r\nW, [2016-01-27T18:49:15.799990 #328595]  WARN -- : Attempted to resume a dead task: type=:call, meta={:dangerous_suspend=>false, :method_name=>:test_timeout}, status=:dead\r\n```\r\n\r\nOption 3 works in MRI (apparently), but also hangs at some point. \r\n\r\nThis can seriously hinder https://github.com/celluloid/celluloid-io/pull/170. \r\n"},"comment":{"url":"https://api.github.com/repos/celluloid/timers/issues/comments/176183812","html_url":"https://github.com/celluloid/timers/issues/58#issuecomment-176183812","issue_url":"https://api.github.com/repos/celluloid/timers/issues/58","id":176183812,"user":{"login":"TiagoCardoso1983","id":215707,"avatar_url":"https://avatars.githubusercontent.com/u/215707?v=3","gravatar_id":"","url":"https://api.github.com/users/TiagoCardoso1983","html_url":"https://github.com/TiagoCardoso1983","followers_url":"https://api.github.com/users/TiagoCardoso1983/followers","following_url":"https://api.github.com/users/TiagoCardoso1983/following{/other_user}","gists_url":"https://api.github.com/users/TiagoCardoso1983/gists{/gist_id}","starred_url":"https://api.github.com/users/TiagoCardoso1983/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TiagoCardoso1983/subscriptions","organizations_url":"https://api.github.com/users/TiagoCardoso1983/orgs","repos_url":"https://api.github.com/users/TiagoCardoso1983/repos","events_url":"https://api.github.com/users/TiagoCardoso1983/events{/privacy}","received_events_url":"https://api.github.com/users/TiagoCardoso1983/received_events","type":"User","site_admin":false},"created_at":"2016-01-28T13:22:29Z","updated_at":"2016-01-28T13:22:29Z","body":"well, I guess it's settled then. I'll come up with a patch in nio4r. "}}