Hi,
        The reason I raised this question was that we've had some memory
leak issues in this section of the code. I posted messages on the avalon
mailing list & they acknowledged it as a problem with this kind of usage.
Here's a brief description of the problem -
        The addTrigger call creates a job entry in the queue. The
resetTrigger call reschedules the job, invalidating the old entry & adding a
new one. There's a monitor thread which wakes up when the first entry in the
queue is ready to be scheduled & at that time removes the invalidated
entries. So if the connection timeout is say 5 mins.  and there is constant
SMTP activity, I estimate that this could lead to 15,000 or more invalid
timer entries in the queue.  (10 message per second * 5 SMTP commands per
message * 300 seconds), potentially raising an "out of memory" exception.
        A fix has been suggested on the avalon mailing list for this, but I
wanted see if we could use an alternate timeout mechanism in james. But if
this mechanism is required, we should fix the avalon problem.

Shilpa

-----Original Message-----
From: Noel J. Bergman [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 20, 2002 6:40 PM
To: James Developers List
Subject: RE: SMTPHandler connection timeout


> In SMTPHandler::handleConnection() method, why do we use the avalon
> scheduler & trigger mechanism to handle a connection timeout?
> Instead why don't we use the java.net.Socket.setSoTimeout(timeout) method,

Please consider the code:

  final PeriodicTimeTrigger trigger = new PeriodicTimeTrigger(
timeout, -1 );
  scheduler.addTrigger( this.toString(), trigger, this );
  while  (parseCommand(in.readLine()))
scheduler.resetTrigger(this.toString());
  socket.close();
  scheduler.removeTrigger(this.toString());

Note that the trigger protects more than just socket I/O.  It covers the
processing of the command (parseCommand does a lot more than just parse).

        --- Noel


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to