tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ameer Mawia <ameer.ma...@gmail.com>
Subject Re: Problem when rebooting....
Date Mon, 10 Nov 2014 04:42:36 GMT
Hi Bjorn,

I'm looking into the issue(I had been longing to contribute to community
and I see some opportunity to start doing so here. Hope my effort will be
welcomed!:) )


I'm looking at the code base in trunk. Here is the method where
localhost-startstop thread is busy:


   protected void processAnnotationsFile(File file, WebXml fragment, //line
1963
            boolean handlesTypesOnly) {

        if (file.isDirectory()) {
            // Returns null if directory is not readable
            String[] dirs = file.list();//line 1968
            if (dirs != null) {
                for (String dir : dirs) {
                    processAnnotationsFile(    //line 1971
                            new File(file,dir), fragment, handlesTypesOnly);
                }
            }
        } else if (file.canRead() && file.getName().endsWith(".class")) {
            try (FileInputStream fis = new FileInputStream(file)) {
                processAnnotationsStream(fis, fragment, handlesTypesOnly);
            } catch (IOException e) {
                log.error(sm.getString("contextConfig.inputStreamFile",
                        file.getAbsolutePath()),e);
            } catch (ClassFormatException e) {
                log.error(sm.getString("contextConfig.inputStreamFile",
                        file.getAbsolutePath()),e);
            }
        }
    }

As you can see and as konstantin said, the thread is busy walking over
directories listed in web-fragements. Here it is from where it is being
called:

 protected void processAnnotations(Set<WebXml> fragments,
            boolean handlesTypesOnly) {
        for(WebXml fragment : fragments) {
            // Only need to scan for @HandlesTypes matches if any of the
            // following are true:
            // - it has already been determined only @HandlesTypes is
required
            //   (e.g. main web.xml has metadata-complete="true"
            // - this fragment is for a container JAR (Servlet 3.1 section
8.1)
            // - this fragment has metadata-complete="true"
            boolean htOnly = handlesTypesOnly || !fragment.getWebappJar() ||
                    fragment.isMetadataComplete();

            WebXml annotations = new WebXml();
            // no impact on distributable
            annotations.setDistributable(true);
            URL url = fragment.getURL();
            processAnnotationsUrl(url, annotations, htOnly);// This in turn
calls processAnnotationsFile
            Set<WebXml> set = new HashSet<>();
            set.add(annotations);
            // Merge annotations into fragment - fragment takes priority
            fragment.merge(set);
        }
    }

I'will let you know, as soon as I come to some concrete understanding.
Meanwhile you can take a look at various web-fragments in your
web-application.

Regards,
Ameer Mawia,
New Delhi

On Mon, Nov 10, 2014 at 4:55 AM, Bjørn T Johansen <btj@havleik.no> wrote:

> On Sun, 09 Nov 2014 23:49:54 +0100
> André Warnier <aw@ice-sa.com> wrote:
>
> > Bjørn T Johansen wrote:
> > > On Mon, 10 Nov 2014 00:35:46 +0300
> > > Konstantin Kolinko <knst.kolinko@gmail.com> wrote:
> > >
> > >> Rules:
> > >> http://tomcat.apache.org/lists.html#tomcat-users
> > >> -> 6. Do not top-post.
> > >>
> > >>> Ok, did a thread dump that resulted in the following dump..:
> > >>>
> > >>>
> > >>> Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.25-b02 mixed
> mode):
> > >>>
> > >>> "localhost-startStop-1" #15 daemon prio=5 os_prio=0
> tid=0x00007fdc84002000 nid=0x702 runnable [0x00007fdc8ebe7000]
> > >>>    java.lang.Thread.State: RUNNABLE
> > >>>         at java.io.UnixFileSystem.checkAccess(Native Method)
> > >>>         at java.io.File.canRead(File.java:768)
> > >>>         at
> org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1975)
> > >>>         at
> org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1971)
> > >>
> > >> As it is visible from the method name, the "start" thread is busy
> > >> scanning classes for annotations.
> > >>
> > >> This behaviour is explained here:
> > >>
> > >>>> https://wiki.apache.org/tomcat/HowTo/FasterStartUp#General
> > >
> > > But it never finishes? And also I do not have this problem when
> stopping and starting the Tomcat server without booting, why is that?
> Shouldn't the
> > > result be the same?
> > >
> >
> > http://en.wikipedia.org/wiki/Entropy_%28computing%29
> > Maybe your problem is there ?
> > (When the system boots, it has little entropy available, and it may
> already be consumed by
> > other processes starting around the same time).
> >
>
> Hmm... Guess I'll havce to check it out... Thx... :)
>
> BTJ
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message