|Subject:||Strange SMTP Server Behaviour|
|Posted by:||Pierre Roux (pier…@infofx.co.za)|
|Date:||Wed, 26 May 2004|
I'm writing a mail server using the TIdPOP3Server and TIdSMTPServer
When sending a small message, everything is fine, however when sending
larger messages (approx 1MB or bigger) things starts to go funny. Outlook
just sits there for about a minute, and then the message goes through,
unless a Gracefull disconnect occurs. All the events are triggered, and
according to my log mere (milli)seconds apart, but it takes ages for the
message to leave Outlook.
Downloading the same message via POP3 takes milliseconds.
- I've included Sleep(X) statements throughout, thinking it's the old
- When I step through the code and the whole SMTP process has finished
except for the disconnection of the socket, the message still shows in my
'Outbox'. The disconnect is triggered long before the message disappears
from my Outbox (after about a minute or so, message size depending). At
this stage, I sometimes get a Gracefull Disconnect, and the OnDisconnect
does not trigger - which should allways trigger if I understand Remy
correctly. This is extremely hard to replicate, as you have to send a
message and wait, and it might not occur. However, if it does occur, the
error happens long after the last event in the proccess, and the only event
not showing up in the Event Log is the disconnection.
Does Indy maintain the state of the TIdSMTPServerThread.SMTPState value?
- I'm not touching it, as everything works the way it should on smaller
I have no idea where to look anymore - any ideas?
What event's code would you like to see?
I've spent until early this morning on this, and nothing I tried worked out.
I'm thinking it might be something environmental/external that plays a role.
Small messages, say 2K or so, takes less than 1 second to process.
I've tried eliminating as many possible environmental problems as possible:
- I have Norton Anti-Virus 2003 on my machine, but E-Mail scanning is
disabled totally, as I was thinking it may play a role in the problem.
- Running Indy 9.0.14, Development Snapshot, Delphi 7 on XP Pro
- Checked directory search paths as I had Indy 10 on my machine and had an
issue with compiling with some of the wrong files before, but that's all
fine and fixed now.
- Everything runs on the same PC - IP Address & Port is 127.0.0.1:25
At the stage when '[2004/05/26 12:53:26 AM] Message Accepted to User
Account' is logged into the log file, the message is still in my Outbox, as
well as where it should be in my mail server.
Log for 7MB file
- actually only disappeared from mailbox after about three minutes
- Same message took about three/four seconds to download
- Looking at the log from start to finish is 13 seconds, yet it was still
stuck in the outbox long after that!
[2004/05/26 12:49:37 AM] SMTP Incoming Connection from ireland:3789
[2004/05/26 12:49:38 AM] SMTP MAIL FROM …@x.co.za
[2004/05/26 12:49:38 AM] SMTP RCPT TO …@x.co.za
[2004/05/26 12:49:47 AM] SMTP Message Accepted to User Account
[2004/05/26 12:49:50 AM] SMTP Disconnected
[2004/05/26 12:49:50 AM] SMTP Closing Object
With Gracefull Disconnect:
[2004/05/26 12:39:37 AM] SMTP Incoming Connection from ireland:3792
[2004/05/26 12:39:38 AM] SMTP MAIL FROM …@x.co.za
[2004/05/26 12:39:38 AM] SMTP RCPT TO …@x.co.za
[2004/05/26 12:39:47 AM] SMTP Message Accepted to User Account
[2004/05/26 12:41:23 AM] SMTP Error: Connection Closed Gracefully.