tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Bauer <peter.ba...@apus.co.at>
Subject Re: All threads are currently busy
Date Wed, 17 Oct 2007 15:24:36 GMT

Good afternoon Martin :-)

On Wednesday 18 October 2000 16:08:34 you wrote:
> Good Morning Peter
>
> I assume you have built glibc for debian following the specific build
> instructions for debian..following this example
> http://www.linux-m32r.org/eng/download.html#debpackage

I did not build the libc packages myself, currently
libc6 2.3.2.ds1-22
libc6-dev 2.3.2.ds1-22
are installed.

> This version of TC is quite old ..not sure if its supported anymore

Yes, i know about that. If there is a major bug in this version, i could argue to upgrade
(at least to the last 4.1.x version) but i would need some facts to be able to do so.

> Can we see the source for the removeActiveRole

here it is:

    public static synchronized void removeActiveRoles(final DatabaseAccess dba, final String
terminalid, final String sessionid, boolean isNam) {
        //check parameters
        if(terminalid == null || terminalid.length() == 0) {
            LOG.error("ActiveRoleRemoval.removeActiveRoles(): Could not remove active roles
of terminal, empty terminalid given.");
        }
        if(sessionid == null || sessionid.length() == 0) {
            LOG.error("ActiveRoleRemoval.removeActiveRoles(): Could not remove active roles
of terminal, empty sessionid given.");
        }
        
        //get active roles of failed terminal
        ThreeValStructure failedRoles = new ThreeValStructure();
        String sql = "SELECT name, functionname, role_type FROM tableactiveuserroles WHERE
" +
                     "terminalid = '" + terminalid + "' AND autologin <> 1";
        if (!dba.executeQuery(sql)) {
            /* database statement failed */
            LOG.error("ActiveRoleRemoval, removeActiveRoles(), sql statement failed " + sql);
            return;
        } 
        while (dba.checkNext()) {
            failedRoles.add(dba.getValue("name"), dba.getValue("functionname"), dba.getValue("role_type"));
        }

        //send faked logout message via HTTP POST to commDicora servlet for failed roles
        if(!ActiveRoleRemoval.sendLogoutMessages(failedRoles, sessionid)) {
            LOG.error("Sending logout messages for failed roles failed, continuing");
        }
        
        //activate failed roles on all terminals which have a role for which the failed role
is the backup role
        BackuproleActivator activator = new BackuproleActivator(dba);
        for (int index = 0; index < failedRoles.size(); index++) {   
            String nameFailedRole = failedRoles.getEl1(index);
            
            //get all relevant terminalids
            String sqlSelectTerminals = "SELECT terminalid FROM tableactiveuserroles WHERE
" +
                                        "terminalid <> '" + terminalid + 
                                        "' AND typeOfTerminal <> " + ApusConstants.DICORA_M
+ 
                                        "AND backuprolename = '" + nameFailedRole + "'";
            if (!dba.executeQuery(sqlSelectTerminals)) {
                LOG.error("ActiveRoleRemoval, removeActiveRoles(), sql statement failed "
+ sqlSelectTerminals);
                return;
            }
            LinkedList<String> backupTerminalsIds = new LinkedList<String>();
            while(dba.checkNext()) {
                backupTerminalsIds.add(dba.getValue("terminalid"));
            }
            if(backupTerminalsIds.size() == 0) {
                LOG.debug("ActiveRoleRemoval, removeActiveRoles(): " +
                             "No backup terminals for Role '" + nameFailedRole + "' found!");
            }
            
            for (Iterator iter = backupTerminalsIds.iterator(); iter.hasNext();) {
                String backupTerminalId = (String) iter.next();
                
                activator.sendActivationMessage(backupTerminalId,
                                                nameFailedRole,
                                                failedRoles.getEl3(index),
                                                failedRoles.getEl2(index),
                                                isNam);
            }
        }
    }

> specifically are there higher priority threads currently executing so
> perhaps yield to those threads may apply?
> http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Thread.html

There are no threads i am creating which have a non-default priority.

thanks,
Peter 

> HTH/
> Martin--
>
> ----- Original Message -----
> From: "Peter Bauer" <peter.bauer@apus.co.at>
> To: <users@tomcat.apache.org>
> Sent: Wednesday, October 17, 2007 4:52 AM
> Subject: All threads are currently busy
>
> > Hi all,
> >
> > System:
> > Tomcat 4.1.30 on Debian sarge
> > java version "1.5.0_11"
> > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
> > Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode, sharing)
> >
> > in situations with high load, tomcat sometimes stops responding and is
> > not
>
> able to recover from that status. In the catalina.out file, i get the
>
> following line:
> > SEVERE: All threads (75) are currently busy, waiting. Increase maxThreads
>
> (75) or check the servlet status
>
> > i searched some time in various forums and mailing list archives and
> > found
>
> the following links:
>
> http://mail-archives.apache.org/mod_mbox/tomcat-users/200408.mbox/%3c2004Au
>g 01.0922.scs.0012@eskimo.com%3e
>
> > http://marc.info/?l=tomcat-user&m=113297294417902&w=2
> > http://www.tek-tips.com/viewthread.cfm?qid=862552&page=3
> > http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg127833.html
> >
> > Basically there seem to be 2 possible reasons for this behaviour
> > 1. A bug (?) in Tomcat or the combination of JDK, glibc, whatever, which
>
> causes that tomcat does not
>
> > recover from situations with too much requests. I could not find any
>
> information in the release notes
>
> > of the Tomcat 4.1.x versions.
> > 2. Some kind of deadlock or resource (database connections) availability
>
> problem which
>
> >    keeps the request handling threads from returning from the doPost/Get
>
> method.
>
> > So i made a Threaddump using jstack (attached file). Most of the threads
>
> are in
>
> >  - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
> >  - java.lang.Object.wait() @bci=2, line=474 (Interpreted frame)
> >  - org.apache.catalina.core.StandardWrapper.allocate() @bci=223, line=704
>
> (Interpreted frame)
>
> > but 19 threads are blocked in the bci 0 of the same static synchronized
>
> method called removeActiveRoles
>
> > which is called from the doPost() method.
> >
> >  -
>
> at.sonorys.dmc.utilities.ActiveRoleRemoval.removeActiveRoles(at.sonorys.dmc
>. utilities.DatabaseAccess, java.lang.String, java.lang.String, boolean)
> @bci=0 (Interpreted frame)
>
> >  - at.sonorys.dmc.CommDicora.CommHandleMessageSession.quitSession()
>
> @bci=23 (Interpreted frame)
>
> >  -
> > at.sonorys.dmc.CommDicora.CommHandleMessageSession.doHandleSessionMsg()
>
> @bci=131 (Interpreted frame)
>
> >  - at.sonorys.dmc.CommDicora.CommHandleMessageSession.evalMessage()
> > @bci=1
>
> (Interpreted frame)
>
> >  -
>
> at.sonorys.dmc.CommDicora.CommDicoraServlet.doHandleMsg(javax.servlet.http.
>H ttpServletResponse, javax.servlet.http.HttpServletRequest) @bci=103
> (Interpreted frame)
>
> >  -
>
> at.sonorys.dmc.CommDicora.CommDicoraServlet.doPost(javax.servlet.http.HttpS
>e rvletRequest, javax.servlet.http.HttpServletResponse) @bci=142
> (Interpreted frame)
>
> > The servlet implements the SingleThreadModel (not my decision). As you
> > can
>
> see from the threaddump, all 19 threads are waiting to
>
> > get into the same static synchronized method. I dont understand this
>
> because there must be one thread IN the method
>
> > which holds the lock of the method? Is it possible for a thread to leave
> > a
>
> synchronized method without returning the
>
> > lock?
> >
> > br,
> > Peter





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


Mime
View raw message