pioz / chess

A fast chess library that use bitboards to play chess with Ruby
GNU Lesser General Public License v3.0
59 stars 17 forks source link

Memory issue on Ubuntu 14.04.1 #8

Closed alexggordon closed 9 years ago

alexggordon commented 9 years ago

Hey,

So I've been running into a reproducible issue on Ubuntu 14.04.1, with Ruby 2.1.0 through 2.2.0 (haven't tested before ruby 2.1.0) where every time I try and use the set_fen method, ruby crashes with a Error inirb': free(): invalid next size (fast): 0x00007f2f89f17ae0` (obviously the memory location changes every time). I've been working around this in the mean time by modifying the pgn class to accept strings while I try and figure out the issue, however, I'm running out of ideas, and since you wrote the C library backing the gem I was wondering if you had any thoughts on it?

I'm currently working on setting up a docker container to reproduce the error for you, but I figured I'd start the discussion now.

Thanks!

pioz commented 9 years ago

Ok, I'll wait your docker container... I cant reproduce this error with my enviroments.

alexggordon commented 9 years ago

Created and pushed a docker repository with Ubuntu 14.04 and Ruby 2.2.0/2.1.5 through rbenv.

Steps to reproduce:

root@d04ee708e681:~# irb
irb(main):001:0> require 'chess'
=> true
irb(main):002:0> g = Chess::Game.load_fen('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1')
*** Error in `irb': free(): invalid next size (fast): 0x00007f43132f2350 ***
Aborted

Any ideas? I was playing around with seeing if I could boot the gem in valgrind or something, but I haven't used mkmf much at all. In addition to that, normally I'd expect it to be something related to the ruby version, but on OS X, it works fine on 2.2.0 and 2.1.5, which leads me to believe it's C or C compiler related.

pioz commented 9 years ago

Ok, I've pushed some changes, can you check if now works? You can use the master branch.

alexggordon commented 9 years ago

Awesome. Looks good! Seems to work perfectly. Would you mind deploying the ruby gem too? Thanks!

pioz commented 9 years ago

:+1: pushed!