`sysread ': Aborted system call (Errno :: EINTR) When using Ruby and mysql

I clean the site with a machine and click on mysql db. I often get these sys read errors, and I'm not sure what the solution is. I am using Ruby-mysql stone.

+3
source share
2 answers

I did the same (mechanize + mysql) and I solved it by wrapping my mysql calls with the begin / rescue / end clause:

begin
  mysql_insert data
rescue Interrupt, Errno::EINTR
  mysql_close connection
  connection = mysql_connect
  retry
end

Please note that this puts your code in an infinite loop, if you use it in something real, I would recommend placing some kind of limiter on it. All mysql_ * are my own methods.

+2
source

. mysql-gem, rvm gem, - osx ruby. osx ruby, bundler, rvm gem, .

rvm rvm .

+1

All Articles