Hi,
now the crash is in memcpy() when trying to write to master.info. Coming back to the beginning:
050219 7:21:03 Could not use ensim-relay-bin for logging (error 13). Turning logging off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it.
050219 7:21:03 next log error: -1 offset: 22 log: ./ensim-relay-bin.004
050219 7:21:03 Error reading relay log event: Error purging processed log
050219 7:21:03 Slave: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave. Error_code: 0
050219 7:21:03 Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'freebsds-bin.002' position 624574097
mysqld got signal 11;
The crash is expected (that is, you would not expect it and I don't consider it as normal, but looking at the code I understand why it crashes) as soon as there is this error "could not use ensim-relay-bin for logging". Relay log rotation is: it closes the current relay log and creates a new one. The creation of the new one fails (I don't know how and why, maybe it succeeds on disk but fails inside MySQL). So this error is printed and the relay log is marked as "closed" by the thread doing the rotation. Just after that the slave SQL thread comes and wants to write to the relay log, and (bug) it's not prepared to it being closed: it just expects it to always be open. So it tries to write to freed memory which is not nice of course... and segmentation fault.
We'll fix this segfault bug, but we have the more important one: why does it say it "could not use ensim-relay-bin for logging (error 13)"?? From the "error -1 offset 22" it could have to do with the relay log index file. I see two way to troubleshoot this:
1) install our debug binary on the slave and let it run with the --debug=d:t:i:O,/tmp/mysqld.trace option. It will run slower (sometimes) much slower than the normal binary. Let the slave run and crash and I'll tell you were to send us a copy of /tmp/mysqld.log (we won't need this entire file, probably only the end of it).
http://dev.mysql.com/downloads/mysql/4.0.html and for old versions
http://downloads.mysql.com/archives.php?p=mysql-4.0.
OR
2) let the slave run again and:
- before it rotates the relay log, save a copy of "ls *relay*" and a copy of the ensim-relay-bin.index file
- after it rotates and crashes (*before* you restart mysqld after the crash), save the same things again
and post them all here.
Good luck. By the way, it may be time to look into upgrading your slave to 4.1; 4.0 is starting to be old, I'd like to exclude the possibility of an already fixed bug.