You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Stephan Wiesner <st...@stephan-wiesner.de> on 2003/04/22 09:15:59 UTC

Server not terminating

Hi list,
we discussed this last week, but didn't find a solution. Now I have some 
more information.

I run James 2.1.3a2 on Windows XP (java full version "1.4.1_01-b01") 
from run.bat and can normally end it by pressing ctrl+c. This works 
about 90% of the time, but sometimes I have to manually terminate the 
task. Afterwards I can restart it without problems.

I run the same James on Linux Suse 8, java full version "1.4.1-b21", 
again by running run.sh. I can terminate it manually by pressing ctrl.+c 
for some time, but after a few times it will not finish anymore. I can 
not connect by telnet to it anymore, so something is down.
When I manually kill the run.sh process, I can restart it. However some 
Java processes seem to be still running (not sure, as there are tons of 
Java processes from different applications and I am not sure which is 
from whom). When I restart James, some of my Mailets (MailToNews.java: 
The content of the mail can not be read anymore)  don't work anymore. 
After restarting the system it works again.

This is reproducible, had to reboot quite often today .-(

Any ideas?

Stephan



---------------------------------------------------------------------
To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-user-help@jakarta.apache.org


Re: Server not terminating

Posted by Serge Knystautas <se...@lokitech.com>.
Stephan Wiesner wrote:
> I just discovered some more.
> I wrote a Mailet that just called System.exit(1); but the resutl again 
> was that the server stopped, sometimes, not always.
> Then I retried to telnet to James and shutdown from there and that now 
> works. The difference is that I now did it locally, not via MS telnet 
> from my home machine. Not sure what that might mean?
> 
> I will remove all my custom Mailets and retry and if all works track 
> down the Mailet that is the bogeyman...

I've seen this on both Windows and Linux.  I attributed it to Phoenix 
using the shutdown hooks, and then that leads to some race condition. 
It was difficult to diagnose because as you said, it only happens maybe 
10% of the time.

-- 
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com


---------------------------------------------------------------------
To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-user-help@jakarta.apache.org


Re: Server not terminating

Posted by Stephan Wiesner <st...@stephan-wiesner.de>.
I removed all custom Mailets. ctrl+c seems to work, can't prove that, 
though, tried to shutdown several times and worked without flaw. Then I 
retried to shutdown bye using telnet from remote and it hung up again.
The ps command you suggested led to 64 before the shutdown and 70 
afterwards. After manually killing run.sh it returned 1.
Sometimes the server just shuts down, though.

I will let it rest at that, just don't have the time to spend on it. 
Local telnet works and that is fine with me.
Thanks for your time and effort and I will post if I stumble about 
something new.

Stephan


Noel J. Bergman wrote:

>>I wrote a Mailet that just called System.exit(1); but the resutl again
>>was that the server stopped, sometimes, not always.
>>    
>>
>
>No surprise.  If you use the telnet interface, shutdown results in:
>
>    private boolean doSHUTDOWN(String argument) {
>        writeLoggedFlushedResponse("Shutting down, bye bye");
>        System.exit(0);
>        return false;
>    }
>
>and you appear to be suggesting that not all threads are terminating.  One
>thing that might be useful would be to do this:
>
>    ps -auxwww | grep james | wc -l
>
>before and after trying to shutdown.  The thread count might be useful
>information.
>
>Are you spawning any threads in your custom code?
>
>	--- Noel
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: james-user-help@jakarta.apache.org
>
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-user-help@jakarta.apache.org


RE: Server not terminating

Posted by "Noel J. Bergman" <no...@devtech.com>.
> I wrote a Mailet that just called System.exit(1); but the resutl again
> was that the server stopped, sometimes, not always.

No surprise.  If you use the telnet interface, shutdown results in:

    private boolean doSHUTDOWN(String argument) {
        writeLoggedFlushedResponse("Shutting down, bye bye");
        System.exit(0);
        return false;
    }

and you appear to be suggesting that not all threads are terminating.  One
thing that might be useful would be to do this:

    ps -auxwww | grep james | wc -l

before and after trying to shutdown.  The thread count might be useful
information.

Are you spawning any threads in your custom code?

	--- Noel


---------------------------------------------------------------------
To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-user-help@jakarta.apache.org


Re: Server not terminating

Posted by Stephan Wiesner <st...@stephan-wiesner.de>.
I just discovered some more.
I wrote a Mailet that just called System.exit(1); but the resutl again 
was that the server stopped, sometimes, not always.
Then I retried to telnet to James and shutdown from there and that now 
works. The difference is that I now did it locally, not via MS telnet 
from my home machine. Not sure what that might mean?

I will remove all my custom Mailets and retry and if all works track 
down the Mailet that is the bogeyman...

Stephan

Noel J. Bergman wrote:

>>If I use telnet and issue a shutdown command, the
>>Telnet terminal hangs, James is half stopped and
>>I have to kill the process by hand
>>    
>>
>
>OK, that's not good.  I'm wondering if it has anything to do with a custom
>Mailet.  It would be handy to know what is happening in those threads that
>aren't shutting down.
>
>	--- Noel
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: james-user-help@jakarta.apache.org
>
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-user-help@jakarta.apache.org


RE: Server not terminating

Posted by "Noel J. Bergman" <no...@devtech.com>.
If James doesn't shutdown, try using netstat to see what is happening with
the smtp and pop3 ports.

	--- Noel


---------------------------------------------------------------------
To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-user-help@jakarta.apache.org


RE: Server not terminating

Posted by "Noel J. Bergman" <no...@devtech.com>.
If James doesn't shutdown, try using netstat to see what is happening with
the smtp and pop3 ports.

	--- Noel


---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


RE: Server not terminating

Posted by John Hornsby <Jo...@dsdata.co.uk>.
FYI.  I have also struggled to achieve clean shutdowns as have recently been
reported here despite various attempts to control phoenix from my
/etc/rc.d/init.d/james.

...lucky it stays up without problems ;-)

My config:

Red Hat Linux 6.1.1
James 2.1.2
File stores only; No DB
Sun JDK 1.4.1_02

John


> -----Original Message-----
> From: Danny Angus [mailto:danny@apache.org] 
> Sent: 25 April 2003 11:46
> To: James Users List
> Cc: James Developer List
> Subject: RE: Server not terminating
> 
> 
> I saw a similar probelm a while ago, james wouldn't shutdown 
> if a connection was open.
> That time an upgrade of avalon things was needed to fix it, I 
> hope it isn't this recurring.
> 
> d.
> 
> > -----Original Message-----
> > From: Josip Almasi [mailto:joe@vrspace.org]
> > Sent: 25 April 2003 11:29
> > To: James Users List
> > Subject: Re: Server not terminating
> > 
> > 
> > Noel J. Bergman wrote:
> > >>If I use telnet and issue a shutdown command, the
> > >>Telnet terminal hangs, James is half stopped and
> > >>I have to kill the process by hand
> > > 
> > > OK, that's not good.  I'm wondering if it has anything to do 
> > with a custom
> > > Mailet.  It would be handy to know what is happening in those 
> > threads that
> > > aren't shutting down.
> > 
> > I'm rather sure it has nothing to do with mailets.
> > Here's what I noticed:
> > 
> > root@vrspace:~> ps -ax|grep java|wc -l
> >      119
> > root@vrspace:~> killall java
> > root@vrspace:~> ps -ax|grep java|wc -l
> >      236
> > 
> > It's a bunch of software in the same jvm, but all shutdown 
> hooks end, 
> > except that james remains listening on ports till kill -9.
> > However, I was not able to reproduce this, and it hanged 
> only on suse 
> > 8.0, only a few times.
> > I had problems with other server software on the same 
> distro, but with 
> > smp kernel only: some connections remained in FIN_WAIT2 forever.
> > So my suggestion to Stephan: next time it happens, see netstat -a.
> > My bet is that it's OS specific, but does James wait for 
> connections to 
> > close in shutdown hook or something alike? Maybe even 
> Socket.close() 
> > would block.
> > 
> > Regards...
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: james-user-help@jakarta.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


RE: Server not terminating

Posted by John Hornsby <Jo...@dsdata.co.uk>.
FYI.  I have also struggled to achieve clean shutdowns as have recently been
reported here despite various attempts to control phoenix from my
/etc/rc.d/init.d/james.

...lucky it stays up without problems ;-)

My config:

Red Hat Linux 6.1.1
James 2.1.2
File stores only; No DB
Sun JDK 1.4.1_02

John


> -----Original Message-----
> From: Danny Angus [mailto:danny@apache.org] 
> Sent: 25 April 2003 11:46
> To: James Users List
> Cc: James Developer List
> Subject: RE: Server not terminating
> 
> 
> I saw a similar probelm a while ago, james wouldn't shutdown 
> if a connection was open.
> That time an upgrade of avalon things was needed to fix it, I 
> hope it isn't this recurring.
> 
> d.
> 
> > -----Original Message-----
> > From: Josip Almasi [mailto:joe@vrspace.org]
> > Sent: 25 April 2003 11:29
> > To: James Users List
> > Subject: Re: Server not terminating
> > 
> > 
> > Noel J. Bergman wrote:
> > >>If I use telnet and issue a shutdown command, the
> > >>Telnet terminal hangs, James is half stopped and
> > >>I have to kill the process by hand
> > > 
> > > OK, that's not good.  I'm wondering if it has anything to do 
> > with a custom
> > > Mailet.  It would be handy to know what is happening in those 
> > threads that
> > > aren't shutting down.
> > 
> > I'm rather sure it has nothing to do with mailets.
> > Here's what I noticed:
> > 
> > root@vrspace:~> ps -ax|grep java|wc -l
> >      119
> > root@vrspace:~> killall java
> > root@vrspace:~> ps -ax|grep java|wc -l
> >      236
> > 
> > It's a bunch of software in the same jvm, but all shutdown 
> hooks end, 
> > except that james remains listening on ports till kill -9.
> > However, I was not able to reproduce this, and it hanged 
> only on suse 
> > 8.0, only a few times.
> > I had problems with other server software on the same 
> distro, but with 
> > smp kernel only: some connections remained in FIN_WAIT2 forever.
> > So my suggestion to Stephan: next time it happens, see netstat -a.
> > My bet is that it's OS specific, but does James wait for 
> connections to 
> > close in shutdown hook or something alike? Maybe even 
> Socket.close() 
> > would block.
> > 
> > Regards...
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: james-user-help@jakarta.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-user-help@jakarta.apache.org


RE: Server not terminating

Posted by Danny Angus <da...@apache.org>.
I saw a similar probelm a while ago, james wouldn't shutdown if a connection was open.
That time an upgrade of avalon things was needed to fix it, I hope it isn't this recurring.

d.

> -----Original Message-----
> From: Josip Almasi [mailto:joe@vrspace.org]
> Sent: 25 April 2003 11:29
> To: James Users List
> Subject: Re: Server not terminating
> 
> 
> Noel J. Bergman wrote:
> >>If I use telnet and issue a shutdown command, the
> >>Telnet terminal hangs, James is half stopped and
> >>I have to kill the process by hand
> > 
> > OK, that's not good.  I'm wondering if it has anything to do 
> with a custom
> > Mailet.  It would be handy to know what is happening in those 
> threads that
> > aren't shutting down.
> 
> I'm rather sure it has nothing to do with mailets.
> Here's what I noticed:
> 
> root@vrspace:~> ps -ax|grep java|wc -l
>      119
> root@vrspace:~> killall java
> root@vrspace:~> ps -ax|grep java|wc -l
>      236
> 
> It's a bunch of software in the same jvm, but all shutdown hooks end, 
> except that james remains listening on ports till kill -9.
> However, I was not able to reproduce this, and it hanged only on suse 
> 8.0, only a few times.
> I had problems with other server software on the same distro, but with 
> smp kernel only: some connections remained in FIN_WAIT2 forever.
> So my suggestion to Stephan: next time it happens, see netstat -a.
> My bet is that it's OS specific, but does James wait for connections to 
> close in shutdown hook or something alike? Maybe even Socket.close() 
> would block.
> 
> Regards...
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-user-help@jakarta.apache.org


RE: Server not terminating

Posted by Danny Angus <da...@apache.org>.
I saw a similar probelm a while ago, james wouldn't shutdown if a connection was open.
That time an upgrade of avalon things was needed to fix it, I hope it isn't this recurring.

d.

> -----Original Message-----
> From: Josip Almasi [mailto:joe@vrspace.org]
> Sent: 25 April 2003 11:29
> To: James Users List
> Subject: Re: Server not terminating
> 
> 
> Noel J. Bergman wrote:
> >>If I use telnet and issue a shutdown command, the
> >>Telnet terminal hangs, James is half stopped and
> >>I have to kill the process by hand
> > 
> > OK, that's not good.  I'm wondering if it has anything to do 
> with a custom
> > Mailet.  It would be handy to know what is happening in those 
> threads that
> > aren't shutting down.
> 
> I'm rather sure it has nothing to do with mailets.
> Here's what I noticed:
> 
> root@vrspace:~> ps -ax|grep java|wc -l
>      119
> root@vrspace:~> killall java
> root@vrspace:~> ps -ax|grep java|wc -l
>      236
> 
> It's a bunch of software in the same jvm, but all shutdown hooks end, 
> except that james remains listening on ports till kill -9.
> However, I was not able to reproduce this, and it hanged only on suse 
> 8.0, only a few times.
> I had problems with other server software on the same distro, but with 
> smp kernel only: some connections remained in FIN_WAIT2 forever.
> So my suggestion to Stephan: next time it happens, see netstat -a.
> My bet is that it's OS specific, but does James wait for connections to 
> close in shutdown hook or something alike? Maybe even Socket.close() 
> would block.
> 
> Regards...
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


Re: Server not terminating

Posted by Josip Almasi <jo...@vrspace.org>.
Noel J. Bergman wrote:
>>If I use telnet and issue a shutdown command, the
>>Telnet terminal hangs, James is half stopped and
>>I have to kill the process by hand
> 
> OK, that's not good.  I'm wondering if it has anything to do with a custom
> Mailet.  It would be handy to know what is happening in those threads that
> aren't shutting down.

I'm rather sure it has nothing to do with mailets.
Here's what I noticed:

root@vrspace:~> ps -ax|grep java|wc -l
     119
root@vrspace:~> killall java
root@vrspace:~> ps -ax|grep java|wc -l
     236

It's a bunch of software in the same jvm, but all shutdown hooks end, 
except that james remains listening on ports till kill -9.
However, I was not able to reproduce this, and it hanged only on suse 
8.0, only a few times.
I had problems with other server software on the same distro, but with 
smp kernel only: some connections remained in FIN_WAIT2 forever.
So my suggestion to Stephan: next time it happens, see netstat -a.
My bet is that it's OS specific, but does James wait for connections to 
close in shutdown hook or something alike? Maybe even Socket.close() 
would block.

Regards...


---------------------------------------------------------------------
To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-user-help@jakarta.apache.org


RE: Server not terminating

Posted by "Noel J. Bergman" <no...@devtech.com>.
> If I use telnet and issue a shutdown command, the
> Telnet terminal hangs, James is half stopped and
> I have to kill the process by hand

OK, that's not good.  I'm wondering if it has anything to do with a custom
Mailet.  It would be handy to know what is happening in those threads that
aren't shutting down.

	--- Noel


---------------------------------------------------------------------
To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-user-help@jakarta.apache.org


Re: Server not terminating

Posted by Stephan Wiesner <st...@stephan-wiesner.de>.

Noel J. Bergman wrote:

>FWIW, this isn't a James issue.  If anything, it might be a Phoenix issue.
>Personally, I view Ctrl-C as a somewhat "rude" way to terminate a process.
>  
>
I agree completely. If I use telnet and issue a shutdown command, the 
Telnet terminal hangs, James is half stopped and I have to kill the 
process by hand, so I stopped bothering.

>Under linux, the supported mechanism provided by Phoenix is to use
>"bin/phoenix.sh stop", which I believe I mentioned the last time.  
>
You did and I answered that this made matters worse. Actually currently 
nothing happens at all except that I get the message that Phoenix is 
shutting down.

>FWIW,
>under linux you can do "ps -auxwww | grep james" to find the threads
>associated with james.
>  
>
Thanks, that helped.


If I am the only one who has those problem it will be something on my 
system, I guess. As a mail server is supposed to have a long uptime I 
suppose I will just live with it.

Stephan



---------------------------------------------------------------------
To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-user-help@jakarta.apache.org


RE: Server not terminating

Posted by "Noel J. Bergman" <no...@devtech.com>.
FWIW, this isn't a James issue.  If anything, it might be a Phoenix issue.
Personally, I view Ctrl-C as a somewhat "rude" way to terminate a process.

Under linux, the supported mechanism provided by Phoenix is to use
"bin/phoenix.sh stop", which I believe I mentioned the last time.  FWIW,
under linux you can do "ps -auxwww | grep james" to find the threads
associated with james.

For Windows, you might try adapting Andrew Oliver's approach:
http://archives.apache.org/eyebrowse/ReadMsg?listId=21&msgNo=2728.

One possibility you have some native code blocked on an resource (e.g., I/O)
that hasn't timed out yet.

	--- Noel

-----Original Message-----
From: Stephan Wiesner [mailto:stephan@stephan-wiesner.de]
Sent: Tuesday, April 22, 2003 3:16
To: James Users List
Subject: Server not terminating


Hi list,
we discussed this last week, but didn't find a solution. Now I have some
more information.

I run James 2.1.3a2 on Windows XP (java full version "1.4.1_01-b01")
from run.bat and can normally end it by pressing ctrl+c. This works
about 90% of the time, but sometimes I have to manually terminate the
task. Afterwards I can restart it without problems.

I run the same James on Linux Suse 8, java full version "1.4.1-b21",
again by running run.sh. I can terminate it manually by pressing ctrl.+c
for some time, but after a few times it will not finish anymore. I can
not connect by telnet to it anymore, so something is down.
When I manually kill the run.sh process, I can restart it. However some
Java processes seem to be still running (not sure, as there are tons of
Java processes from different applications and I am not sure which is
from whom). When I restart James, some of my Mailets (MailToNews.java:
The content of the mail can not be read anymore) don't work anymore.
After restarting the system it works again.

This is reproducible, had to reboot quite often today .-(

Any ideas?

Stephan


---------------------------------------------------------------------
To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-user-help@jakarta.apache.org