Forum: Ruby-core [ruby-trunk - Bug #7503][Open] make timeout.rb async-interrupt safe by default

Posted by kosaki (Motohiro KOSAKI) (Guest)
on 2012-12-03 14:39
(Received via mailing list)
Issue #7503 has been reported by kosaki (Motohiro KOSAKI).

----------------------------------------
Bug #7503: make timeout.rb async-interrupt safe by default
https://bugs.ruby-lang.org/issues/7503

Author: kosaki (Motohiro KOSAKI)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version: 2.0.0
ruby -v: trunk


Hi

Again and again we discussed, current timeout.rb is very dangerous 
because ExitException interrupt argument code and unwind call stack 
immediately.
It may prevent to run ensure block and makes resource leak.

I proposed change default to interrupted only on blocking point.

patch is here.
https://gist.github.com/4195015

I also propse to add 'immediate' optional argument because it may help 
to make a workaround timeout.rb + zero blocking point corner case.

What do you think?
Posted by SASADA Koichi (Guest)
on 2012-12-03 18:07
(Received via mailing list)
Actually, I like your proposal.
But I make weak objection.

The following code doesn't stop forever.

  timeout(3){
    # long calculation / infinite loop  w/o IO operation
  }

I guess most of case, the block includes IO operation and no problem.
However, there are several case for it.

This is Dec and Preview 2 was released.
I think it is too slow to introduce it.

Again, I like this proposal.
If no people have object, I can agree with this proposal.

Alternative proposal is making such a safe timeout method with different
name such as `safe_timeout'.
Posted by ko1 (Koichi Sasada) (Guest)
on 2012-12-05 18:01
(Received via mailing list)
Issue #7503 has been updated by ko1 (Koichi Sasada).

Status changed from Closed to Open

I need to make strongly objection about this commit (r38216) because 
this discussion is not concluded.

I believe at least mame-san's permission is needed to introduce this 
change.
This is big behavior change.

----------------------------------------
Bug #7503: make timeout.rb async-interrupt safe by default
https://bugs.ruby-lang.org/issues/7503#change-34428

Author: kosaki (Motohiro KOSAKI)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version: 2.0.0
ruby -v: trunk


Hi

Again and again we discussed, current timeout.rb is very dangerous 
because ExitException interrupt argument code and unwind call stack 
immediately.
It may prevent to run ensure block and makes resource leak.

I proposed change default to interrupted only on blocking point.

patch is here.
https://gist.github.com/4195015

I also propse to add 'immediate' optional argument because it may help 
to make a workaround timeout.rb + zero blocking point corner case.

What do you think?
Posted by ko1 (Koichi Sasada) (Guest)
on 2012-12-05 18:34
(Received via mailing list)
Issue #7503 has been updated by ko1 (Koichi Sasada).

Assignee set to mame (Yusuke Endoh)
Priority changed from Normal to High


----------------------------------------
Bug #7503: make timeout.rb async-interrupt safe by default
https://bugs.ruby-lang.org/issues/7503#change-34431

Author: kosaki (Motohiro KOSAKI)
Status: Open
Priority: High
Assignee: mame (Yusuke Endoh)
Category: core
Target version: 2.0.0
ruby -v: trunk


Hi

Again and again we discussed, current timeout.rb is very dangerous 
because ExitException interrupt argument code and unwind call stack 
immediately.
It may prevent to run ensure block and makes resource leak.

I proposed change default to interrupted only on blocking point.

patch is here.
https://gist.github.com/4195015

I also propse to add 'immediate' optional argument because it may help 
to make a workaround timeout.rb + zero blocking point corner case.

What do you think?
Posted by mame (Yusuke Endoh) (Guest)
on 2012-12-06 13:31
(Received via mailing list)
Issue #7503 has been updated by mame (Yusuke Endoh).

Priority changed from High to Normal
Target version changed from 2.0.0 to next minor


----------------------------------------
Feature #7503: make timeout.rb async-interrupt safe by default
https://bugs.ruby-lang.org/issues/7503#change-34478

Author: kosaki (Motohiro KOSAKI)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: next minor


Hi

Again and again we discussed, current timeout.rb is very dangerous 
because ExitException interrupt argument code and unwind call stack 
immediately.
It may prevent to run ensure block and makes resource leak.

I proposed change default to interrupted only on blocking point.

patch is here.
https://gist.github.com/4195015

I also propse to add 'immediate' optional argument because it may help 
to make a workaround timeout.rb + zero blocking point corner case.

What do you think?
Posted by Nobuyoshi Nakada (nobu)
on 2012-12-07 06:05
(Received via mailing list)
Issue #7503 has been updated by nobu (Nobuyoshi Nakada).

% Done changed from 100 to 50


----------------------------------------
Feature #7503: make timeout.rb async-interrupt safe by default
https://bugs.ruby-lang.org/issues/7503#change-34495

Author: kosaki (Motohiro KOSAKI)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: next minor


Hi

Again and again we discussed, current timeout.rb is very dangerous 
because ExitException interrupt argument code and unwind call stack 
immediately.
It may prevent to run ensure block and makes resource leak.

I proposed change default to interrupted only on blocking point.

patch is here.
https://gist.github.com/4195015

I also propse to add 'immediate' optional argument because it may help 
to make a workaround timeout.rb + zero blocking point corner case.

What do you think?
Posted by kosaki (Motohiro KOSAKI) (Guest)
on 2012-12-07 15:18
(Received via mailing list)
Issue #7503 has been updated by kosaki (Motohiro KOSAKI).

Status changed from Closed to Assigned

> Target version changed from 2.0.0 to next minor

r38216 was reverted then.


----------------------------------------
Feature #7503: make timeout.rb async-interrupt safe by default
https://bugs.ruby-lang.org/issues/7503#change-34508

Author: kosaki (Motohiro KOSAKI)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: next minor


Hi

Again and again we discussed, current timeout.rb is very dangerous 
because ExitException interrupt argument code and unwind call stack 
immediately.
It may prevent to run ensure block and makes resource leak.

I proposed change default to interrupted only on blocking point.

patch is here.
https://gist.github.com/4195015

I also propse to add 'immediate' optional argument because it may help 
to make a workaround timeout.rb + zero blocking point corner case.

What do you think?
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.