# Ruby hangs on OSX

**URL:** <https://www.ruby-forum.com/t/ruby-hangs-on-osx/76934>\
**Category:** Ruby\
**Created:** [November 22, 2006, 3:40pm UTC](https://www.ruby-forum.com/t/ruby-hangs-on-osx/76934 "2006-11-22T15:40:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mariano\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@Mariano\_K](https://www.ruby-forum.com/u/Mariano_K)\
**Post date:** [November 22, 2006, 3:40pm UTC](https://www.ruby-forum.com/t/ruby-hangs-on-osx/76934/1 "2006-11-22T15:40:42Z")

</div>

Hi,

I encountered a strange problem.

When running “ruby soduku\_test.rb -n test\_next\_cell” the process  
hangs and eats up all of the assigned CPU . I have no idea why that  
is … I asked a friend to run it on windows and it does work there.  
The program yield in a stack overflow.

I recently reinstalled my computer and used darwinports. I don’t  
think that I’ve seen that problem before. I also reinstalled ruby  
again, but with not much success and the same thing happens on  
another Mac too.

Installing ruby the way I used to do it before, using the  
hivelogic tutorial, also didn’t work.

That are the versions that fail:

ruby 1.8.5 (2006-08-25) [i686-darwin8.8.3] # darwin ports 1.3.1,  
gcc 4.0  
ruby 1.8.4 (2005-12-24) [i686-darwin8.8.3] # directly from the  
sources (hivelogic tutorial)  
ruby 1.8.2 (2004-12-25) [universal-darwin8.0] # comes with Tiger

Both Macs (MB C2D, MBP CD) are running OSX 10.4.8 with all updates.

uname -v:  
Darwin Kernel Version 8.8.3: Wed Oct 18 21:57:10 PDT 2006;  
root:xnu-792.15.4.obj~4/RELEASE\_I386

A stack trace of the “working” run on Windows is below this mail.

I attached the code. Unfortunately I haven’t been able to isolate  
the problem, but at least the code consistently fails.

Any ideas? Can somebody please try it out on another Mac? I will  
also do that later on.

Cheers,  
Mariano

---

<div class="post-metadata">

**Author:** ![Mariano\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@Mariano\_K](https://www.ruby-forum.com/u/Mariano_K)\
**Post date:** [November 23, 2006, 11:12pm UTC](https://www.ruby-forum.com/t/ruby-hangs-on-osx/76934/2 "2006-11-23T23:12:08Z")

</div>

Hi,

still not sure what the problem really is about. As nobody  
answered I assume this is something with my two described fresh  
installs?

Anyway … What I found is that reducing the stack size from 8192  
to 4096 with “ulimit -s 4096” it works. I get the stacklevel too deep  
error.

Now I am wondering what the “right” value and why is nobody else  
hitting that wall?

Cheers,  
Mariano

---

<div class="post-metadata">

**Author:** ![Mariano\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@Mariano\_K](https://www.ruby-forum.com/u/Mariano_K)\
**Post date:** [November 24, 2006, 12:51pm UTC](https://www.ruby-forum.com/t/ruby-hangs-on-osx/76934/3 "2006-11-24T12:51:32Z")

</div>

Btw. The strange behaviour is not limited to stack overflows.

I also see now an interesting style of error reporting:

localhost:~//code/sudoku mkamp$ ruby sudoku\_tests.rb  
sudoku\_tests.rb:231: warning: parenthesize argument(s) for future  
version  
sudoku\_tests.rb:232: warning: parenthesize argument(s) for future  
version  
Loaded suite sudoku\_tests  
Started  
…E…E…EEE.type: code total: 150, empty: 28, code: 103, comment: 19  
type: test total: 286, empty: 59, code: 222, comment: 5  
.  
Finished in 0.052318 seconds.

^C 1) Error:  
test\_empty(SudokuTests):  
NameError: undefined local variable or method `possible' for #<Sudoku: 0x30b16c> ./sudoku.rb:74:in`solve’  
sudoku\_tests.rb:125:in `test\_empty’

^C 2) Error:  
test\_michl(SudokuTests):  
NameError: undefined local variable or method `possible' for #<Sudoku: 0x356018> ./sudoku.rb:74:in`solve’  
sudoku\_tests.rb:119:in `test\_michl’

^C 3) Error:  
test\_solve(SudokuTests):  
NameError: undefined local variable or method `possible' for #<Sudoku: 0x1de8dc> ./sudoku.rb:74:in`solve’  
sudoku\_tests.rb:15:in `test\_solve’

^C 4) Error:  
test\_solve\_with\_canned\_complex\_solution(SudokuTests):  
NameError: undefined local variable or method `possible' for #<Sudoku: 0x1c5c10> ./sudoku.rb:74:in`solve’  
sudoku\_tests.rb:262:in `solve_and_compare' sudoku_tests.rb:97:in`test\_solve\_with\_canned\_complex\_solution’

^C 5) Error:  
test\_solve\_with\_canned\_simple\_solution(SudokuTests):  
NameError: undefined local variable or method `possible' for #<Sudoku: 0x327e98> ./sudoku.rb:74:in`solve’  
sudoku\_tests.rb:262:in `solve_and_compare' sudoku_tests.rb:47:in`test\_solve\_with\_canned\_simple\_solution’

14 tests, 50 assertions, 0 failures, 5 errors

I have to press CTRL+C many times to end the program otherwise it  
hangs and eats my CPU.

Any ideas? Any?

Btw. I tried to recompile ruby without -O2 in the CFLAGS, but that  
didn’t change a thing except a 50% performance penality.

Cheers,  
Mariano

---

<div class="post-metadata">

**Author:** ![Mariano\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@Mariano\_K](https://www.ruby-forum.com/u/Mariano_K)\
**Post date:** [November 27, 2006, 1:52am UTC](https://www.ruby-forum.com/t/ruby-hangs-on-osx/76934/4 "2006-11-27T01:52:18Z")

</div>

Hi Mariano,

Interestingly, the program you’ve sent around works for me on my G4  
Powerbook using Ruby 1.8.4 built using Fink (same stack size you quoted  
as well) - however I see the same problems you’ve described when  
running the script under Linux (Debian testing, Ruby 1.8.4) and on my  
Intel iMac at home (same environment & compiler as the G4, just  
different architecture).

Looks like it’s a cross platform problem. Anyone have any ideas what  
might be wrong or what other info we could send in to help diagnose it  
with?

Cheers,

Marcus
