[MacRuby] #954: Assertion fails with IO.pipe, when checks size of String which had read from pipe.
#954: Assertion fails with IO.pipe, when checks size of String which had read from pipe. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Test Script: {{{ #!ruby r, w = IO.pipe s = "" t = Thread.new { r.read(5, s) } w.write "foobarbaz" true until s.size == 5 # crash p t.value p s }}} Result: {{{ $ ruby19 -v test_io.rb ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0] "fooba" "fooba" $ macruby test_io.rb Assertion failed: (IS_BSTR(str)), function rb_bstr_set_length, file string.c, line 6042. zsh: abort macruby test_io.rb }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/954> MacRuby <http://macruby.org/>
#954: Assertion fails with IO.pipe, when checks size of String which had read from pipe. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by lsansonetti@…): This looks like a race condition, when we transform the given string into binary. -- Ticket URL: <http://www.macruby.org/trac/ticket/954#comment:1> MacRuby <http://macruby.org/>
#954: Race condition: assertion fails with IO.pipe, when checks size of String which had read from pipe. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by lsansonetti@…): The following works: {{{ r, w = IO.pipe s = "" t = Thread.new { r.read(5, s) } w.write "foobarbaz" sleep 0.5 true until s.size == 5 # crash p t.value p s }}} The problem is that the same string object cannot be passed to IO#read and perform String#size at the same time. -- Ticket URL: <http://www.macruby.org/trac/ticket/954#comment:2> MacRuby <http://macruby.org/>
#954: Race condition: assertion fails with IO.pipe, when checks size of String which had read from pipe. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby Later Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Changes (by lsansonetti@…): * milestone: => MacRuby Later Comment: Screening for Later. This isn't something that should frequently happen, and when doing multithreaded programming in MacRuby, one must be careful when sharing objects from different threads. -- Ticket URL: <http://www.macruby.org/trac/ticket/954#comment:3> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby