Why am I seeing a large build up of files under the ‘tmp’ directory?
Occasionally, my Softalk Mail Server crashes. Upon closer inspection, this appears to be due to the tmp folder increasingly growing with either .msg or .eml files.
What are the possible causes for this?
There are a number of reasons why you might see a build up of files under Softalk Mail Serverâ€™s â€œtmpâ€ directory.
The first thing to rule out is the involvement from third party applications; disk fragmentation software and third party Anti Virus being the most popular to cause, ironically, an adverse effect. Bad disk fragmentation can hugely effect how a mail server performs due to the often colossal number of read and writes executed relentlessly by a typical mail server, particularly heavily file based variants like Softalk Mail Server. Therefore, whilst it is absolutely advisable to run fragmentation checks on your disk, these should be run during quiet times as oppose to the busiest time of the day or lengthy, prolonged periods.
Secondly, please check that any third party Anti Virus application you may installed on the server is not scanning the Softalk file structure. If the third party application interferes with Softalk Mail Serverâ€™s file system, this could easily explain why files would be left hanging around. Ideally, you would have a complete e-mail based Anti Virus solution to scan for viruses on their way in your system typically by scanning SMTP, POP and IMAP without needing to go near these temporary files. There are many providers that offer e-mail based Anti Virus protection but these can often come at a premium to that of simple file on demand scanners.
Thirdly, but still equally relevant, involves e-mail messages as they enter your mail server. I will attempt to explain this in greater depth although prior knowledge and understanding of the Simple Mail Transfer Protocol (SMTP), which is typically how mail will enter your Softalk Mail Server unless you are POPâ€™ing from an ISP, is clearly beneficial.
Once the sending client and server exchange the appropriate SMTP commands to reach the DATA stage of the SMTP protocol, the client is at that point ready to transmit the actual message data to the server. We buffer this data into a temporary file (typically one per message) until the sending client informs the server that the data transfer is complete. It does this by sending a specific sequence of characters to the server to tell it there is no more data to send. At that point the data buffered into the temp file is then ready to complete the final stage of its journey to ultimately end up as an e-mail message. This means the temporary file will be automatically removed and cleared up.
However, there is a distinct difference in this behaviour when a less than perfect SMTP transmission occurs. If, during the DATA stage, the transmission is broken between the client and the server, the temporary file will remain. The end result is that this temporary file will be left hanging around, indefinitely due to the fact that the connection has been prematurely terminated. If you are seeing a lot of disconnections each day, you will see a lot of temporary files being left lying around.
Ultimately, correctly parsed SMTP communication between a client and a server will not result in these files being left around.
If this continues to cause you a problem, we advise considering writing a small script that periodically removes the content of the â€˜tmpâ€™ directory and therefore prevents this directory filling.
Please note that these observations have been raised internally and are on the development roadmap for improvement in the near future.