Deadlock in eval when $SAFE>=4

Discussion in 'Ruby' started by Michael Witrant, Apr 28, 2004.

  1. The following code produces a deadlock:

    $ cat test.rb
    def foo bar = nil; end
    Thread.new { $SAFE=4; eval("foo foo foo") }.value

    $ ruby18 -v test.rb
    ruby 1.8.1 (2003-12-25) [i686-linux]
    test.rb:2:in `value': Thread(0x401d1900): deadlock (fatal)
    from test.rb:2

    It works well when $SAFE <= 3 or when the number of "foo" is <= 2.
     
    Michael Witrant, Apr 28, 2004
    #1
    1. Advertising

  2. "Michael Witrant" <> schrieb im Newsbeitrag
    news:...
    > The following code produces a deadlock:
    >
    > $ cat test.rb
    > def foo bar = nil; end
    > Thread.new { $SAFE=4; eval("foo foo foo") }.value
    >
    > $ ruby18 -v test.rb
    > ruby 1.8.1 (2003-12-25) [i686-linux]
    > test.rb:2:in `value': Thread(0x401d1900): deadlock (fatal)
    > from test.rb:2


    Funny...

    > It works well when $SAFE <= 3 or when the number of "foo" is <= 2.


    .... or when the string is syntactically correct:

    Thread.new { $SAFE=4; eval("foo; foo; foo") }.value

    robert
     
    Robert Klemme, Apr 28, 2004
    #2
    1. Advertising

  3. Michael Witrant

    ts Guest

    >>>>> "R" == Robert Klemme <> writes:

    R> .... or when the string is syntactically correct:

    It want to send a message

    warning: parenthesize argument(s) for future version

    because it run with $SAFE >= 4, it can't write ==> this stop the compile
    phase, which has set `rb_thread_critical = Qtrue'

    When it want to call Thread#value, it call Thread#join and because

    rb_thread_critical = Qtrue (it was not reset to Qfalse)

    it give the error deadlock


    Guy Decoux
     
    ts, Apr 28, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric Newton
    Replies:
    3
    Views:
    9,482
    Brock Allen
    Apr 4, 2005
  2. DataBinder.Eval and Eval.

    , Jun 16, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    562
    Karl Seguin [MVP]
    Jun 16, 2006
  3. Alex van der Spek

    eval('07') works, eval('08') fails, why?

    Alex van der Spek, Jan 8, 2009, in forum: Python
    Replies:
    6
    Views:
    1,487
    Bruno Desthuilliers
    Jan 8, 2009
  4. Liang Wang
    Replies:
    8
    Views:
    141
    Ben Morrow
    Feb 2, 2008
  5. Marc Girod

    to eval or not to eval?

    Marc Girod, Apr 19, 2011, in forum: Perl Misc
    Replies:
    2
    Views:
    164
    Marc Girod
    Apr 19, 2011
Loading...

Share This Page