• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

QMail : Slow, added -Rt0 in xine, but another problem

S

Swakoo

Guest
Hi guys,

I had a non-critical problem with my qmail, in which, for SMTP sending, it takes ages to send.

Did a search and I've added -Rt0 to the server_args line to reduce the timeout and disable reverse lookup...

it works wonderful, everything is smooth

But now i realise, mails send out to external domains are not being processed! all stuck in remote queue, but local queue no problem whatsoever...

have removed the -Rt0.. hope you guys got a clue or 2..

thanks!

ps: I got the -Rt0 from here (http://forum.plesk.com/showthread.php?s=&threadid=9387&perpage=15&pagenumber=2)
 
The -Rt0 by itself should not be the cause of stuck mails in the queue.

Unless during the editing of the smtp_psa file, the editor inserted line breaks where it should not have (I have seen this happen with pico, nano, vi editors sometimes)

The Server Args line is quite long and after you edit it, it should still be a single continuous line!

I have also seen this happen if you use a Windows based editor to edit Linux files.

And are you sure that the stuck emails are not Spam bounces/double bounces?
 
because all my clients complained their recipients have not received their mails (those outside the domains controlled by PLESK)

My line is quite long..
server_args = /var/qmail/bin/relaylock /var/qmail/bin/qmail-smtpd /var/qmail/bin/smtp_auth /var/qmail/bin/true /var/qmail/bin/cmd5checkpw /var/qmail/bin/true


And it happens after I added -Rt0.

First time, i thought it was a conincidence. When I restore the arguement, today users complained again...

my mail queue swelled to 40000 already... I tried to use qmHandle to remove those mails but the qmHandle script doesn't work.. need to configure the pidof.. i replaced it with ps command..

after which the pidof error message doesn't appear, but it says it deteced QMail as not running, thus it won't be starting it.

But a check.. the message in queue is still there :S
 
my immediate concern now is to clear the mail queue, so people's mail cnan move in and out smoothly..

qmHandle isn't working.. tried a search no net but nothing... :(

at my wit's end now...

am quite a noob with linux thats why

would appreciate help :)
 
ok will stick to here..

btw your commad, it should be -f 1 instead ;) that will give the pid.. but your command help nonetheless!
-f 2 gave me pts/02 hehe


ok here's the headache... i have deleted ALL the email in the queue now as it was getting stuck and not being moved...

i just tried mailing to my own email account and to my external (gmail) account..

nothing yet... sob sob
 
OS specifics... f2 vs f1

Sorry I don't have an EL3 test system :)

Sounds like you may have other problems. Have you been keeping an eye on your mail log?

/usr/local/psa/var/log/maillog

(again, may be OS specific location)
 
Originally posted by jamesyeeoc
OS specifics... f2 vs f1

Sorry I don't have an EL3 test system :)

Sounds like you may have other problems. Have you been keeping an eye on your mail log?

/usr/local/psa/var/log/maillog

(again, may be OS specific location)

Oh the command is OS specific? Thanks for enlightening.. trying to pick up the tricks of the trade here (the hard way apparently!)

Log don show anything abnormal..or not that I recognise it as abnormal

problem started whenever i add the -Rt0 to the server_args
while I find it wierd too... thats the occurance... hope you guys can be patient with me as I seek to solve this step by step

Below is my smtp_psa
service smtp
{
socket_type = stream
protocol = tcp
wait = no
disable = no
user = root
instances = UNLIMITED
server = /var/qmail/bin/tcp-env
server_args = /var/qmail/bin/relaylock /var/qmail/bin/qmail-smtpd /var/qmail/bin/smtp_auth /var/qmail/bin/true /var/qmail/bin/cmd5checkpw /var/qmail/bin/true
}

After adding -Rt0, I will be enjoying the quick sending of mail.. but soon after I will start hearing complaints of users' mails out to external parties not being received...

For now, everything is back to normal...
but what a terrible conincidence :(

On a side note: How do I do a cron script that I can purge the mail queue of "failure notice" using qmHandle...

many thanks to the patient people out here :)
 
Sorry, the -f2 was actually a typo on my part, it should have been -f1.

As to cron job, you can either use the Plesk control panel (Server - Crontab) and enter a new cron job for user root, or it can be done from the SSH command line.

For example if you want it to run every 10 minutes, create a cron job such as:

*/10 * * * * /usr/bin/qmHandle -S"failure notice" >/dev/null 2>&1

What this does is: runs every 10 minutes (*/10) of every hour/day/month/day of the week (* * * *), runs the command '/usr/bin/qmHandle' with parameter '-Stext' where the subject text is 'failure notice'. Per qmHandle:
-Stext : delete all messages that have/contain text as Subject
And any output is sent to dev/null (>/dev/null), error messages redirected to stdout (2>&1)

As to the problem with adding '-Rt0' to your smtp_psa, I have no further clues as to why it would cause a problem, because it shouldn't cause any, it just turns off rDNS lookup and sets the timout to zero.

Are you running on a VPS type server or a standalone dedicated??
 
Just that both time the mail stop sending out.. it was after I added the -Rt0... so now I am apprendensive about it.. but i really want to add it :(

My is a dedicated server.. i set it up from scratch.. it is a DNS/EMail server


my qmHandle runs from /tmp
does it matter?

outputting to /dev/null - means? any special funmction for that folder

stdout.. means print on screen?
 
Just that both time the mail stop sending out.. it was after I added the -Rt0... so now I am apprendensive about it.. but i really want to add it
That is a zero, not an Oh, right? And spaces on both sides of it. That's what is really weird, this has been a fix for years now and about the only things I have seen go wrong is if ^M chars are put in the file from Windows type editors (non-Linux editors), or if the ServerArgs line got broken up by the Linux editor inserting a line break in the middle of the line.

My is a dedicated server.. i set it up from scratch.. it is a DNS/EMail server
Ok, just checking, if it were on a VPS there may be other considerations regarding Qmail

my qmHandle runs from /tmp
does it matter?
Hmm, not sure. Why is it in /tmp??

outputting to /dev/null - means? any special funmction for that folder
It means the output goes to the bit-bucket, into never-never land, a great black hole of electrons.

stdout.. means print on screen?
Generally, yes.
 
Thanks for your patience with me..

hmmm i understand its quite an old fix.. dunno should I try it again... :S

Oh so /dev/null its like a rubbish bin for us to throw our output and ensure that it gets thrown out for good?

I usually download stuff into /tmp to try first..
whats /usr/bin about? What kind of files are there usually?

As you can see, I am a pretty noob to linux.. many thing is just pick up here and there...

thanks once again for your undying patience ;)

Originally posted by jamesyeeoc
Just that both time the mail stop sending out.. it was after I added the -Rt0... so now I am apprendensive about it.. but i really want to add it
That is a zero, not an Oh, right? And spaces on both sides of it. That's what is really weird, this has been a fix for years now and about the only things I have seen go wrong is if ^M chars are put in the file from Windows type editors (non-Linux editors), or if the ServerArgs line got broken up by the Linux editor inserting a line break in the middle of the line.

My is a dedicated server.. i set it up from scratch.. it is a DNS/EMail server
Ok, just checking, if it were on a VPS there may be other considerations regarding Qmail

my qmHandle runs from /tmp
does it matter?
Hmm, not sure. Why is it in /tmp??

outputting to /dev/null - means? any special funmction for that folder
It means the output goes to the bit-bucket, into never-never land, a great black hole of electrons.

stdout.. means print on screen?
Generally, yes.
 
hmmm i understand its quite an old fix.. dunno should I try it again... :S
That is the million dollar question, for myself, I certainly would want to 'fix' the delay problem. If adding the -Rt0 again caused the problem, you bet I would be digging until I found the cause.

Oh so /dev/null its like a rubbish bin for us to throw our output and ensure that it gets thrown out for good?
Yup. And you don't even have to 'empty' the bin like in Windows

I usually download stuff into /tmp to try first..
whats /usr/bin about? What kind of files are there usually?
User Binaries (user programs)

As you can see, I am a pretty noob to linux.. many thing is just pick up here and there...
No problem. We all have to learn sometime. At least this forum has a bunch of great and knowledgeable guys. There are some forums where the replies range from sarcastic to insulting.

thanks once again for your undying patience
My pleasure. If I had wanted to be any poorer, I actually would have become a teacher :) I actually like explaining things when I can, rather than short, curt/terse answers which only make one scratch one's head.......I guess that comes from raising 5 boys and now a couple of grand kids
 
Originally posted by jamesyeeoc
hmmm i understand its quite anold fix.. dunno should I try it again... :S
That is the million dollar question, for myself, I certainly would want to 'fix' the delay problem. If adding the -Rt0 again caused the problem, you bet I would be digging until I found the cause.

Oh so /dev/null its like a rubbish bin for us to throw our output and ensure that it gets thrown out for good?
Yup. And you don't even have to 'empty' the bin like in Windows

I usually download stuff into /tmp to try first..
whats /usr/bin about? What kind of files are there usually?
User Binaries (user programs)

As you can see, I am a pretty noob to linux.. many thing is just pick up here and there...
No problem. We all have to learn sometime. At least this forum has a bunch of great and knowledgeable guys. There are some forums where the replies range from sarcastic to insulting.

thanks once again for your undying patience
My pleasure. If I had wanted to be any poorer, I actually would have become a teacher :) I actually like explaining things when I can, rather than short, curt/terse answers which only make one scratch one's head.......I guess that comes from raising 5 boys and now a couple of grand kids

What do you reckon could or may be the problem and where i should try starting? I have absolutely no idea now.

Woah, I see you have cross many bridges :)
 
If adding the -Rt0 again caused the problem, you bet I would be digging until I found the cause.
Since you say that the problem only begins sometime after adding this mod (not immediately), when it happens I would check the status of qmail, SA, bind/named, imap, and other critical services to make sure they are running. I know you have probably already done some or all of these, but without further details...

Example: ps -ax |grep 'qmail'
Example: ps -ax |grep 'imap'
Example: ps -ax |grep 'spam'

I would also check (using netstat) to make sure that something is 'listening' on the ports.

Example: netstat -pan |grep ':25'
Example: netstat -pan |grep ':143'
Example: netstat -pan |grep ':110'
Example: netstat -pan |grep 'spam'

I would be checking the log files for any type of clues

Example: tail /var/log/messages
Example: tail /usr/local/psa/var/log/maillog
Example: tail /usr/local/psa/var/log/smtp_pendings.log

And probably a hundred other things which my fingers do without any brain cell interaction :)
 
And probably a hundred other things which my fingers do without any brain cell interaction

How I wish I'll be able to obtain that stage! More Jedi training! :p

I only check for qmail status.. which always is running... though sometimes it isn't, then again, that is ONLY after me frantically trying to settle the problem - may have stop it myself.

- What's imap task? and 'spam' - Is there such a process? How about sendmail?

- I suppose what netstat does is to listen to ports?

if say the problem comes again, mail get stuck in queue, what you reckon i can do? The last time round i had to delete the queue! and remove -Rt0

the first time I removed the command, do a bit of restarting of service, run qmhandle to clear it.. i think it helps.. somehow.. the last time it didn't...
 
Originally posted by Swakoo
How I wish I'll be able to obtain that stage! More Jedi training! :p
Time, patience, research and practice. I am a relative 'newbie' compared to some others, like atomicrocketturtle...

I only check for qmail status.. which always is running... though sometimes it isn't, then again, that is ONLY after me frantically trying to settle the problem - may have stop it myself.

- What's imap task? and 'spam' - Is there such a process? How about sendmail?
Courier-imap: An SMTP/IMAP/POP3 and webmail server with extensions for mailing list management
and spam filtering. Using grep to filter anything with 'spam' in the list, such as Spamassassin, which is a good thing, it is installed normally. Sendmail is replaced by Qmail on Plesk servers.


- I suppose what netstat does is to listen to ports?
netstat can report many things. In the examples above, it will show if there is anything 'listening' on those ports.

if say the problem comes again, mail get stuck in queue, what you reckon i can do? The last time round i had to delete the queue! and remove -Rt0
I would do those things I listed in my previous post

the first time I removed the command, do a bit of restarting of service, run qmhandle to clear it.. i think it helps.. somehow.. the last time it didn't... That's fine, but does nothing to track down what the problem may be. Those steps just help get things running again. I understand that when the customers are calling you have to try and get it working quickly, but if you never track down what is causing it to fail, then your customers will all have to endure the SMTP delay (which many won't like either).

The 'tail' command will list the last lines of the filename given. If you use 'tail -f filename' then it will continue to show the end of the file as lines are added by the program/services such as Qmail/SMTP.

If you are in this business for the long haul, you really need to read up on Linux OS basics and shell commands. It will help you quite a bit.
 
hi guys,

sorry took a while to get back here: been busy with other matters (aren't we all hehe)

anyway, i have added the -Rt0 again.. the full thing is now
service smtp
{
socket_type = stream
protocol = tcp
wait = no
disable = no
user = root
instances = UNLIMITED
server = /var/qmail/bin/tcp-env
server_args = -Rt0 /var/qmail/bin/relaylock /var/qmail/bin/qmail-smtpd /var/qmail/bin/smtp_auth /var/qmail/bin/true /var/qmail/bin/cmd5checkpw /var/qmail/bin/true
}

I'll update you guys again...
 
Ok guys, I did it twice 1st time...it didn't work straight away.. my mail queue build up almost immediately :(

Some details

qmHandle has been added with
my ($pidcmd) = "ps -e |grep 'qmail-send' |cut -d ' ' -f 1";

The moment i change, i check the queue by using qmHandle -s
Straight away my remote queue builds up

Thanks to jamesyeeoc, most arguements work for qmHandle (like deleteion etc)

Problem:
I wanted to list all the mail in remote queue with -R, I got...

readline() on closed filehandle MSG at /tmp/qmHandle line 234, <MSG> line 6 (#1)
(W closed) The filehandle you're reading from got itself closed sometime
before now. Check your control flow.

Use of uninitialized value in substr at /tmp/qmHandle line 235, <MSG> line 6 (#2)
(W uninitialized) An undefined value was used as if it were already
defined. It was interpreted as a "" or a 0, but maybe it was a mistake.
To suppress this warning assign a defined value to your variables.

To help you figure out what was undefined, perl tells you what operation
you used the undefined value in. Note, however, that perl optimizes your
program and the operation displayed in the warning may not necessarily
appear literally in your program. For example, "that $foo" is
usually optimized into "that " . $foo, and the warning will refer to
the concatenation (.) operator, even though there is no . in your
program.

readline() on closed filehandle MSG at /tmp/qmHandle line 244 (#1)
readline() on closed filehandle MSG at /tmp/qmHandle line 234, <MSG> line 19 (#1)
Use of uninitialized value in substr at /tmp/qmHandle line 235, <MSG> line 19 (#2)
readline() on closed filehandle MSG at /tmp/qmHandle line 234, <MSG> line 21 (#1)
Use of uninitialized value in substr at /tmp/qmHandle line 235, <MSG> line 21 (#2)
readline() on closed filehandle MSG at /tmp/qmHandle line 234, <MSG> line 12 (#1)
Use of uninitialized value in substr at /tmp/qmHandle line 235, <MSG> line 12 (#2)

Doesn't work? Then I used -S"failure" and after that -R works.
Weirdly....


Anyway, the mail queue is piling up fast...
so I removed the -Rt0 again.


I then tried a second time whereby I added one more space before "-Rt0", as follows: Additional space can't be shown as the forum truncates additional spaces
service smtp
{
socket_type = stream
protocol = tcp
wait = no
disable = no
user = root
instances = UNLIMITED
server = /var/qmail/bin/tcp-env
server_args = -Rt0 /var/qmail/bin/relaylock /var/qmail/bin/qmail-smtpd /var/qmail/bin/smtp_auth /var/qmail/bin/true /var/qmail/bin/cmd5checkpw /var/qmail/bin/true
}

This time round.. up till now more than an hour has pass so far still ok. some interesting things to note...

netstat -pan |grep 'spam' returns nothing

ps -ax |grep 'spam' returns only "2757 pts/2 S 0:00 grep spam
"

Any point for concern?

One thng abt -Rt0, after adding it, while there is always mail in the queue, seems to be always more in the remote queue.. but so far.. acceptable

on top of the above questions.. some more here...

1) Where does the mail with "failure notice" goes to? Considering I haven't added the cron yet.. cos I have set to bounce all mail with invalid recipient(s) in my PLESK control panel.. so if I remove, there won't be any bounce mail so to speak, right?

2) Why is it when it get stuck.. mostly are them (failure notices)? Where will they go after a while? will qmail be able to get rid of them automatically?

3) There was a point the qmHandle didn't work. I had to change the my_pid to 'f 2' to get the pid... weird...? it seems randomly there's a space at the front... :confused:

Especially so after i do a -S"failure notice".. then when i try to do a -a, it will tell me qmail is not running, then i know i have to do the above mentioned.... didn't know output position can be changed like that...

after i did another delete, i had to change back to f 1 again....

4) Any possible suggestion as to why my remote mail queue builds up more faster (and not get sent out) after i added the -Rt0? Right now some valid mails are stuck.. even after i delete the "failure notice", those mails never move...

How else can i try to push it out? I have already try qmHandle -a

5) all the failure notices are send out using MAILER-DAEMON@serverhostname, someare even send to "postmaster@serverhostname, which is not a valid domain.
In sendmail, I could edit sendmail.mc to solve the problem by change the hostname when it sends out, to something valid. Especailly so when some email servers out there are sensitive to this...

How do I do this for qmail?

For now will still monitor.. while still acceptable.. the rising concern is that since i added, the remote queue is getting higher slightly.. and some valid mails are still stuck there...

I'm afraid by tomorrow morning it will shoot up to tens of thousands...

so till then.. would appreciate the feedback.. thanks!

ps: I took more than 1hr to finish this post as I monitor and added stuff... so timing maybe off
 
Back
Top