ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:59462] [ruby-trunk - Bug #9342][Open] [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3
@ 2014-01-02  5:00 jsc (Justin Collins)
  2014-01-02  6:53 ` [ruby-core:59464] [ruby-trunk - Bug #9342] " jsc (Justin Collins)
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: jsc (Justin Collins) @ 2014-01-02  5:00 UTC (permalink / raw
  To: ruby-core


Issue #9342 has been reported by jsc (Justin Collins).

----------------------------------------
Bug #9342: [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3
https://bugs.ruby-lang.org/issues/9342

Author: jsc (Justin Collins)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-darwin11.4.2]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN


In Ruby 1.9.3, when SizedQueue#clear is called, it empties the queue but does not notify waiting threads that the queue is empty. This typically leads to deadlock when the queue is full.

For example:

sq = SizedQueue.new(1)
sq << 1  # Fill queue

t1 = Thread.new do
  sq << 1  # Attempt to add another item to queue, fail and go to sleep waiting
end

t2 = Thread.new do
  Thread.pass
  sq.clear
end

t2.join # Empty queue
t1.join # Deadlock, t1 continues to sleep



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:59464] [ruby-trunk - Bug #9342] [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3
  2014-01-02  5:00 [ruby-core:59462] [ruby-trunk - Bug #9342][Open] [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3 jsc (Justin Collins)
@ 2014-01-02  6:53 ` jsc (Justin Collins)
  2014-01-02  7:05   ` [ruby-core:59465] " Eric Wong
  2014-01-06  6:31 ` [ruby-core:59572] " ko1 (Koichi Sasada)
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 9+ messages in thread
From: jsc (Justin Collins) @ 2014-01-02  6:53 UTC (permalink / raw
  To: ruby-core


Issue #9342 has been updated by jsc (Justin Collins).

File 0002-Wake-waiting-threads-when-SizedQueue-clear-is-called-2.0.patch added

Looks like this is also a problem in 2.0.0, although the implementation is a little different. Attaching patch for 2.0.0 too although it's probably clear.
----------------------------------------
Bug #9342: [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3
https://bugs.ruby-lang.org/issues/9342#change-44017

Author: jsc (Justin Collins)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-darwin11.4.2]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN


In Ruby 1.9.3, when SizedQueue#clear is called, it empties the queue but does not notify waiting threads that the queue is empty. This typically leads to deadlock when the queue is full.

For example:

sq = SizedQueue.new(1)
sq << 1  # Fill queue

t1 = Thread.new do
  sq << 1  # Attempt to add another item to queue, fail and go to sleep waiting
end

t2 = Thread.new do
  Thread.pass
  sq.clear
end

t2.join # Empty queue
t1.join # Deadlock, t1 continues to sleep



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:59465] Re: [ruby-trunk - Bug #9342] [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3
  2014-01-02  6:53 ` [ruby-core:59464] [ruby-trunk - Bug #9342] " jsc (Justin Collins)
@ 2014-01-02  7:05   ` Eric Wong
  0 siblings, 0 replies; 9+ messages in thread
From: Eric Wong @ 2014-01-02  7:05 UTC (permalink / raw
  To: Ruby developers

I agree this is a problem.  This also affects 2.1.0 and trunk (where
SizedQueue is C).

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:59572] [ruby-trunk - Bug #9342] [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3
  2014-01-02  5:00 [ruby-core:59462] [ruby-trunk - Bug #9342][Open] [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3 jsc (Justin Collins)
  2014-01-02  6:53 ` [ruby-core:59464] [ruby-trunk - Bug #9342] " jsc (Justin Collins)
@ 2014-01-06  6:31 ` ko1 (Koichi Sasada)
  2014-01-18  3:30 ` [ruby-core:59835] " justin
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: ko1 (Koichi Sasada) @ 2014-01-06  6:31 UTC (permalink / raw
  To: ruby-core


Issue #9342 has been updated by ko1 (Koichi Sasada).

Category set to ext
Assignee set to ko1 (Koichi Sasada)
Target version set to current: 2.2.0


----------------------------------------
Bug #9342: [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3
https://bugs.ruby-lang.org/issues/9342#change-44107

Author: jsc (Justin Collins)
Status: Open
Priority: Normal
Assignee: ko1 (Koichi Sasada)
Category: ext
Target version: current: 2.2.0
ruby -v: ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-darwin11.4.2]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN


In Ruby 1.9.3, when SizedQueue#clear is called, it empties the queue but does not notify waiting threads that the queue is empty. This typically leads to deadlock when the queue is full.

For example:

sq = SizedQueue.new(1)
sq << 1  # Fill queue

t1 = Thread.new do
  sq << 1  # Attempt to add another item to queue, fail and go to sleep waiting
end

t2 = Thread.new do
  Thread.pass
  sq.clear
end

t2.join # Empty queue
t1.join # Deadlock, t1 continues to sleep



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:59835] [ruby-trunk - Bug #9342] [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3
  2014-01-02  5:00 [ruby-core:59462] [ruby-trunk - Bug #9342][Open] [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3 jsc (Justin Collins)
  2014-01-02  6:53 ` [ruby-core:59464] [ruby-trunk - Bug #9342] " jsc (Justin Collins)
  2014-01-06  6:31 ` [ruby-core:59572] " ko1 (Koichi Sasada)
@ 2014-01-18  3:30 ` justin
  2014-02-05  3:07 ` [ruby-core:60474] " usa
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: justin @ 2014-01-18  3:30 UTC (permalink / raw
  To: ruby-core

Issue #9342 has been updated by Justin Collins.


Thank you!

As far as I can tell, SizedQueue#clear has never notified waiting threads since it was introduced in Ruby 1.4. Perhaps something with green threads allowed it to work anyway? It is definitely an issue in 1.9.3 and later.

----------------------------------------
Bug #9342: [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3
https://bugs.ruby-lang.org/issues/9342#change-44403

* Author: Justin Collins
* Status: Closed
* Priority: Normal
* Assignee: Koichi Sasada
* Category: ext
* Target version: current: 2.2.0
* ruby -v: ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-darwin11.4.2]
* Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
In Ruby 1.9.3, when SizedQueue#clear is called, it empties the queue but does not notify waiting threads that the queue is empty. This typically leads to deadlock when the queue is full.

For example:

sq = SizedQueue.new(1)
sq << 1  # Fill queue

t1 = Thread.new do
  sq << 1  # Attempt to add another item to queue, fail and go to sleep waiting
end

t2 = Thread.new do
  Thread.pass
  sq.clear
end

t2.join # Empty queue
t1.join # Deadlock, t1 continues to sleep


---Files--------------------------------
0001-Wake-waiting-threads-when-SizedQueue-clear-is-called.patch (1.73 KB)
0002-Wake-waiting-threads-when-SizedQueue-clear-is-called-2.0.patch (769 Bytes)


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:60474] [ruby-trunk - Bug #9342] [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3
  2014-01-02  5:00 [ruby-core:59462] [ruby-trunk - Bug #9342][Open] [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3 jsc (Justin Collins)
                   ` (2 preceding siblings ...)
  2014-01-18  3:30 ` [ruby-core:59835] " justin
@ 2014-02-05  3:07 ` usa
  2014-02-09 16:10 ` [ruby-core:60626] " nagachika00
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: usa @ 2014-02-05  3:07 UTC (permalink / raw
  To: ruby-core

Issue #9342 has been updated by Usaku NAKAMURA.

Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN to 1.9.3: REQUIRED, 2.0.0: REQUIRED, 2.1: REQUIRED

----------------------------------------
Bug #9342: [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3
https://bugs.ruby-lang.org/issues/9342#change-44940

* Author: Justin Collins
* Status: Closed
* Priority: Normal
* Assignee: Koichi Sasada
* Category: ext
* Target version: current: 2.2.0
* ruby -v: ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-darwin11.4.2]
* Backport: 1.9.3: REQUIRED, 2.0.0: REQUIRED, 2.1: REQUIRED
----------------------------------------
In Ruby 1.9.3, when SizedQueue#clear is called, it empties the queue but does not notify waiting threads that the queue is empty. This typically leads to deadlock when the queue is full.

For example:

sq = SizedQueue.new(1)
sq << 1  # Fill queue

t1 = Thread.new do
  sq << 1  # Attempt to add another item to queue, fail and go to sleep waiting
end

t2 = Thread.new do
  Thread.pass
  sq.clear
end

t2.join # Empty queue
t1.join # Deadlock, t1 continues to sleep


---Files--------------------------------
0001-Wake-waiting-threads-when-SizedQueue-clear-is-called.patch (1.73 KB)
0002-Wake-waiting-threads-when-SizedQueue-clear-is-called-2.0.patch (769 Bytes)


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:60626] [ruby-trunk - Bug #9342] [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3
  2014-01-02  5:00 [ruby-core:59462] [ruby-trunk - Bug #9342][Open] [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3 jsc (Justin Collins)
                   ` (3 preceding siblings ...)
  2014-02-05  3:07 ` [ruby-core:60474] " usa
@ 2014-02-09 16:10 ` nagachika00
  2014-02-14  3:49 ` [ruby-core:60691] " usa
  2014-02-22  4:21 ` [ruby-core:60966] " naruse
  6 siblings, 0 replies; 9+ messages in thread
From: nagachika00 @ 2014-02-09 16:10 UTC (permalink / raw
  To: ruby-core

Issue #9342 has been updated by Tomoyuki Chikanaga.

Backport changed from 1.9.3: REQUIRED, 2.0.0: REQUIRED, 2.1: REQUIRED to 1.9.3: REQUIRED, 2.0.0: DONE, 2.1: REQUIRED

1.9.3 and 2.0.0 has different implementation of Queue/SizedQueue from 2.1/trunk.
I partially backported r44595 for test, and commited a patch for ruby_2_0_0 at r44899.

----------------------------------------
Bug #9342: [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3
https://bugs.ruby-lang.org/issues/9342#change-45065

* Author: Justin Collins
* Status: Closed
* Priority: Normal
* Assignee: Koichi Sasada
* Category: ext
* Target version: current: 2.2.0
* ruby -v: ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-darwin11.4.2]
* Backport: 1.9.3: REQUIRED, 2.0.0: DONE, 2.1: REQUIRED
----------------------------------------
In Ruby 1.9.3, when SizedQueue#clear is called, it empties the queue but does not notify waiting threads that the queue is empty. This typically leads to deadlock when the queue is full.

For example:

sq = SizedQueue.new(1)
sq << 1  # Fill queue

t1 = Thread.new do
  sq << 1  # Attempt to add another item to queue, fail and go to sleep waiting
end

t2 = Thread.new do
  Thread.pass
  sq.clear
end

t2.join # Empty queue
t1.join # Deadlock, t1 continues to sleep


---Files--------------------------------
0001-Wake-waiting-threads-when-SizedQueue-clear-is-called.patch (1.73 KB)
0002-Wake-waiting-threads-when-SizedQueue-clear-is-called-2.0.patch (769 Bytes)


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:60691] [ruby-trunk - Bug #9342] [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3
  2014-01-02  5:00 [ruby-core:59462] [ruby-trunk - Bug #9342][Open] [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3 jsc (Justin Collins)
                   ` (4 preceding siblings ...)
  2014-02-09 16:10 ` [ruby-core:60626] " nagachika00
@ 2014-02-14  3:49 ` usa
  2014-02-22  4:21 ` [ruby-core:60966] " naruse
  6 siblings, 0 replies; 9+ messages in thread
From: usa @ 2014-02-14  3:49 UTC (permalink / raw
  To: ruby-core

Issue #9342 has been updated by Usaku NAKAMURA.

Backport changed from 1.9.3: REQUIRED, 2.0.0: DONE, 2.1: REQUIRED to 1.9.3: DONE, 2.0.0: DONE, 2.1: REQUIRED

Commited to ruby_1_9_3 at r44932.
Thank you, Justin!

----------------------------------------
Bug #9342: [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3
https://bugs.ruby-lang.org/issues/9342#change-45113

* Author: Justin Collins
* Status: Closed
* Priority: Normal
* Assignee: Koichi Sasada
* Category: ext
* Target version: current: 2.2.0
* ruby -v: ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-darwin11.4.2]
* Backport: 1.9.3: DONE, 2.0.0: DONE, 2.1: REQUIRED
----------------------------------------
In Ruby 1.9.3, when SizedQueue#clear is called, it empties the queue but does not notify waiting threads that the queue is empty. This typically leads to deadlock when the queue is full.

For example:

sq = SizedQueue.new(1)
sq << 1  # Fill queue

t1 = Thread.new do
  sq << 1  # Attempt to add another item to queue, fail and go to sleep waiting
end

t2 = Thread.new do
  Thread.pass
  sq.clear
end

t2.join # Empty queue
t1.join # Deadlock, t1 continues to sleep


---Files--------------------------------
0001-Wake-waiting-threads-when-SizedQueue-clear-is-called.patch (1.73 KB)
0002-Wake-waiting-threads-when-SizedQueue-clear-is-called-2.0.patch (769 Bytes)


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:60966] [ruby-trunk - Bug #9342] [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3
  2014-01-02  5:00 [ruby-core:59462] [ruby-trunk - Bug #9342][Open] [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3 jsc (Justin Collins)
                   ` (5 preceding siblings ...)
  2014-02-14  3:49 ` [ruby-core:60691] " usa
@ 2014-02-22  4:21 ` naruse
  6 siblings, 0 replies; 9+ messages in thread
From: naruse @ 2014-02-22  4:21 UTC (permalink / raw
  To: ruby-core

Issue #9342 has been updated by Yui NARUSE.

Backport changed from 1.9.3: DONE, 2.0.0: DONE, 2.1: REQUIRED to 1.9.3: DONE, 2.0.0: DONE, 2.1: DONE

r45104.

----------------------------------------
Bug #9342: [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3
https://bugs.ruby-lang.org/issues/9342#change-45367

* Author: Justin Collins
* Status: Closed
* Priority: Normal
* Assignee: Koichi Sasada
* Category: ext
* Target version: current: 2.2.0
* ruby -v: ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-darwin11.4.2]
* Backport: 1.9.3: DONE, 2.0.0: DONE, 2.1: DONE
----------------------------------------
In Ruby 1.9.3, when SizedQueue#clear is called, it empties the queue but does not notify waiting threads that the queue is empty. This typically leads to deadlock when the queue is full.

For example:

sq = SizedQueue.new(1)
sq << 1  # Fill queue

t1 = Thread.new do
  sq << 1  # Attempt to add another item to queue, fail and go to sleep waiting
end

t2 = Thread.new do
  Thread.pass
  sq.clear
end

t2.join # Empty queue
t1.join # Deadlock, t1 continues to sleep


---Files--------------------------------
0001-Wake-waiting-threads-when-SizedQueue-clear-is-called.patch (1.73 KB)
0002-Wake-waiting-threads-when-SizedQueue-clear-is-called-2.0.patch (769 Bytes)


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-02-22  4:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-02  5:00 [ruby-core:59462] [ruby-trunk - Bug #9342][Open] [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3 jsc (Justin Collins)
2014-01-02  6:53 ` [ruby-core:59464] [ruby-trunk - Bug #9342] " jsc (Justin Collins)
2014-01-02  7:05   ` [ruby-core:59465] " Eric Wong
2014-01-06  6:31 ` [ruby-core:59572] " ko1 (Koichi Sasada)
2014-01-18  3:30 ` [ruby-core:59835] " justin
2014-02-05  3:07 ` [ruby-core:60474] " usa
2014-02-09 16:10 ` [ruby-core:60626] " nagachika00
2014-02-14  3:49 ` [ruby-core:60691] " usa
2014-02-22  4:21 ` [ruby-core:60966] " naruse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).