From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (8.12.3/8.12.3/Debian-6.6) with ESMTP id k7SHhuLx016977 for ; Tue, 29 Aug 2006 02:43:56 +0900 Received: from funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 30FDD5E76 for ; Tue, 29 Aug 2006 02:44:01 +0900 (JST) Received: from localhost (localhost.nagaokaut.ac.jp [127.0.0.1]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 6C35FF04846 for ; Tue, 29 Aug 2006 02:44:01 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 29260F04842 for ; Tue, 29 Aug 2006 02:43:59 +0900 (JST) Received: from beryllium.ruby-lang.org (beryllium.ruby-lang.org [210.163.138.100]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id AC17663003F for ; Tue, 29 Aug 2006 02:43:58 +0900 (JST) Received: from beryllium.ruby-lang.org (beryllium.ruby-lang.org [127.0.0.1]) by beryllium.ruby-lang.org (Postfix) with ESMTP id 69C7A33FD4; Tue, 29 Aug 2006 02:43:55 +0900 (JST) Received: from localhost (beryllium.ruby-lang.org [127.0.0.1]) by beryllium.ruby-lang.org (Postfix) with ESMTP id BC9D93407F for ; Tue, 29 Aug 2006 02:43:47 +0900 (JST) Received: from beryllium.ruby-lang.org ([127.0.0.1]) by localhost (beryllium.ruby-lang.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 26527-04 for ; Tue, 29 Aug 2006 02:43:47 +0900 (JST) Received: from caida.org (rommie.caida.org [192.172.226.78]) by beryllium.ruby-lang.org (Postfix) with ESMTP id 743C434010 for ; Tue, 29 Aug 2006 02:43:47 +0900 (JST) Received: from [192.172.226.37] (nibbler.caida.org [192.172.226.37]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by caida.org (Postfix) with ESMTP id 07B8BBB51 for ; Mon, 28 Aug 2006 10:43:47 -0700 (PDT) Delivered-To: ruby-core@ruby-lang.org Date: Tue, 29 Aug 2006 02:43:48 +0900 Posted: Mon, 28 Aug 2006 10:43:45 -0700 From: Young Hyun Reply-To: ruby-core@ruby-lang.org Subject: bug? continuation called across trap To: ruby-core@ruby-lang.org Message-Id: <527A88A7-2C4C-47B6-91C0-863BF985B81C@caida.org> X-ML-Name: ruby-core X-Mail-Count: 08743 X-MLServer: fml [fml 4.0.3 release (20011202/4.0.3)]; post only (only members can post) X-ML-Info: If you have a question, send e-mail with the body "help" (without quotes) to the address ruby-core-ctl@ruby-lang.org; help= X-Mailer: Apple Mail (2.752.2) X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on beryllium.ruby-lang.org X-Spam-Level: X-Spam-Status: No, score=-5.4 required=7.0 tests=BAYES_00, CONTENT_TYPE_PRESENT,FAKEDWORD_ATMARK,RCVDFRMLOCALIP,X_MAILER_PRESENT autolearn=disabled version=3.1.3 X-Original-To: ruby-core@ruby-lang.org X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ruby-lang.org Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-Id: ruby-core.ruby-lang.org List-Software: fml [fml 4.0.3 release (20011202/4.0.3)] List-Post: List-Owner: List-Help: List-Unsubscribe: X-Virus-Scanned: by amavisd 0.1 I posted this on ruby-talk but didn't get any replies. Hopefully someone on ruby-core can help. Does anyone know what the rather mysterious error "continuation called across trap" means? It's triggered when I use SyncEnumerator in a multithreaded script. I don't believe I'm doing anything obviously wrong with threads, but this error disappears if I don't use threads. Furthermore, the error seems to occur when I use irb but not ruby (?? I need to verify this). I'm suspecting there might be a bug in irb. Code to reproduce the problem is below. Note, also, that the problem disappears if you remove the use of @values.find--that is, if you call SyncEnumerator.each directly in the lambda. --Young ============================================= require 'thread' require 'generator' class Region def initialize @values = [] @work_queue = Queue.new @thread = Thread.new do loop do @work_queue.deq.call end end end def add(value) @work_queue << lambda do @values << value end end def find(template) @work_queue << lambda do @values.find do |value| SyncEnumerator.new(template, value).each do |lhs, rhs| puts "checking: #{lhs.inspect} === #{rhs.inspect}" end end end end end Thread.abort_on_exception = true reg = Region.new reg.add [1,1] reg.add [1,2] reg.add [1,3] reg.find [1,2] #sleep 10 # uncommenting this somehow prevents the error ============================================= MacOS X 10.4.7 $ ruby --version ruby 1.8.4 (2005-12-24) [powerpc-darwin8.5.0] $ irb --prompt-mode simple >> load 'Fail4.rb' checking: 1 === 1=> true >> /opt/local/lib/ruby/1.8/generator.rb:132:in `call': continuation called across trap (RuntimeError) from /opt/local/lib/ruby/1.8/generator.rb:132:in `next' from /opt/local/lib/ruby/1.8/generator.rb:225:in `each' from /opt/local/lib/ruby/1.8/generator.rb:220:in `each' from /opt/local/lib/ruby/1.8/generator.rb:217:in `each' from ./Fail4.rb:25:in `find' from ./Fail4.rb:2:in `find' from ./Fail4.rb:24:in `find' from ./Fail4.rb:11:in `initialize' from ./Fail4.rb:10:in `initialize' from ./Fail4.rb:9:in `initialize' from ./Fail4.rb:36 from (irb):1:in `irb_binding' from /opt/local/lib/ruby/1.8/irb/workspace.rb:52:in `irb_binding' from /opt/local/lib/ruby/1.8/irb/workspace.rb:52