Which logs are you referring to? For you testing purposes, if you have not
already, I would enable the general log and see what is happening on the
MySQL side.

-----Original Message-----
From: Josh Endries
To: [EMAIL PROTECTED]
Sent: 4/15/04 9:27 PM
Subject: repeated/duplicated query problem

Hello fellow listoers,

Long time reader first time poster. :P I just recently installed a 
MySQL server to back-end a mail system (PHP webmail, SMTP, and IMAP 
servers). Everything is working pretty well, but I have a reallt odd 
problem I can't difure out. I've asked a few times in #Mysql on 
freenode.net and noone has seen it before; hoepfully someone here can 
help me troubleshoot it or fix it.

First some info:

Pentium 4 3.20 GHz w/HT (2 logical CPUs)
1GB RAM
FreeBSD 4.9
MySQL 4.0.18 (via ports)

When I was setting up the whitelist/blacklist stuff in webmail, I 
noticed it was adding two records for every one entry on the list 
(when I added [EMAIL PROTECTED], two would be put in the db). Deleting 
them also removed two, so I didn't notice at first. After screwing up 
some things and discovering a huge table with lots of duplicates, I 
started watching the logs.

After spending probably hours playing with loops and other PHP things 
I noticed that, at the end of each script I ran, the last (and only 
the last) query got repeated. If I was adding a user to the whitelist, 
the final INSERT query was sent/processed two times. I hacked around 
this (had to get it up and running :( sigh) by adding a "null" 'SELECT 
'' from table..." query, which was sone twice. Since this was the last 
query, the "real" queries were only done once, so its a patch but not 
a fix.

I watched as I checked with my IMAP clients (Mozilla and PHP) and the 
password SELECT query was repeated. I watched as I sent myself some 
email and some of the queries from the SMTP server were repeated. 
Luckily these are all SELECTs; I do any INSERTs, UPDATEs, and MODIFYs 
manually right now, except for spam settings mentioned above, but this 
will change in the future. Basically I'm saying it isn't a PHP issue, 
or a script looping issue, and seems to me like a MySQL (and/or 
FreeBSD) issue. I guess it could be a client issue, but it's odd that 
every application accessing the server has the same problem. Maybe a 
FreeBSD MySQL client/library port problem.

Based on talks in #mysql, I watched the logs when using the mysql 
client (both localhost socket file and over TCP like the other 
servers), and mysql only ran the commands once -- no duplications. I'm 
pretty stumped as to what the problem is and what to do about it, or 
even how to diagnose the problem. I'm not sure if it duplicates the 
last query on a per-connection basis, or something else...but it only 
duplicated the last query in the PHP scripts (probably on a 
per-connection basis).

Thanks,
Josh

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to