Mysql falha por algumas consultas estranhas

1

Eu tenho algumas entradas de log estranhas na minha depuração, onde vejo que o mysql falha:

Apr 13 08:51:16 cronjob1 mysqld[22953]: Attempting backtrace. You can use the following information to find out
Apr 13 08:51:16 cronjob1 mysqld[22953]: where mysqld died. If you see no messages after this, something went
Apr 13 08:51:16 cronjob1 mysqld[22953]: terribly wrong...
Apr 13 08:51:16 cronjob1 mysqld[22953]: Cannot determine thread, fp=0x8543090, backtrace may not be correct.
Apr 13 08:51:16 cronjob1 mysqld[22953]: Bogus stack limit or frame pointer, fp=0x8543090, stack_bottom=0x44b70000, thread_stack=262144, aborting backtrace.
Apr 13 08:51:16 cronjob1 mysqld[22953]: Trying to get some variables.
Apr 13 08:51:16 cronjob1 mysqld[22953]: Some pointers may be invalid and cause the dump to abort...
Apr 13 08:51:16 cronjob1 mysqld[22953]: thd->query at 0x80ea1c0 = (SELECT city_id, name, count_character  
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011 FROM base.cities 
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011 WHERE country_id = 176 
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011#011AND name = "kierownik działu" 
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011 LIMIT 1) UNION ALL (SELECT city_id, name, count_character  
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011 FROM base.cities 
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011 WHERE country_id = 176 
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011#011AND name = "kierownik jakości" 
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011 LIMIT 1) UNION ALL (SELECT city_id, name, count_character  
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011 FROM base.cities 
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011 WHERE country_id = 176 
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011#011AND name = "kierownik łódzkie" 
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011 LIMIT 1) UNION ALL (SELECT city_id, name, count_character  
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011 FROM base.cities 
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011 WHERE country_id = 176 
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011#011AND name = "działu jakości" 
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011 LIMIT 1) UNION ALL (SELECT city_id, name, count_character  
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011 FROM base.cities 
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011 WHERE country_id = 176 
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011#011AND name = "działu łódzkie" 
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011 LIMIT 1) UNION ALL (SELECT city_id, name, count_character  
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011 FROM base.cities 
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011 WHERE country_id = 176 
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011#011AND name = "jakości łódzkie" 
Apr 13 08:51:16 cronjob1 mysqld[22953]: #011#011#011#011#011 LIMIT 1) UNION ALL (SELECT city_id, na
Apr 13 08:51:16 cronjob1 mysqld[22953]: thd->thread_id=20686
Apr 13 08:51:16 cronjob1 mysqld[22953]: The manual page at http://www.mysql.com/doc/en/Crashing.html contains
Apr 13 08:51:16 cronjob1 mysqld[22953]: information that should help you find out what is causing the crash.
Apr 13 08:51:16 cronjob1 mysqld_safe[31297]: Number of processes running now: 0
Apr 13 08:51:16 cronjob1 mysqld_safe[31299]: restarted

O problema aqui é que não sei de onde esse #011#011#011#011#011# está vindo. Estou usando mysql_real_escape_string () para a consulta.

    
por Nik 16.04.2011 / 11:23

2 respostas

1

@Ignacio diz que pare de usar o kill -9. Aqui está o porquê:

As tabelas MyISAM mantêm a contagem de identificadores de arquivos abertos para a tabela MyISAM. Se o mysqld apenas morre sem um processo de desligamento, essa contagem permanece como está. Para remover sua pegada, você pode fazer uma das duas coisas:

Por exemplo, se a tabela MyISAM for mydb.mytable

Opção 1

Enquanto o mysqld está desligado,

cd /var/lib/mysql/mydb
myisamchk -r mytable.MYD

documentação do myisamchk

Opção 2

Com o mysqld em execução, faça

CHECK TABLE tblname;
REPAIR TABLE tblname;
    
por 28.03.2011 / 18:23
0

Este parece ser um problema de codificação. Pode haver um símbolo na cadeia de consulta que não pode ser interpretado pelo conjunto de caracteres de conexões. Tente usar um conjunto de caracteres distinto para a conexão ou defina um padrão apropriado em mysql.conf (my.conf). Imprima ou registre a string de consulta antes de dispará-la, para ter uma idéia de como a string depois da função mysql_real_escape_string () se parece.

    
por 20.04.2011 / 23:56

Tags