The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Mailscanner Restarts leaves .wrk files

Discussion in 'E-mail Discussions' started by rhenderson, May 19, 2006.

  1. rhenderson

    rhenderson Well-Known Member

    Joined:
    Apr 21, 2005
    Messages:
    785
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Oklahoma
    cPanel Access Level:
    Root Administrator
    When Mailscanner Restarts it leaves .wrk files in the /tmp folder. In the MailScanner conf file it is set to restart every 4 hours (i.e. 14400 seconds) for memory leaks.

    Every so often a .wrk file is left in the /tmp folder. Evidently MailScanner was unarchiving a large file an it might leave a large enough file to fill up the tmp folder.

    Then MailScanner restarts and tries to scan the mail and gets caught in a loop because the /tmp folder is full. This causes the load to slowly increase as the loop runs, the longer it runs the bigger the load. Even if you have PRM or something to restart it, the loop just starts over.

    I would assume (evidently incorrectly) when MailScanner restarts it 'ought to check for and delete the presence of old .wrk files. So apart from writing a cron and running it every 15 minutes or so that cd /tmp;rm -rf *.wrk (because I am not sure what that will do the MailScanner if it kills a .wrk file that MailScanner is using) does anyone know of any other option?

    Thanks in advance.
     
  2. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    I doubt MailScanner would mind if a cron cleared out /tmp/*.wrk every so often.

    If MailScanner is doing something with a file, the file should be locked and so no other process would be able to do anything with the file until MailScanner is done.

    That said, it might be best to drop a line to the MailScanner discussion mailing list: http://lists.mailscanner.info/mailman/listinfo/mailscanner
     
  3. rhenderson

    rhenderson Well-Known Member

    Joined:
    Apr 21, 2005
    Messages:
    785
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Oklahoma
    cPanel Access Level:
    Root Administrator
    I was thinking that might be the case but was not positive. I have been running it over the last 6 hours or so with no problems. Thanks for the input.
     
  4. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    If you post your suggestion (MailScanner deleting /tmp/*.wrk when it starts up) to the MailScanner discussion list it may well get implemented.
     
  5. rhenderson

    rhenderson Well-Known Member

    Joined:
    Apr 21, 2005
    Messages:
    785
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Oklahoma
    cPanel Access Level:
    Root Administrator
    The cron did not work out as I expected it to. The load was up so I strace the pid for the mailscanner that had the high load and saw the "device was full error" repeating, patiently waited for a couple of minutes (for the cron to run) and saw the 500 megs worth of .wrk file's were killed (I thought hooray) but the strace continued to show the mailscanner in a loop until I restarted mailscanner. :( So I went to plan B and added the kill info into the /etc/rc.d/init.d/MailScanner script so it might work better because it kills the *.wrk files just before restarting mailscanner or just after a stop as well. So time will tell.....
     
  6. rhenderson

    rhenderson Well-Known Member

    Joined:
    Apr 21, 2005
    Messages:
    785
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Oklahoma
    cPanel Access Level:
    Root Administrator
    Well come to find out (In case someone else encounters this) MailScanner does make .wrk files and so does a improperly programmed php script. It was so random I just "assumed" it was MailScanner (Since I knew it made .wrk files). I am not sure why I did not think of it before, but I saw it occuring, killed MailScanner and it continued.... so then I tail'ed the file and it was easy to identify where it was coming from. It is the first runaway php script we've had like that. It filled the /tmp then httpd and MailScanner could not write to the /tmp folder so it basically shut us down.
     
Loading...

Share This Page