Project

General

Profile

Bug #9905

Updated by nobu (Nobuyoshi Nakada) almost 10 years ago

`test/ruby/test_fiber.rb` fails on AIX. 

 ~~~ 
 [ 2/23] TestFiber#test_argument/ss/home/rayod/Dev/Contribution/ruby-trunk-blue1/test/ruby/test_fiber.rb:19: [BUG] machine_stack_cache size is not canonicalized 
 ruby 2.2.0dev (2014-06-02 trunk 45270) [powerpc-aix7.1.0.0] 
 ~~~ 
 Here is what happens for this test: 

 1. 
 1) A fiber is created by setting `context->uc_stack.ss_size` to a certain value and calling `makecontext()`. makecontext(). 
 2. 2) While the fiber is switched with other fibers by `swapcontext()`, swapcontext(), `context->uc_stack.ss_size` is changed to a very large value by AIX. 
 3. 3) When the fiber finishes, its stack pointer and size are cached in `machine_stack_cache[]`. 
 4. 4) When a new fiber is created, a specified stack size is different from the cached stack size, so the error is thrown. 

 I feel AIX's behavior is strange, but I also suppose in general, `context->uc_stack.ss_size` is not guaranteed to be preserved after `makecontext()` makecontext() or `swapcontext()`. swapcontext(). (Please correct me if I am wrong.) 

 Rather than disabling `FIBER_USE_NATIVE` for AIX, I propose saving the original stack pointer and size not in `ucontext_t` but in new dedicated fields in `rb_fiber_t`, as you can find in the attached attched patch. With this patch, `test/ruby/test_fiber.rb` results in no errors on AIX. This did not cause any error on Linux, either, for test or test-all. 

Back