From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS33070 50.56.128.0/17 X-Spam-Status: No, score=0.0 required=3.0 tests=AWL,MSGID_FROM_MTA_HEADER, TVD_RCVD_IP shortcircuit=no autolearn=unavailable version=3.3.2 Path: news.gmane.org!not-for-mail From: "Lin Jen-Shin (godfat)" Newsgroups: gmane.comp.lang.ruby.rainbows.general Subject: negative timeout in Rainbows::Fiber::Base Date: Fri, 24 Aug 2012 04:36:24 +0800 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1345754647 24730 80.91.229.3 (23 Aug 2012 20:44:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 Aug 2012 20:44:07 +0000 (UTC) To: "Rainbows! list" Original-X-From: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Thu Aug 23 22:44:08 2012 Return-path: Envelope-to: gclrrg-rainbows-talk@m.gmane.org X-Original-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Delivered-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=godfat.org; s=google; h=mime-version:from:date:message-id:subject:to:content-type; bh=PlrbzlpA5zTEBigkb63CkwJUHnPSaJ9AD/dKPG6JwxU=; b=ntl2zmb9S1ASSOs97B3a/BAtx1oq6w9VQGqiqkjnfC58tt3EUYGLOoUFpx5ytb1Zdp FigkDojLWV3dVgJ4CEyxjij4ekK+eKvP2it8gjkW2fvcMHt/ENJbVUo4JpczOahnzXAO 1DChZeVQYslA3Sm4ideggnhcndQpl2R3OWCe8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type :x-gm-message-state; bh=PlrbzlpA5zTEBigkb63CkwJUHnPSaJ9AD/dKPG6JwxU=; b=JNjZelMQxevEuBQiAUeMd4ovckoy6kCaop58IaM6s3qVYdUAMobvxFepuvES0fw77X BAByJVj72XRH9Q5MdHqX52S7XmllOVzcbmFYmOOdMnPly3Lu4zmTfHhRIOkFK4tG20Zc F99zVsj2J/7+Jp5JBazIw2Hw2v56PfScasaUvj0TPxrnvn0t4q8KHwlLsFYn4RRuR6k0 eF5nr5vRTVKCfW72MZ8exjKbx2bSLrNXMKbYpoMoi/anudQj+lTxDTtt7nc3f2Zk9oVV UmpSYk8zLGi9qtyRjTl3S2H78VdNKkDGcx8f3jymSEL1t/3XwiKXmIohDRWXKUZGCgEE 1nQw== X-Gm-Message-State: ALoCoQmFZVBmnv3j8Q7WPurLIsLRc1XUvgnEeRv5jAYsYIAYIp8BuhIodXpjXpUbdC7weUzM8uhA X-BeenThere: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Errors-To: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Xref: news.gmane.org gmane.comp.lang.ruby.rainbows.general:394 Archived-At: Received: from 50-56-192-79.static.cloud-ips.com ([50.56.192.79] helo=rubyforge.org) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T4eG4-00067I-TH for gclrrg-rainbows-talk@m.gmane.org; Thu, 23 Aug 2012 22:44:05 +0200 Received: from localhost.localdomain (localhost [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 8F08F2E06A; Thu, 23 Aug 2012 20:44:02 +0000 (UTC) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com [209.85.217.178]) by rubyforge.org (Postfix) with ESMTP id 9AD642E05D for ; Thu, 23 Aug 2012 20:36:55 +0000 (UTC) Received: by lbok6 with SMTP id k6so831677lbo.23 for ; Thu, 23 Aug 2012 13:36:54 -0700 (PDT) Received: by 10.152.110.80 with SMTP id hy16mr3196825lab.8.1345754214288; Thu, 23 Aug 2012 13:36:54 -0700 (PDT) Received: by 10.114.71.44 with HTTP; Thu, 23 Aug 2012 13:36:24 -0700 (PDT) Greetings Unicorns, I am writing some stupid benchmarks, trying FiberSpawn and FiberPool, and seeing this error: listen loop error: time interval must be positive (ArgumentError) Looking into the code, in this line: http://bogomips.org/rainbows.git/tree/lib/rainbows/fiber/base.rb#n55 Isn't that possible `max <= (now + 1)` and `now > max`? Whenever this is the case, then timeout passed to `select` could be negative. I am not sure how to fix this correctly, but a blind `abs` could resolve this error. Hope this could give some hints, thank you! commit b599374ef10c7847445f29f80e74cde3e4d3b940 Author: Lin Jen-Shin Date: Fri Aug 24 04:33:38 2012 +0800 fiber/base.rb: make timeout never be negative. In the case where `max <= (now + 1)` and `now > max`, we need to make sure that timeout is positive. diff --git a/lib/rainbows/fiber/base.rb b/lib/rainbows/fiber/base.rb index 00af214..7bd43cb 100644 --- a/lib/rainbows/fiber/base.rb +++ b/lib/rainbows/fiber/base.rb @@ -52,7 +52,7 @@ module Rainbows::Fiber::Base } fibs.each { |fib| fib.resume } now = Time.now - max.nil? || max > (now + 1) ? 1 : max - now + max.nil? || max > (now + 1) ? 1 : (max - now).abs end def process(client) _______________________________________________ Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org http://rubyforge.org/mailman/listinfo/rainbows-talk Do not quote signatures (like this one) or top post when replying