Ruby hangs on OSX

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

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

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:insolve’
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:insolve’
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:insolve’
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:insolve’
sudoku_tests.rb:262:in solve_and_compare' sudoku_tests.rb:97:intest_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:insolve’
sudoku_tests.rb:262:in solve_and_compare' sudoku_tests.rb:47:intest_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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs