Segmentation Fault on Random Lines
I am running Arch Linux x86_64 using the current Ruby available from the official repos (ruby 1.9.2_p0-4 according to pacman). All packages on the system are up-to-date.
I'm working on a log parser for IRC logs. This is the third re-write and I continue to have the same problem: segfaults on random lines. The attached segfault occurred on: if c == "\n"
When it does not segfault, it generally continues until it throws an error such as:
:in `puts': wrong argument type #Class:0x000000009b4f88 (expected Data) (TypeError)
The only fix I have found for both of these is to disable the garbage collector with GC.disable, but that is obviously not a final solution.
In every segfault, I always see both of the following:
It consistently fails when the parser reads one small file and then reads a portion of another small file, so long as neither file is empty.
The code for the project is at https://github.com/kabaka/Ruby-IRC-Log-Processor and will not be updated while I wait for an answer on this. (Excuse the poor quality of the code — it's hard to work on it when it segfaults every time I run it).