Constant error in MailQueue

Moderator: crythias

Post Reply
josecito22
Znuny newbie
Posts: 5
Joined: 27 Feb 2018, 21:35
Znuny Version: 6.0000

Constant error in MailQueue

Post by josecito22 »

Hi!

I could really use some help with the following,
I keep getting this error in System Log once every minute and OTRS mail does not go out:
OTRS-otrs.Console.pl-Maint::Email::MailQueue-77
There was an error executing Execute() in Kernel::System::Console::Command::Maint::Email::MailQueue: Error: Message sending already in progress! Skipping...

Also, in Communication Log I have a ton of messages stuck processing forever for the root account with the subject 'OTRS Scheduler Daemon Cron: MailQueueSend' .
I don't know what that means.

This is running OTRS6 on Ubuntu 16.04, mail subsystem seems to be working fine on the OS as I can send mails via terminal.
I've tried deleting the mail queue (Maint::Email::MailQueue --delete-all) and stopping/starting both Daemon.pl and Cron.sh, among a lot of other things I read on the forums to no avail.

Any ideas or guidance would be greatly appreciated,
Thank you!
josecito22
Znuny newbie
Posts: 5
Joined: 27 Feb 2018, 21:35
Znuny Version: 6.0000

Re: Constant error in MailQueue

Post by josecito22 »

Well, I think I may have solved it. The hard way.

I found out that the error message was coming from the MailQueue module, so I opened it and apparently it means that there's a process with that name already running. Since it always says it's running then I guess for some reason it is stuck.

So, I stopped Cron.sh and Daemon.pl
  • cd /opt/otrs/bin
    sudo -c "./Cron.sh stop" -s /bin/bash otrs
    sudo -c "./otrs.Daemon stop" -s /bin/bash otrs
Then I edited the module

Code: Select all

sudo nano /opt/otrs/Kernel/System/Console/Command/Maint/Email/MailQueue.pm
Searched for the string Message sending already in progress! Skipping and just before the "if (%PID)... "line preceding it I added the code to force delete the PID (Process ID).

Code: Select all

...
my %PID = $PIDObject->PIDGet(
            Name => 'MaintMailQueueSending',
        );
        ## This is new...
        my $ForceDeletePIDOnce = $PIDObject->PIDDelete(
                    Name => 'MaintMailQueueSending',
                  Force => 1,
        );
	# ... up to here
        if (%PID) {
            die "Message sending already in progress! Skipping...\n";
        }
       ...
        
Saved and ran it

Code: Select all

su -c "./otrs.Console.pl Maint::Email::MailQueue --send --verbose" -s /bin/bash otrs
It gave the error message anyway but the process was deleted.
Finally edited /opt/otrs/Kernel/System/Console/Command/Maint/Email/MailQueue.pm again and removed the lines I just added.
Saved, reboot.... and it seems to be working.

Still not sure if there's any side effects.
tupson
Znuny advanced
Posts: 133
Joined: 07 Oct 2015, 05:54
Znuny Version: 7.0.2
Real Name: Tony
Company: Upson Productions, LLC
Location: DC

Re: Constant error in MailQueue

Post by tupson »

I had this same issue happen to me and your solution resolved my issue. Wonder what is causing this?!
Tony :mrgreen:
OTRS version installed: v7.0.2 (.rpm)
OS: CENTOS7 (latest updates via -yum install)
OS: Ubuntu 20.04.3 (latest apt-get upgrades)
GURU: Microsoft & VMware Environments
KimmoJ
Znuny newbie
Posts: 47
Joined: 15 Sep 2011, 09:32
Znuny Version: 6.0.22
Real Name: Kimmo Jaskari
Company: Transmar Ab

Re: Constant error in MailQueue

Post by KimmoJ »

I had this happen today as well on OTRS 6; something around an OS update (normal apt-get patches, not a full version upgrade) and restart I think.

I decided to try a middle ground between just trying to send mail and actually editing the code and did a force send and that uncorked my system. Remains to be seen if that was an isolated incident or if it will occur again.

Ie, Maint::Email::MailQueue --send --force
Post Reply