You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rishad Ali <ri...@turnkey-instruments.com> on 2013/04/15 11:31:38 UTC

Tomcat web application stops automatically

I have a dedicated server running CentOS 5.9, Apache-Tomcat 5.5.36. I
have written a JAVA web applications which runs every minute to collect
the data from multiple sensors. I am using ScheduledExecutorService to
execute the threads. (one thread for each sensor every minute and there
can be more than hundred sensors) The flow of the thread is

1.    Collect sensor information from the database.

2.    Sends the command to the instrument to collect data.

3.    Update the database with the data values.

There is another application that checks the database every minute and
send the alerts to the users (if necessary). I have monitored the
application using jvisualVM, I cant find any memory leak. for every
thread. The applications work fine but after some time(24 Hour - 48
Hours) the applications stop working. I can't find out what the problem
could be, is it server configuration problem, too many threads or what?

This might not be a Tomcat server problem but this could be!!!! 

Does anyone have any idea what might be going wrong or is there anyone
who has done think kind of work? Please help, Thanks

public class Scheduler {

       private final ScheduledExecutorService scheduler = 

          Executors.newScheduledThreadPool(1);

       public void startProcess(int start) {

           final Runnable uploader = new Runnable() {

            @SuppressWarnings("rawtypes")

            public void run() 

            { 

                //Select data from the database

                ArrayList dataList = getData();

                for(int i=0;i<dataList.size();i++)

                {

                    String args = dataList.get(i).toString();

                    ExecutorThread comThread = new
ExecutorThread(args...);

                    comThread.start();

                }

            }

        };

        scheduler.scheduleAtFixedRate(uploader, 0, 60 ,
TimeUnit.SECONDS);

       }

    }

 

public class ExecutorThread extends Thread {

 

    private variables...

    public CommunicationThread(args..)

    {

        //Initialise private variable

    }

 

    public void run()

    {

        //Collect data from sensor

        //Update Database

   }

}

 

 



RE: Tomcat web application stops automatically

Posted by Rishad Ali <ri...@turnkey-instruments.com>.
These application are running inside tomcat because I was under the impression that Tomcat is an application server and I need tomcat to run Java dynamic web applications.


-----Original Message-----
From: André Warnier [mailto:aw@ice-sa.com] 
Sent: 15 April 2013 11:14
To: Tomcat Users List
Subject: Re: Tomcat web application stops automatically

Rishad Ali wrote:
> I have a dedicated server running CentOS 5.9, Apache-Tomcat 5.5.36. I 
> have written a JAVA web applications which runs every minute to 
> collect the data from multiple sensors. I am using 
> ScheduledExecutorService to execute the threads. (one thread for each 
> sensor every minute and there can be more than hundred sensors) The 
> flow of the thread is
> 
> 1.    Collect sensor information from the database.
> 
> 2.    Sends the command to the instrument to collect data.
> 
> 3.    Update the database with the data values.
> 
> There is another application that checks the database every minute and 
> send the alerts to the users (if necessary). I have monitored the 
> application using jvisualVM, I cant find any memory leak. for every 
> thread. The applications work fine but after some time(24 Hour - 48
> Hours) the applications stop working. I can't find out what the 
> problem could be, is it server configuration problem, too many threads or what?
> 
> This might not be a Tomcat server problem but this could be!!!! 
> 
> Does anyone have any idea what might be going wrong or is there anyone 
> who has done think kind of work? Please help, Thanks
> 
[.. snip .. ]
This may be a naive question, but from your description above it is not clear if any of these applications have anything to do with Tomcat, or with a webserver environment.
Why would it/they be running "inside" Tomcat ?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat web application stops automatically

Posted by André Warnier <aw...@ice-sa.com>.
Rishad Ali wrote:
> I have a dedicated server running CentOS 5.9, Apache-Tomcat 5.5.36. I
> have written a JAVA web applications which runs every minute to collect
> the data from multiple sensors. I am using ScheduledExecutorService to
> execute the threads. (one thread for each sensor every minute and there
> can be more than hundred sensors) The flow of the thread is
> 
> 1.    Collect sensor information from the database.
> 
> 2.    Sends the command to the instrument to collect data.
> 
> 3.    Update the database with the data values.
> 
> There is another application that checks the database every minute and
> send the alerts to the users (if necessary). I have monitored the
> application using jvisualVM, I cant find any memory leak. for every
> thread. The applications work fine but after some time(24 Hour - 48
> Hours) the applications stop working. I can't find out what the problem
> could be, is it server configuration problem, too many threads or what?
> 
> This might not be a Tomcat server problem but this could be!!!! 
> 
> Does anyone have any idea what might be going wrong or is there anyone
> who has done think kind of work? Please help, Thanks
> 
[.. snip .. ]
This may be a naive question, but from your description above it is not clear if any of 
these applications have anything to do with Tomcat, or with a webserver environment.
Why would it/they be running "inside" Tomcat ?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat web application stops automatically

Posted by Ralph Plawetzki <ra...@purejava.org>.
Am 15.04.2013 14:22, schrieb Rishad Ali:
> I think I mentioned this in the question that I am using
> ScheduledExecutorService to start threads every minute. This is not the
> application running every minute, these are the threads I create. 
> And as I said It works fine for some time then it stops. 
> 
> Yes I checked the log but there is no sign of stopping application or
> nothing about Too many database connections.
Please don't top-post.

When your application(s) stopped: take a thread dump and post it here.

Ralph


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Tomcat web application stops automatically

Posted by Rishad Ali <ri...@turnkey-instruments.com>.
I think I mentioned this in the question that I am using
ScheduledExecutorService to start threads every minute. This is not the
application running every minute, these are the threads I create. 
And as I said It works fine for some time then it stops. 

Yes I checked the log but there is no sign of stopping application or
nothing about Too many database connections.





-----Original Message-----
From: Ralph Plawetzki [mailto:ralph@purejava.org] 
Sent: 15 April 2013 13:11
To: Tomcat Users List
Subject: Re: Tomcat web application stops automatically

Am 15.04.2013 11:31, schrieb Rishad Ali:
> I have a dedicated server running CentOS 5.9, Apache-Tomcat 5.5.36. I 
> have written a JAVA web applications which runs every minute to 
> collect the data from multiple sensors. I am using 
> ScheduledExecutorService to execute the threads. (one thread for each 
> sensor every minute and there can be more than hundred sensors) The 
> flow of the thread is
> 
A web application can be deployed to tomcat and when it is deployed it
can be running or not. It can't run every minute.

<snip/>

> thread. The applications work fine but after some time(24 Hour - 48
> Hours) the applications stop working. I can't find out what the 
> problem
What does that mean? Did you take a look at the tomcat logfiles?

Ralph

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat web application stops automatically

Posted by Ralph Plawetzki <ra...@purejava.org>.
Am 15.04.2013 11:31, schrieb Rishad Ali:
> I have a dedicated server running CentOS 5.9, Apache-Tomcat 5.5.36. I
> have written a JAVA web applications which runs every minute to collect
> the data from multiple sensors. I am using ScheduledExecutorService to
> execute the threads. (one thread for each sensor every minute and there
> can be more than hundred sensors) The flow of the thread is
> 
A web application can be deployed to tomcat and when it is deployed it
can be running or not. It can't run every minute.

<snip/>

> thread. The applications work fine but after some time(24 Hour - 48
> Hours) the applications stop working. I can't find out what the problem
What does that mean? Did you take a look at the tomcat logfiles?

Ralph

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org