From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id CF49019E0025 for ; Wed, 16 Dec 2015 02:17:06 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id D0A23B5D8B0 for ; Wed, 16 Dec 2015 02:49:07 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id B40D118CC7AF for ; Wed, 16 Dec 2015 02:49:07 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 43A08120478; Wed, 16 Dec 2015 02:49:06 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o10.shared.sendgrid.net (o10.shared.sendgrid.net [173.193.132.135]) by neon.ruby-lang.org (Postfix) with ESMTPS id D55D212043A for ; Wed, 16 Dec 2015 02:49:01 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=eYeJTjOnP9J8MrvZTmDDSwJ7yuk=; b=VhJ1u/9aBmBmOejuo3 PcUB0k9mmwbZajsVNuW2mTn2oHyDcDG15O6y9yTXSzwTrLxf3wxe1N4QIDd8x7eK q6q8RXjuE0GU8/F+grcW+1TVvnuxJ/8wO8hFyRw8QN00fhjQakFOIKvZQYVJTwYg 5pn6UOqzEzfSNq84mIS+Mp6c4= Received: by filter0605p1mdw1.sendgrid.net with SMTP id filter0605p1mdw1.8385.567052856 2015-12-15 17:48:53.093346458 +0000 UTC Received: from herokuapp.com (ec2-23-20-192-93.compute-1.amazonaws.com [23.20.192.93]) by ismtpd0006p1iad1.sendgrid.net (SG) with ESMTP id TN92Sz4eSZa6Ztt8YbJIzw for ; Tue, 15 Dec 2015 17:48:53.394 +0000 (UTC) Date: Tue, 15 Dec 2015 17:48:53 +0000 From: headius@headius.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Redmine-MailingListIntegration-Message-Ids: 46860 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11822 X-Redmine-Issue-Author: headius X-Redmine-Sender: headius X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS5zKnsTmmdjMOExU/wg/LnfP+9hXFShEaJpbd 5yT9GDJaQyAiLq8OHW80pQMdjfjfhqXA3nNK426JZxQ+1TytCxp7oimkT1FgrCg96XYW57ZwUjS45G h1rqsRDWuG9H7l89KOWwCFdNby8FrFESsxrRiMno5eF17xlGkrz+NWwnJg== X-ML-Name: ruby-core X-Mail-Count: 72152 Subject: [ruby-core:72152] [Ruby trunk - Bug #11822] Semantics of Queue#pop after close are wrong X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #11822 has been updated by Charles Nutter. FWIW, JRuby has always supported a Queue#shutdown! method that *only* set a shutdown bit because of the problems of setting a bit and safely waking all consumers. ---------------------------------------- Bug #11822: Semantics of Queue#pop after close are wrong https://bugs.ruby-lang.org/issues/11822#change-55563 * Author: Charles Nutter * Status: Open * Priority: Normal * Assignee: * ruby -v: * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- Current test/ruby/thread/test_queue.rb test_close has the following assertion that seems wrong to me: def test_close [->{Queue.new}, ->{SizedQueue.new 3}].each do |qcreate| q = qcreate.call assert_equal false, q.closed? q << :something assert_equal q, q.close assert q.closed? assert_raise_with_message(ClosedQueueError, /closed/){q << :nothing} assert_equal q.pop, :something # <<< THIS ONE assert_nil q.pop assert_nil q.pop # non-blocking assert_raise_with_message(ThreadError, /queue empty/){q.pop(non_block=true)} end end Once a queue is closed, I don't think it should ever return a result anymore. The queue should be cleared and pop should always return nil. In r52691, ko1 states that "deq'ing on closed queue returns nil, always." This test does not match that behavior. -- https://bugs.ruby-lang.org/