Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: wip-deadlock

Sep 11, 2012

  1. Ryo Onodera

    working dead lock fix

    authored
  2. Ryo Onodera

    Use Rubinius.lock instead of Channel

    Conflicts:
    
    	kernel/bootstrap/thread18.rb
    	kernel/bootstrap/thread19.rb
    authored
  3. Ryo Onodera

    Completely fix deadlocks of Thread#raise

    In some cases, an exception isn't correctly raised by Thread#raise. If that is
    the case, Thread#join on that thread leads to the deadlock.
    
    Consider the following example:
    
      thread = Thread.new do
      end
      thread.raise(RuntimeError) # interrupts thread incorrectly
      begin
        thread.join # thread is dead, but thread.join never returns; deadlock
      rescue
      end
    
    There are three problems in the current code:
    
      1. raise_prim in Thread#raise isn't inside @lock.
      2. The thread execution cleanup doesn't lock correctly.
      3. Thread#raise indirectly calls Thread::wakeup. And it wakes up even
         sleeping threads waiting for locked channels.
    
    In the end, there should be only the following three good timings:
    
                   Time
                   ------------------------------------------------------->
      main thread  prepare - wakeup |
      new thread                    | call (interrupted) | lock - cleanup
    
                   Time
                   ------------------------------------------------------->
      main thread       | prepare - wakeup |
      new thread   call |                  | lock - cleanup
    
                   Time
                   ------------------------------------------------------->
      main thread                        | prepare (no-op) - wakeup (no-op)
      new thread   call | lock - cleanup |
    
    To fix all of the three problems, this commit does the followings respectively:
    
      1. Put raise_prim in Thread#raise under @lock
      2. Introduce Channel#uninterrupted_receive and Rubinius.check_interrupts to
         make the thread execution cleanup correctly lock.
      3. Remove waiting_channel to make Thread#wakeup not be so eager that it
         wakes up purposely sleeping threads.
    authored
  4. Dirkjan Bussink

    Merge pull request #1896 from voxik/terminal-width-fallback

    Add terminel width fallback.
    dbussink authored
  5. Vít Ondruch

    Add terminel width fallback.

    This provides fallback terminal width, in case there cannot be detected
    any.
    voxik authored
  6. Dirkjan Bussink

    Merge pull request #1887 from ryoqun/thread-rubinius-lock

    Use Rubinius.lock instead of Channel
    dbussink authored

Sep 10, 2012

  1. Ryo Onodera

    Use Rubinius.lock instead of Channel

    authored
  2. Dirkjan Bussink

    Make sure to reset root to NULL

    dbussink authored

Sep 08, 2012

  1. Correct spelling mistake.

    Robert Gleeson authored

Sep 07, 2012

  1. Dirkjan Bussink

    Merge pull request #1890 from tonysidaway/openbsd-build

    Openbsd build
    dbussink authored
  2. Dirkjan Bussink

    Merge pull request #1891 from voxik/fix-rake-install

    Fix rake install
    dbussink authored
  3. Vít Ondruch

    Use stagingdir local variable for better readibility.

    voxik authored
  4. Vít Ondruch

    Use configured path for header installation (#1757).

    voxik authored

Sep 06, 2012

  1. tonysidaway

    Accommodate iconv library versions that have function names of the fo…

    …rm libiconv_open, etc (OpenBSD)
    tonysidaway authored
  2. tonysidaway

    Cast string constant to char * before assigning to tm_64->tm_zone

    tonysidaway authored
  3. tonysidaway

    Filter out over-strict llvm-config --cxxflags flags encountered on Op…

    …enBSD
    tonysidaway authored

Sep 05, 2012

  1. Dirkjan Bussink

    Explicitly cast 64 bit values to long long

    dbussink authored

Sep 04, 2012

  1. Dirkjan Bussink

    Fix File.read benchmark

    dbussink authored
  2. Dirkjan Bussink

    Update licensing information for original sources

    dbussink authored
  3. Dirkjan Bussink

    Remove tags for passing specs on 32 bit for Time

    dbussink authored
  4. Dirkjan Bussink

    On Rubinius, we support large Time ranges even in 1.8 mode on 32 bit

    dbussink authored
  5. Dirkjan Bussink

    Support handling 64 bit timestamps on 32 bit machines

    This basically reimplements the logic in a way that I find much more
    understandable than the old code ported from MRI. This code is based on
    a combination of https://github.com/schwern/y2038 and the MRI source
    code, taking the most useful parts from both.
    
    Fixes #1842
    dbussink authored

Sep 03, 2012

  1. Ryo Onodera

    Revert "Add a spec for dead lock by Thread#kill and sleep"

    This reverts commit de62854.
    authored
  2. Dirkjan Bussink

    Merge pull request #1884 from ryoqun/thread-join-deadlock

    Fix Thread#join deadlock from use of Thread#kill and sleep
    dbussink authored

Sep 02, 2012

  1. Ryo Onodera

    Add a spec for dead lock by Thread#kill and sleep

    authored
  2. Ryo Onodera

    Fix timing issue of Thread#kill and sleep

    In some cases, a thread isn't correctly killed by Thread#kill. If that is the
    case, Thread#join on that thread leads to the deadlock.
    
    Consider the following example:
    
        thread = Thread.new do
          sleep
        end
        thread.kill # actually, don't kill
        thread.join # thread lives forever; deadlock
    
    Thread#kill does 2 things to kill a thread:
        1. prepares the thread to be terminated and
        2. wakes up the thread.
    
    Most of time, the wake-up is executed after the sleep in the killed thread.
    
    However, it is possible the wake-up is executed BEFORE the sleep in some rare
    cases. If that is the case, the wake-up does nothing because the thread is
    still waking up at that time. Then, the thread begins to sleep forever. As a
    result, Thread#join never returns.
    
    To avoid such a deadlock, Thread#sleep must check to terminate or not before
    actually sleeping. In addition, it must be asssured that the wake-up isn't
    executed AFTER the check BEFORE the sleep.
    
    The follwing diagrams illustrate the good and bad timings.
    
    Good timings:
    
                     Time
                     ------------------------------------------------------>
        main thread  prepare - wakeup (no-op) |
        new thread                            | check - no sleep - terminate
    
                     Time
                     ------------------------------------------------------>
        main thread                | prepare - wake-up |
        new thread   check - sleep |                   | terminate
    
                     Time
                     ------------------------------------------------------>
        main thread        | prepare |       | wake-up |
        new thread   check |         | sleep |         | terminate
    
    Bad timing:
    
                     Time
                     ------------------------------------------------------>
        main thread        | prepare - wake-up (no-op) |
        new thread   check |                           | sleep forever
    
    To fix the deadlock, this commit makes check_async be called before sleeping
    inside the park mutex.
    authored

Aug 30, 2012

  1. Brian Shirai

    Cleaned up debris from CompiledMethod rename.

    brixen authored
  2. Brian Shirai

    Renamed VMMethod to MachineCode.

    This was a difficult name choice but it is consistent with CompiledCode
    and (not yet used) SourceCode. The CompiledCode is an abstraction of
    computation that is the focal point around which much revolves. MachineCode
    is a representation of computation specialized for our (virtual) machine.
    
    While there is possible ambiguity against the idea of JIT'd machine code,
    our MachineCode is a proper data structure, not just the format of bits
    resulting from the JIT compilation process. Also, our MachineCode is properly
    scoped differently than any such class/concept in LLVM (or more generally,
    the JIT).
    
    Regarding naming of instances of MachineCode, the following rationale is used:
    
    * parameters/variables have been named 'mcode' since the use of the variable
      is elaborated by the surrounding code (ie making ambiguity less an issue)
      and long variable names can sometimes make code unweildy.
    * attributes/fields/accessors have been name 'machine_code' because they have
      less context to disambiguate.
    brixen authored
  3. Dirkjan Bussink

    Implement rb_iter_break()

    dbussink authored
  4. Dirkjan Bussink

    Add specs for rb_iter_break

    dbussink authored

Aug 29, 2012

  1. Dirkjan Bussink

    Add rb_catch and in 1.9 mode rb_catch_obj and rb_throw_obj

    dbussink authored
  2. Dirkjan Bussink

    Add specs for rb_throw_obj and rb_catch_obj

    dbussink authored
  3. Dirkjan Bussink

    Add specs for rb_catch

    dbussink authored
  4. Dirkjan Bussink

    Make sure to parse options before starting the first VM

    dbussink authored

Aug 27, 2012

  1. Brian Shirai

    Merge pull request #1879 from r-stu31/configure_flags

    configure: add CPPFLAGS and LDFLAGS where missing
    brixen authored
Something went wrong with that request. Please try again.