Professional Web Applications Themes

[BUG] Additional info regarding ruby-talk:66239 - Ruby

Hi, In message "[BUG] Additional info regarding ruby-talk:66239" on 03/08/28, Idan Sofer <idanidanso.dyndns.org> writes: |I have recently encountered similiar problem as described on that thread, i.e., rb_bug |triggered by the GC, as a result of RBasic->flags and RBasic->klass switching variables. | |I've been working to produce a simple and trivial code that can trigger the bug easily. the |result is a small code snippet, the does the following: | |Launches 120 threads with a block, that does some 20,000 regexp matching. before |the thread quits, it creates an additional thread with the same block | |thread_block= Proc.new do | 1.upto(20000) ...

  1. #1

    Default Re: [BUG] Additional info regarding ruby-talk:66239

    Hi,

    In message "[BUG] Additional info regarding ruby-talk:66239"
    on 03/08/28, Idan Sofer <idanidanso.dyndns.org> writes:

    |I have recently encountered similiar problem as described on that thread, i.e., rb_bug
    |triggered by the GC, as a result of RBasic->flags and RBasic->klass switching variables.
    |
    |I've been working to produce a simple and trivial code that can trigger the bug easily. the
    |result is a small code snippet, the does the following:
    |
    |Launches 120 threads with a block, that does some 20,000 regexp matching. before
    |the thread quits, it creates an additional thread with the same block
    |
    |thread_block= Proc.new do
    | 1.upto(20000) do
    | "Hello"=~/bla/
    | end
    | Thread.new &thread_block
    |end
    |
    |1.upto(120) do
    | Thread.new &thread_block
    |end
    |Thread.stop
    |
    |Under ruby-1.8.0(from debian's sid) the bug will be always be triggered after a few
    |seconds of runtime.

    It does not happen on the latest CVS. I'm not sure whether we already
    fixed it or just by coincidence.

    matz.

    Yukihiro Matsumoto Guest

  2. #2

    Default Re: [BUG] Additional info regarding ruby-talk:66239

    >>>>> "I" == Idan Sofer <idanidanso.dyndns.org> writes:

    I> Negetive, I can still reproduce the problem from the latest CVS. It was
    I> noted gcc version may play a role here(either it's gcc bug, or gcc is
    I> just exposing it):

    Not really sure, but seems to be a bug in gcc : someone can test it with
    another compiler ?

    Guy Decoux




    ts Guest

  3. #3

    Default Re: [BUG] Additional info regarding ruby-talk:66239

    >>>>> "t" == ts <decouxmoulon.inra.fr> writes:

    t> Not really sure, but seems to be a bug in gcc : someone can test it with
    t> another compiler ?

    An example to see the problem (ruby-1.8.0, gcc 3.2 Redhat 8)

    With this modification

    svg% diff -u gc.c~ gc.c
    --- gc.c~ 2003-08-02 08:45:57.000000000 +0200
    +++ gc.c 2003-08-30 13:27:39.000000000 +0200
    -545,17 +545,21
    return Qfalse;
    }

    +static int in_locations_array = 0;
    +
    static void
    mark_locations_array(x, n)
    register VALUE *x;
    register long n;
    {
    + in_locations_array = 1;
    while (n--) {
    if (is_pointer_to_heap((void *)*x)) {
    rb_gc_mark(*x);
    }
    x++;
    }
    + in_locations_array = 0;
    }

    void
    -624,6 +628,12
    if (rb_special_const_p(ptr)) return; /* special const not marked */
    if (obj->as.basic.flags == 0) return; /* free cell */
    if (obj->as.basic.flags & FL_MARK) return; /* already marked */
    + if (!is_pointer_to_heap((void *)ptr)) {
    + fprintf(stderr, "error : in_locations_array %d -- ptr 0x%x -- heaps 0x%x\n",
    + in_locations_array, ptr, heaps);
    + exit(1);
    + }
    + in_locations_array = 0;
    obj->as.basic.flags |= FL_MARK;

    CHECK_STACK(ret);
    svg%

    svg% cat b.rb
    #!/usr/bin/ruby
    thread_block= Proc.new do
    1.upto(20000) do
    a = {1=>12}
    end
    Thread.new &thread_block
    end

    1.upto(120) do |i|
    Thread.new &thread_block
    end
    p "END"
    Thread.stop
    svg%

    svg% ./ruby b.rb
    error : in_locations_array 1 -- ptr 0x80e6898 -- heaps 0x80e6898
    svg%


    This mean that rb_gc_mark() is called from mark_locations_array() with the
    value 0x80e6898. But mark_locations_array() can't call it with the value
    0x80e6898 because is_pointer_to_heap() is false.

    I see, actually, only one explanation :
    * is_pointer_to_heap() is called with the right value (in
    mark_locations_array())
    * a *modified* value is given to rb_gc_mark()

    Now ruby will do

    obj->as.basic.flags |= FL_MARK;

    this means that heaps[0] is modified, and at this step the GC can't work.


    Guy Decoux

    ts Guest

  4. #4

    Default *.so file create with visual c++, How to do?

    Can anyone tell me how to use ms visual c++ to create a *.so file? I can't
    seem to find a version of gcc on the internet that I can readily use with
    windows 2000 proff.

    Thanks


    Thomas A. Reilly Guest

  5. #5

    Default Re: *.so file create with visual c++, How to do?

    Hi,

    At Sat, 30 Aug 2003 23:03:10 +0900,
    Thomas A. Reilly wrote:
    > Can anyone tell me how to use ms visual c++ to create a *.so file? I can't
    > seem to find a version of gcc on the internet that I can readily use with
    > windows 2000 proff.
    *.so files used in ruby are just DLLs.

    --
    Nobu Nakada

    nobu.nokada@softhome.net Guest

Similar Threads

  1. ruby-talk: 80813 (Rite/Ruby2.0 & Ruby vs OCaml)
    By Steven Lumos in forum Ruby
    Replies: 0
    Last Post: October 9th, 10:21 PM
  2. Bопpоc от ruby-talkruby-lang.org
    By Support in forum Ruby
    Replies: 0
    Last Post: September 16th, 07:46 PM
  3. Spam at ruby-talk
    By Dave Thomas in forum Ruby
    Replies: 8
    Last Post: August 1st, 11:30 AM
  4. Ruby talk from LL2
    By Stefan Arentz in forum Ruby
    Replies: 3
    Last Post: July 12th, 07:31 AM
  5. Приглашаем в сочи, Ruby-talk BwChgLZYJd
    By Санаторий Дружба in forum Ruby
    Replies: 0
    Last Post: July 5th, 07:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139