> -----Original Message-----
> From: Konstantin Preißer [mailto:kpreis...@apache.org]
> Sent: Thursday, October 17, 2013 1:18 PM
> To: 'Tomcat Developers List'
> Subject: RE: svn commit: r1533035 -
> /tomcat/tc7.0.x/trunk/webapps/examples/WEB-
> INF/classes/websocket/drawboard/Room.java
> 
> Hi Mark,
> 
> > -----Original Message-----
> > From: Mark Thomas [mailto:ma...@apache.org]
> > Sent: Thursday, October 17, 2013 1:10 PM
> > To: Tomcat Developers List
> > Subject: Re: svn commit: r1533035 -
> > /tomcat/tc7.0.x/trunk/webapps/examples/WEB-
> > INF/classes/websocket/drawboard/Room.java
> >
> > On 17/10/2013 11:53, Mark Thomas wrote:
> > > On 17/10/2013 11:50, Konstantin Preißer wrote:
> > >> Hi Mark,
> > >>
> > >>> -----Original Message-----
> > >>> From: Mark Thomas [mailto:ma...@apache.org]
> > >>> Sent: Thursday, October 17, 2013 12:49 PM
> > >>> To: Tomcat Developers List
> > >>> Subject: Re: svn commit: r1533035 -
> > >>> /tomcat/tc7.0.x/trunk/webapps/examples/WEB-
> > >>> INF/classes/websocket/drawboard/Room.java
> > >>>
> > >>> On 17/10/2013 11:39, Konstantin Kolinko wrote:
> > >>>> 2013/10/17  <ma...@apache.org>:
> > >>>>> Author: markt
> > >>>>> Date: Thu Oct 17 10:32:21 2013
> > >>>>> New Revision: 1533035
> > >>>>>
> > >>>>> URL: http://svn.apache.org/r1533035
> > >>>>> Log:
> > >>>>> Avoid hangs on shutdown
> > >>>>>
> > >>>>> Modified:
> > >>>>>     tomcat/tc7.0.x/trunk/webapps/examples/WEB-
> > >>> INF/classes/websocket/drawboard/Room.java
> > >>>>>
> > >>>>
> > >>>> I expect this to
> > >>>> a) fail when running with a security manager
> > >>>> b) cause a memory leak when examples app is reloaded, as you will
> get
> > >>>> a new instance of ShutdownDetection class in webapp's classloader
> > and
> > >>>> new instance of shutdown hook.
> > >>>
> > >>> I'm open to better suggestions. Another option I considered was just
> > >>> removing the call to roomGraphics.dispose(); and letting GC take care
> of
> > >>> things.
> > >>>
> > >>> Alternatively, we could provide some form of global flag.
> > >>>
> > >>> I think I prefer the global flag that indicates that a shutdown is in
> > >>> process. I can think of several other places where such a flag would
> > >>> have been useful and we can expose it through a custom servlet
> context
> > >>> attribute such as
> > "org.apache.tomcat.JVM_SHUTDOWN_IN_PROGRESS".
> > >>>
> > >>> I'll start looking at the global flag option. Meanwhile, any suggestions
> > >>> on how to improve the fix or an alternative fix welcome.
> > >>
> > >> Can you give me some insight of why Grahpics2D.dispose() may cause a
> > hang on shutdown? I have never seen .dispose() causing a hang, at least
> not
> > on Windows.
> > >> If it hangs, might this be a result of different threads using the 
> > >> Grahpics
> > object?
> > >
> > > Clean 7.0.x build
> > > catalina.bat start
> > > CTRL-C in the Tomcat Window
> > >
> > > The result is an exception written to stderr (I assume err rather than
> > > out) and Tomcat fails to stop. The exception is triggered by AWT trying
> > > to register a shutdown hook after the shutdown process has started.
> >
> > Ah. More info. It only occurs with Java 6.
> >
> > We could just classify this as a JVM bug and more on. That said, I think
> > some changes to the init code could probably avoid this in Java 6 as
> > well. I'll take a quick look.
> 
> OK, thanks.
> However, I can reproduce the hang now with Tomcat 7 on Java 7. Although I
> do not get a exception, I get a short hang and a warning: "The executor
> associated with thread pool [http-bio-8080] has not fully shutdown. Some
> application threads may still be running." After that, Tomcat closed.
> I do not get this with Tomcat 8.
> 
> My reaction also would have been to just remove the dispose() in the
> Tomcat 7 example since it is unlikely that the examples application is
> reloaded many times on a Tomcat run and creates too much Graphics2D
> objects that the GC does not dispose. But of course, I have nothing against a
> better solution if you find one. :)

OK, that was not the full story:

I can reproduce the short hang (and the warning) on Tomcat 8 with BIO 
connector, but not with NIO or APR...


Regards,
Konstantin Preißer


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to