#155 Incorrect key file for table './opensips/active_watchers.MYI

1.5.x
closed-invalid
modules (454)
5
2009-07-07
2009-07-06
No

Using OpenSIPS trunk rev 5738 as presence server.

After restarting MySQL server I get the following errors in the log:

--------------------
Jul 6 12:43:08 myserver /usr/sbin/opensips[30437]: ERROR:db_mysql:db_mysql_do_prepared_query: mysql_stmt_execute() failed(2): (2002) Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Jul 6 12:43:08 myserver /usr/sbin/opensips[30436]: ERROR:db_mysql:db_mysql_do_prepared_query: mysql_stmt_execute() failed(2): (2002) Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Jul 6 12:43:08 myserver /usr/sbin/opensips[30434]: ERROR:db_mysql:db_mysql_do_prepared_query: mysql_stmt_execute() failed(2): (2002) Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Jul 6 12:43:08 myserver /usr/sbin/opensips[30438]: ERROR:db_mysql:db_mysql_do_prepared_query: mysql_stmt_execute() failed(2): (2002) Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Jul 6 12:43:17 myserver /usr/sbin/opensips[30440]: ERROR:db_mysql:db_mysql_do_prepared_query: mysql_stmt_execute() failed(2): (1210) Incorrect arguments to mysql_stmt_execute
Jul 6 12:43:40 myserver /usr/sbin/opensips[30436]: ERROR:db_mysql:db_mysql_do_prepared_query: mysql_stmt_execute() failed(2): (1210) Incorrect arguments to mysql_stmt_execute
Jul 6 12:43:40 myserver /usr/sbin/opensips[30437]: ERROR:db_mysql:re_init_statement: failed while mysql_stmt_prepare: (2002) Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
Jul 6 12:43:40 myserver /usr/sbin/opensips[30437]: ERROR:db_mysql:db_mysql_do_prepared_query: failed to re-init statement!
Jul 6 12:43:40 myserver /usr/sbin/opensips[30437]: ERROR:presence:insert_subs_db: unsuccessful sql insert
Jul 6 12:43:40 myserver /usr/sbin/opensips[30433]: ERROR:db_mysql:re_init_statement: failed while mysql_stmt_prepare: (2002) Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
Jul 6 12:43:40 myserver /usr/sbin/opensips[30433]: ERROR:db_mysql:db_mysql_do_prepared_query: failed to re-init statement!
Jul 6 12:44:15 myserver /usr/sbin/opensips[30438]: ERROR:db_mysql:db_mysql_do_prepared_query: mysql_stmt_execute() failed(2): (126) Incorrect key file for table './opensips/active_watchers.MYI'; try to repair it
Jul 6 12:44:15 myserver /usr/sbin/opensips[30438]: ERROR:presence:insert_subs_db: unsuccessful sql insert
Jul 6 12:44:58 myserver /usr/sbin/opensips[30440]: ERROR:db_mysql:db_mysql_do_prepared_query: mysql_stmt_execute() failed(2): (126) Incorrect key file for table './opensips/active_watchers.MYI'; try to repair it
Jul 6 12:46:38 myserver /usr/sbin/opensips[30440]: ERROR:db_mysql:db_mysql_do_prepared_query: mysql_stmt_execute() failed(2): (126) Incorrect key file for table './opensips/active_watchers.MYI'; try to repair it
Jul 6 12:48:18 myserver /usr/sbin/opensips[30440]: ERROR:db_mysql:db_mysql_do_prepared_query: mysql_stmt_execute() failed(2): (126) Incorrect key file for table './opensips/active_watchers.MYI'; try to repair it
Jul 6 12:49:58 myserver /usr/sbin/opensips[30440]: ERROR:db_mysql:db_mysql_do_prepared_query: mysql_stmt_execute() failed(2): (126) Incorrect key file for table './opensips/active_watchers.MYI'; try to repair it
Jul 6 12:51:38 myserver /usr/sbin/opensips[30440]: ERROR:db_mysql:db_mysql_do_prepared_query: mysql_stmt_execute() failed(2): (126) Incorrect key file for table './opensips/active_watchers.MYI'; try to repair it
[...]
-----------------------------

Note that I restarted MySQL at 12:43.

Discussion

  • Iñaki Baz Castillo

    It could be a bug in MySQL MyISAM:
    http://forums.mysql.com/read.php?21,50214,50214#msg-50214

    Note that if I repair the active_watcher table, it's in fact repaired:

    mysql> REPAIR TABLE active_watchers;
    +--------------------------+--------+----------+------------------------------------+
    | Table | Op | Msg_type | Msg_text |
    +--------------------------+--------+----------+------------------------------------+
    | opensips.active_watchers | repair | warning | Number of rows changed from 6 to 5 |
    | opensips.active_watchers | repair | status | OK |
    +--------------------------+--------+----------+------------------------------------+
    2 rows in set (0.00 sec)

    So, perhaps the table was corrupted and it's not related to OpenSIPS at all?

     
  • Iñaki Baz Castillo

    • summary: "mysql_stmt_execute() failed" after restart MySQL --> Incorrect key file for table './opensips/active_watchers.MYI
     
  • Iñaki Baz Castillo

    Reparing the table is not enough, it remains occuring (but now "REPAIR TABLE active_watchers" shows no errors).
    I've dumped the table content, deleted it and regenerated from the dump. Let's see what happens.

     
  • Bogdan-Andrei Iancu

    • assigned_to: nobody --> bogdan_iancu
     
  • Bogdan-Andrei Iancu

    Hi Inaki,

    I just backported to 1.5 the fixes from db_mysql (reconnect part) from trunk - maybe you can give it a try, even if i do not think is related to this report - I guess something wrong happened with the tables during restart - the queries done by OpenSIPS cannot bring the table into such state.

    Regards,
    Bogdan

     
  • Iñaki Baz Castillo

    Bogdan, it must be a problem in MyISAM indexes. After dumping the whole table and regenerating it from the dump file, the error never happens. Also, in the MySQL bug report I pointed in my first comment, more people got the same solution (regenerating the table, or using InnoDB).

     
  • Bogdan-Andrei Iancu

    yes, that was my impression also while googling for this kind of error. Maybe changing the default table type to InnoDB will be something smarter ;).

    I will close this report - if something new comes up, please re-open it or open a new one.

    Thanks and regards,
    Bogdan

     
  • Bogdan-Andrei Iancu

    • status: open --> closed-invalid
     

Log in to post a comment.