List:General Discussion« Previous MessageNext Message »
From:David Jonas Date:January 18 2005 12:08am
Subject:mysql_store_result -> Error: 2000 (CR_UNKNOWN_ERROR) Message:
Unknown MySQL error
View as plain text  

I have searched high and low for more specifics to the problem I am
having but to no avail. Hopefully someone here can help. I really
appreciate any knowledge that may be imparted. On to the question!

We have numerous mail servers running qmail/vpopmail with MySQL used as
the backend. Password authentication is done with vpopmail. Vpopmail is
written in C using the mysql api. Occassionally, as in once every 20
trys or so, not dependant on the system load, an error is thrown when
authenticating: vmysql: mysql store result failed. Tracking this error
leads to this line of code:

  Line 387: if (!(res_read = mysql_store_result(&mysql_read))) {

One line above does not fail, called on the same MySQL struct:

  Line 381: if (mysql_query(&mysql_read,SqlBufRead)) {

Dumping mysql_errno and mysql_error to syslog show this:

  errno=2000 error=Unknown MySQL error

The mysql error log doesn't contain any generated messages. 

I'm really at a loss here. The same query works moments later and
moments before. It doesn't seem to be dependent on the input to the

Here is the define for the query:

  #define USER_SELECT "select pw_name, pw_passwd, pw_uid, pw_gid, \
  pw_gecos, pw_dir, pw_shell , pw_clear_passwd, (pw_smtp <= pw_mpd && 
  pw_smtp >= 0) AS pw_allow_smtp, pw_aap \
  from %s where pw_name = \"%s\" and pw_domain = \"%s\" "

It is written to the buffer like this:

  snprintf(SqlBufRead, SQL_BUF_SIZE, USER_SELECT, domstr, user, domain);

Is there a way to make mysql more verbose to aid in locating this error?
Has anyone run across something similar? Am I just missing something

Thanks for your help,


------ Configuration Information --------

The client was running 3.23.x client libs, but I upgraded them to 4.1.9
and did not see a change (i did recompile vpopmail after the upgrade).

Here is the relevant server configuration information.

  # cat /proc/version
  Linux version 2.4.21-4.0.1.ELsmp (bhcompile@stripped) 
  (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-20)) #1 SMP Thu Oct
  23 01:27:36 EDT 2003

  # mysqld -V
  mysqld  Ver 4.1.7-standard-log for pc-linux on i686 (Official MySQL

  # tail /var/lib/mysql/hostname.err
  050113 05:33:04  mysqld started
  050113  5:33:05 [Warning] Changed limits: max_open_files: 65535 
  max_connections: 500  table_cache: 32512
  050113  5:33:06 [Warning] Asked for 196608 thread stack, but got
  050113  5:33:08  InnoDB: Started; log sequence number 0 43912
  /usr/sbin/mysqld: ready for connections.
  Version: '4.1.7-standard-log'  socket: '/var/lib/mysql/mysql.sock'   
  port: 3306  Official MySQL RPM

  # cat /etc/my.cnf
  port            = 3306
  socket          = /var/lib/mysql/mysql.sock
  #log            = /var/lib/mysql/query.log
  key_buffer = 128M
  max_allowed_packet = 1M
  table_cache = 96M
  sort_buffer_size = 1M
  read_buffer_size = 1M
  myisam_sort_buffer_size = 64M
  thread_cache = 8
  query_cache_size= 16M
  # Try number of CPU's*2 for thread_concurrency
  thread_concurrency = 8
  max_connections = 500

mysql_store_result -> Error: 2000 (CR_UNKNOWN_ERROR) Message:Unknown MySQL errorDavid Jonas18 Jan