Database issue not assigning token.

Report bugs and workarounds
Post Reply
ethandee178
Posts: 18
Joined: 26 May 2015 16:28

Database issue not assigning token.

Post by ethandee178 » 27 Aug 2018 12:39

Often time when I come in on a monday, my customers will tell me they can't release their mail.
Aside from some other possibly unrelated issues, the most common issue is that the 'token=' is blank in the link.
I've written a script to easily release these. But I know it is annoying to my customers.
Any one had this issue? Dealt with it?
Seems like it could be database related. Is there a database clean/tuning command I could run that might help?
Thanks.

BTW this is that easy release script:

#!/bin/bash

while true; do
until [[ $msgID == ??????????.????? ]]; do
if [[ $msgID == "exit" ]]; then
exit
fi
read -p "Message ID?: " msgID
done
fullpath=`find /var/spool/MailScanner/quarantine -iname *"$msgID"*`
echo $fullpath
/usr/sbin/sendmail.postfix -t <$fullpath
msgID=""
done

User avatar
shawniverson
Posts: 2605
Joined: 13 Jan 2014 23:30
Location: Rushville, Indiana, USA
Contact:

Re: Database issue not assigning token.

Post by shawniverson » 27 Aug 2018 21:47

Never, ever, use -t!

You could be releasing mail to everybody! Not just your own recipients!

Is the token really gone, or are the tokens expiring? Monday seems peculiar....
Version 3.0.2.6 released! Update now to keep your eFa secure!

ethandee178
Posts: 18
Joined: 26 May 2015 16:28

Re: Database issue not assigning token.

Post by ethandee178 » 17 Sep 2018 13:31

Another Monday with the same issue.
When I say the token is 'gone' I mean in the release link, it says 'token='
If I assign a token manually it releases no problem.
I also cloned and edited a page which I call release-msg-bak.cgi which doesn't check for the token.
It also releases it no problem.
The original (release-msg.cgi) is where I got the '-t' from.
I just copy and pasted.

User avatar
shawniverson
Posts: 2605
Joined: 13 Jan 2014 23:30
Location: Rushville, Indiana, USA
Contact:

Re: Database issue not assigning token.

Post by shawniverson » 18 Sep 2018 21:46

Yeah, that's why that script is deprecated and going away...

So there is a token for the email IDs in the SQL maillog table, just not in the report?

Just Mondays? Are you on 3.0.2.6? I want to try to reproduce this problem.

The token is important to prevent someone from exploiting the message release code.
Version 3.0.2.6 released! Update now to keep your eFa secure!

ethandee178
Posts: 18
Joined: 26 May 2015 16:28

Re: Database issue not assigning token.

Post by ethandee178 » 24 Sep 2018 18:11

Is there a better script I should use for release? Or an edit to make? I have no problem with that.
Or if there is already a KB on it just link it.
It seems (based on the the release script) that it is just requesting a valid token, not a specific token. It seems like any token can release any email, but the the trade off is it can only be used once as the release script removes it, thus verifying that it was released validly already. So next time it happens I will check the maillog table and see if anything related to the token is recorded there.

I realize the issue I cause by removing that validation. But I gotta make people happy in a hurry sometimes. Such is the world of I.T.

Just Mondays, yes, however, I don't check on the weekends so theoretically, it could happen F 6PM - M 7AM.

my motd says "You are currently running EFA-3.0.2.6."
And you are welcome to take a look into my system next time it happens if you think it'll help.

ethandee178
Posts: 18
Joined: 26 May 2015 16:28

Re: Database issue not assigning token.

Post by ethandee178 » 27 Sep 2018 15:08

Some new info, it happened again today on a Thursday! Gathered some info.
Web interface says:
Error: Database connection failed

It is possible that the database is overloaded or otherwise not running properly

Contact the system administrator if the problem persists

Webmin mysql says:
DBI connect failed : Too many connections

And I ran `show status like 'Conn%';`
and got this:
MariaDB [(none)]> show status like 'Conn%';
+-----------------------------------+--------+
| Variable_name | Value |
+-----------------------------------+--------+
| Connection_errors_accept | 0 |
| Connection_errors_internal | 0 |
| Connection_errors_max_connections | 20 |
| Connection_errors_peer_address | 0 |
| Connection_errors_select | 0 |
| Connection_errors_tcpwrap | 0 |
| Connections | 179878 |
+-----------------------------------+--------+
7 rows in set (0.23 sec)

And that's what I've got. Any thoughts?

User avatar
pdwalker
Posts: 1116
Joined: 18 Mar 2015 09:16

Re: Database issue not assigning token.

Post by pdwalker » 02 Oct 2018 04:01

So, you are clearly having some kind of database problem. What that means exactly, I don't know. You'll have to investigate your system to find out what is happening.

The connection failed error message is a symptom. Now you need to find the root cause.

Can you share your mysql configuration files?

Are there any interesting messages in the mysql error log? Do you have an error log enabled? Look in /var/lib/mysql. There may be a .err file present. (this depends on your version of efa and what you've installed it on)

Do you have any cpu/disk/memory monitoring tools running at the time you are getting the error?

Without more information, beyond saying "your db appears to have an issue", there is not much else I can suggest at this time.

ethandee178
Posts: 18
Joined: 26 May 2015 16:28

Re: Database issue not assigning token.

Post by ethandee178 » 11 Oct 2018 13:12

Error happened again today so I took some time to look into what you requested.
One additional thing, the processlist in mysql seems to be hung up. I'm not a mysql wiz so it'd be hard for me to figure out what's going on there.
Any ideas?
Thanks for you help.

See attachments.
Attachments
myemailfilter.zip
Some relevant text files and a HTOP screenshot
(162.55 KiB) Downloaded 5 times

User avatar
pdwalker
Posts: 1116
Joined: 18 Mar 2015 09:16

Re: Database issue not assigning token.

Post by pdwalker » 12 Oct 2018 04:05

What do you mean, “the processlist in MySQL appears to be hung up”?

Can you run the command “mysqladmin processlist”?

I’ll look through the logs shortly to see what you’ve sent.

ethandee178
Posts: 18
Joined: 26 May 2015 16:28

Re: Database issue not assigning token.

Post by ethandee178 » 15 Oct 2018 19:28

I attached my proccesslist in the zip file.
Thanks

User avatar
pdwalker
Posts: 1116
Joined: 18 Mar 2015 09:16

Re: Database issue not assigning token.

Post by pdwalker » 16 Oct 2018 03:04

ok, so what i can see is there is a delete query running on the mtalog table that's taking a long time to complete. And because that query locks the table, everything else stalls.

So, why is there a delete query, and why is it taking so long?

I'll need to check the mailwatch code to see if I can figure out what it is doing.

Can you also send me /etc/my.cnf?

Post Reply