Re: CLOSE_WAIT between Application (Tomcat) and Apache HTTPD

2017-05-10 Thread Mark Thomas
On 10/05/17 17:32, Adhavan Mathiyalagan wrote:
> Team,
> 
> Tomcat version : 8.0.18

That is over two years old. Have you considered updating?

> Apache HTTPD version : 2.2
> 
> 
> There are lot of CLOSE_WAIT connections being created at the
> Application(tomcat)  ,when the traffic is routed through the Apache HTTPD
> load balancer to the Application running over tomcat container. This leads
> to slowness of the port where the Application is running and eventually the
> application is not accessible through that particular PORT.
> 
> In case of the traffic directly reaching the Application PORT without HTTPD
> (Load balancer) there is no CLOSE_WAIT connections created and  application
> can handle the load seamlessly.
> 
> Thanks in advance for the support.

Relevant configuration settings please.

Mark


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



Re: trimSpaces removing whitespace from html

2017-05-10 Thread Mark Thomas
On 10/05/17 17:17, David Kavanagh wrote:
> Hey,
> 
> I am wondering if anyone has come across this issue, and hopefully a way
> to fix it.
> When i enable the trimSpaces configuration option it removes the
> whitespace but also 
> removes some whitespace from particular areas of the html. In my case,
> it removes white space between some of the classes in a class=" class1
> class2 class3" string. In one case, the first example, it actually
> removes text as well. I am running Tomcat version 8.0.15.
> 
> Here are some examples:

The in-line images are removed by the list software.

If you can include the example source and resulting HTML snippets
in-line, that would work better.

Mark



> Any advice on this would be greatly appreciated.
> 
> Kind Regards
> 
> David
> 


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



Re: Embedded tomcat does not find web-fragment in jars outside web-inf\lib

2017-05-10 Thread Mark Thomas
On 10/05/17 12:40, Michael Heinen wrote:
> Am 10.05.2017 um 12:18 schrieb Mark Thomas:
>> On 10/05/17 10:26, Michael Heinen wrote:
>>> Am 10.05.2017 um 00:40 schrieb Mark Thomas:
 On 09/05/17 15:25, Michael Heinen wrote:
> Hi all,
>
> I am currently mirgating an application from Tomcat 7.0.73 to 8.0.43.
> On development platforms we use an embedded tomcat.
> On of the jars on the classpath contains a web-fragment.xml in it's
> META-INF folder.
> This jar file is NOT located within the webApp but simply on the
> classpath.
> With Tomcat 7.0.73 the web-fragment is processed and the defined
> filter
> is instantiated.
> With Tomcat 8.0.43 the web-fragment is not processed at all.



>>> Should I open a bug?
>> Maybe. There might be a (spec related) reason for that. E.g. Something
>> that was tightened up / clarified in Servlet 3.1 that wasn't back-ported
>> to Tomcat 7 in case users were relying on the functionality.
>>
>> The next thing to check is the svn history for those files.
>> https://svn.apache.org/viewvc/tomcat/ and the annotate (a.k.a blame)
>> view is useful for that. The key is likely to be the commit that added
>> the isWebapp test.
>>
>> Mark
> 
> I digged into the history an found following changeset with the comment
> "Container provided JARs should not be scanned for deployment
> annotations nor should they be checked for web-fragment.xml files."
> https://svn.apache.org/viewvc?view=revision=1493066
> I have no idea how to find the corresponding ticket but a guy called
> "markt" implemented this ;-)

If there was an associated Bugzilla issue, a link to it would normally
be included in the commit message.

> So the check has been added on purpose but I don't know the reason for
> that.
> What next?

Let me look at the specs and see if there was a change/clarification
that might have prompted this. I do recall in that timeframe that there
were some clarifications about what got scanned in what circumstances.

/me goes to read spec docs...

The relevant language is in section 8.2.1

only JAR files
bundled in a web application's WEB-INF/lib directory, but not those
higher up in the class loading delegation chain, need to be scanned for
web-fragment.xml


Therefore, Tomcat 8.0 looks to be doing the right thing.

Digging into the archives, finds this thread:
http://tomcat.markmail.org/thread/z3n2lfaa6zlpvodl

It looks like this was missed when we implemented Servlet 3.0 (Tomcat 7)
but was picked up during the 3.1 work.

I haven't looked at the changes in detail but it looks like some
combination of needing the new scanning API to implement it and not
wanting to change 7.0.x behaviour after several years of stable releases
was responsible for it not being back-ported.

Neither web-fragment.xml change nor the wider JarScanner changes are
listed in the 7.0.x to 8.0.x migration guide. That looks like it should
be corrected.

Mark


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



CLOSE_WAIT between Application (Tomcat) and Apache HTTPD

2017-05-10 Thread Adhavan Mathiyalagan
Team,

Tomcat version : 8.0.18

Apache HTTPD version : 2.2


There are lot of CLOSE_WAIT connections being created at the
Application(tomcat)  ,when the traffic is routed through the Apache HTTPD
load balancer to the Application running over tomcat container. This leads
to slowness of the port where the Application is running and eventually the
application is not accessible through that particular PORT.

In case of the traffic directly reaching the Application PORT without HTTPD
(Load balancer) there is no CLOSE_WAIT connections created and  application
can handle the load seamlessly.

Thanks in advance for the support.

Regards,
Adhavan.M


trimSpaces removing whitespace from html

2017-05-10 Thread David Kavanagh
Hey,

I am wondering if anyone has come across this issue, and hopefully a way to
fix it.
When i enable the trimSpaces configuration option it removes the whitespace
but also
removes some whitespace from particular areas of the html. In my case, it
removes white space between some of the classes in a class=" class1 class2
class3" string. In one case, the first example, it actually removes text as
well. I am running Tomcat version 8.0.15.

Here are some examples:

1. Before
[image: Inline images 1]
1. After
[image: Inline images 2]

2. Before
[image: Inline images 3]
2. After
[image: Inline images 5]

3. Before
[image: Inline images 6]

3. After
[image: Inline images 7]

Any advice on this would be greatly appreciated.

Kind Regards

David


Re: Thread.sleep CPU time

2017-05-10 Thread Thomas Meyer

> Am 10.05.2017 um 12:02 schrieb Oliver Fernandez 
> :
> 
> But, is it correct Thread to be sleep?

Basically yes. But Brendan Gregg had yesterday an interesting article about CPU 
utilization in modern OSes -  
http://brendangregg.com/blog/2017-05-09/cpu-utilization-is-wrong.html


> 
>> On 10 May 2017 at 10:43, Oliver Fernandez  
>> wrote:
>> So basically we can consider this time as CPU being idle, right?
>> 
>> 
>>> On 10 May 2017 at 10:15, Mark Thomas  wrote:
>>> On 10/05/17 09:02, Oliver Fernandez wrote:
>>> > Sorry about the image. Here's in text format
>>> >
>>> > 
>>> >
>>> >  - org.apache.tomcat.utils.trheads.TaskThreadWrappingRunnable.run() --->
>>> > 42% CPU. This is my webapp code. It's OK
>>> >
>>> >  - org.apache.coyote.AbstractProtocol$AsyncTimeout.run()
>>> > - AbstractProtocol.java:1138 [Wall Time]
>>> > java.lang.Thread.sleep(long) > 38% CPU
>>> >
>>> >  - 
>>> > org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run()
>>> > - ContainerBase.java:1355 [Wall Time] java.lang.Thread.sleep(long)
>>> > --> 19%
>>> 
>>> You are looking at wall time, not CPU time so those values look fine.
>>> For an explanation of the differences see the YourKit docs:
>>> https://www.yourkit.com/docs/java/help/times.jsp
>>> 
>>> Mark
>>> 
>>> 
>>> >
>>> >
>>> > I'm not sure what this means. is it just that the CPU is IDLE waiting
>>> > for other tasks to complete?
>>> >
>>> >
>>> > On 10 May 2017 at 09:53, Stevo Slavić >> > > wrote:
>>> >
>>> > Maybe sleep call is in a loop - busy waiting, and sleeping too
>>> > short. Sleep
>>> > longer, observe latency after the change. In Java 9 there will be 
>>> > extra
>>> > option
>>> > 
>>> > http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait--
>>> > 
>>> > 
>>> >
>>> > On Wed, May 10, 2017 at 9:44 AM, Oliver Fernandez <
>>> > oliver.fernan...@marfeel.com >
>>> > wrote:
>>> >
>>> > > While profiling my Tomcat app using YourKit, I noticed two Threads,
>>> > > consuming 57% of total CPU, in the method Thread.sleep()
>>> > >
>>> > > [image: Inline images 1]
>>> > >
>>> > > What's this Thread.sleep() about?
>>> > >
>>> > >
>>> > >
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> >
>>> > *Óliver Fernández*
>>> >
>>> > Principal Architect
>>> >
>>> >
>>> > Inline image 2
>>> >
>>> >
>>> >
>>> >
>>> > Marfeel Solutions S.L.
>>> >
>>> > Rambla Catalunya 35, Principal 2ª
>>> >
>>> > 08007 Barcelona, Spain
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > ES: (+34) 93 178 59 50  ext. 106
>>> >
>>> > US: (+1) 917-341-2540  ext. 106
>>> >
>>> > UK: (+44) 207-048-37-28  ext. 106
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > www.marfeel.com 
>>> >
>>> 
>>> 
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>> 
>> 
>> 
>> 
>> -- 
>> Óliver Fernández
>> Principal Architect
>> 
>> 
>> 
>> 
>> Marfeel Solutions S.L.
>> Rambla Catalunya 35, Principal 2ª
>> 08007 Barcelona, Spain
>> 
>> 
>> 
>> ES: (+34) 93 178 59 50 ext. 106
>> US: (+1) 917-341-2540 ext. 106
>> UK: (+44) 207-048-37-28 ext. 106
>> 
>> 
>> www.marfeel.com  
> 
> 
> 
> -- 
> Óliver Fernández
> Principal Architect
> 
> 
> 
> 
> Marfeel Solutions S.L.
> Rambla Catalunya 35, Principal 2ª
> 08007 Barcelona, Spain
> 
> 
> 
> ES: (+34) 93 178 59 50 ext. 106
> US: (+1) 917-341-2540 ext. 106
> UK: (+44) 207-048-37-28 ext. 106
> 
> 
> www.marfeel.com  


Re: Embedded tomcat does not find web-fragment in jars outside web-inf\lib

2017-05-10 Thread Michael Heinen

Am 10.05.2017 um 12:18 schrieb Mark Thomas:

On 10/05/17 10:26, Michael Heinen wrote:

Am 10.05.2017 um 00:40 schrieb Mark Thomas:

On 09/05/17 15:25, Michael Heinen wrote:

Hi all,

I am currently mirgating an application from Tomcat 7.0.73 to 8.0.43.
On development platforms we use an embedded tomcat.
On of the jars on the classpath contains a web-fragment.xml in it's
META-INF folder.
This jar file is NOT located within the webApp but simply on the
classpath.
With Tomcat 7.0.73 the web-fragment is processed and the defined filter
is instantiated.
With Tomcat 8.0.43 the web-fragment is not processed at all.

Some lines of code:

final StandardContext ctx = ...
ctx.setXmlBlockExternal(false);

final StandardJarScanner jarScanner = new StandardJarScanner();
jarScanner.setScanAllDirectories(true);
jarScanner.setScanAllFiles(true);
jarScanner.setScanBootstrapClassPath(true);
jarScanner.setScanClassPath(true);
jarScanner.setScanManifest(false);
ctx.setJarScanner(jarScanner);

Should this work with Tomcat 8 or is my expectation wrong?

It should work. I'd recommend putting a break-point in
StandardJarScanner and stepping through the Tomcat code to see what is
going wrong.

Mark

Thanks Mark
Here are the results from debugging:

1) Tomcat 8.0.43:
The boolean parameter "isWebapp" is false in this case and therefore the
web-fragment is not processed at all.
See
org.apache.tomcat.util.descriptor.web.FragmentJarScannerCallback.scan(Jar,
String, boolean)

 // Only web application JARs are checked for web-fragment.xml
 // files.
 // web-fragment.xml files don't need to be parsed if they are never
 // going to be used.
 if (isWebapp && parseRequired) {
 is = jar.getInputStream(FRAGMENT_LOCATION);
 }

2) Tomcat 7.0.73:
There is no check for webApps. The member "parseRequired" is true and
therefore the fragment is loaded.
See
org.apache.catalina.startup.ContextConfig.FragmentJarScannerCallback.scan(JarURLConnection)


  if (parseRequired || context.getXmlValidation()) {
 is = jar.getInputStream(FRAGMENT_LOCATION);
  }

Thanks for digging in to that. That certainly explains the different
behaviours.


Should I open a bug?

Maybe. There might be a (spec related) reason for that. E.g. Something
that was tightened up / clarified in Servlet 3.1 that wasn't back-ported
to Tomcat 7 in case users were relying on the functionality.

The next thing to check is the svn history for those files.
https://svn.apache.org/viewvc/tomcat/ and the annotate (a.k.a blame)
view is useful for that. The key is likely to be the commit that added
the isWebapp test.

Mark


I digged into the history an found following changeset with the comment
"Container provided JARs should not be scanned for deployment 
annotations nor should they be checked for web-fragment.xml files."

https://svn.apache.org/viewvc?view=revision=1493066
I have no idea how to find the corresponding ticket but a guy called 
"markt" implemented this ;-)


So the check has been added on purpose but I don't know the reason for 
that.

What next?

Thanks,
Michael




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





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



Re: Thread.sleep CPU time

2017-05-10 Thread Mark Thomas
On 10/05/17 11:08, Oliver Fernandez wrote:
> Is there anyway to know if this is caused by specific method? For
> example, if a method is waiting for a I/O operation, or network request

Well, you could always look at the source code.

Mark

> 
> On 10 May 2017 at 12:05, Mark Thomas  > wrote:
> 
> On 10/05/17 11:02, Oliver Fernandez wrote:
> > But, is it correct Thread to be sleep?
> 
> Yes.
> 
> > On 10 May 2017 at 10:43, Oliver Fernandez  
> >  >>
> wrote:
> >
> > So basically we can consider this time as CPU being idle, right?
> 
> Yes.
> 
> Mark
> 
> >
> >
> > On 10 May 2017 at 10:15, Mark Thomas  
> > >> wrote:
> >
> > On 10/05/17 09:02, Oliver Fernandez wrote:
> > > Sorry about the image. Here's in text format
> > >
> > > 
> > >
> > >  - 
> org.apache.tomcat.utils.trheads.TaskThreadWrappingRunnable.run() --->
> > > 42% CPU. This is my webapp code. It's OK
> > >
> > >  - org.apache.coyote.AbstractProtocol$AsyncTimeout.run()
> > > - AbstractProtocol.java:1138 [Wall Time]
> > > java.lang.Thread.sleep(long) > 38% CPU
> > >
> > >  - 
> org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run()
> > > - ContainerBase.java:1355 [Wall Time] 
> java.lang.Thread.sleep(long)
> > > --> 19%
> >
> > You are looking at wall time, not CPU time so those values look
> > fine.
> > For an explanation of the differences see the YourKit docs:
> > https://www.yourkit.com/docs/java/help/times.jsp
> 
> >  >
> >
> > Mark
> >
> >
> > >
> > >
> > > I'm not sure what this means. is it just that the CPU is IDLE 
> waiting
> > > for other tasks to complete?
> > >
> > >
> > > On 10 May 2017 at 09:53, Stevo Slavić  
> >
> > > 
>  > >
> > > Maybe sleep call is in a loop - busy waiting, and 
> sleeping too
> > > short. Sleep
> > > longer, observe latency after the change. In Java 9 there 
> will be extra
> > > option
> > > 
> http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait--
> 
> 
> > 
>  
> >
> > > 
>  
> 
> > 
>  
> >>
> > >
> > > On Wed, May 10, 2017 at 9:44 AM, Oliver Fernandez <
> > > oliver.fernan...@marfeel.com 
> 
> >  >
> >  
> >   > > wrote:
> > >
> > > > While profiling my Tomcat app using YourKit, I noticed 
> two Threads,
> > > > consuming 57% of total CPU, in the method Thread.sleep()
> > > >
> > > > [image: Inline images 1]
> > > >
> > > > What's this Thread.sleep() about?
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > > --
> > >
> > > *Óliver Fernández*
> > >
> > > Principal Architect
> > >
> > >
> > > Inline image 2
> 

Re: Embedded tomcat does not find web-fragment in jars outside web-inf\lib

2017-05-10 Thread Mark Thomas
On 10/05/17 10:26, Michael Heinen wrote:
> Am 10.05.2017 um 00:40 schrieb Mark Thomas:
>> On 09/05/17 15:25, Michael Heinen wrote:
>>> Hi all,
>>>
>>> I am currently mirgating an application from Tomcat 7.0.73 to 8.0.43.
>>> On development platforms we use an embedded tomcat.
>>> On of the jars on the classpath contains a web-fragment.xml in it's
>>> META-INF folder.
>>> This jar file is NOT located within the webApp but simply on the
>>> classpath.
>>> With Tomcat 7.0.73 the web-fragment is processed and the defined filter
>>> is instantiated.
>>> With Tomcat 8.0.43 the web-fragment is not processed at all.
>>>
>>> Some lines of code:
>>>
>>> final StandardContext ctx = ...
>>> ctx.setXmlBlockExternal(false);
>>>
>>> final StandardJarScanner jarScanner = new StandardJarScanner();
>>> jarScanner.setScanAllDirectories(true);
>>> jarScanner.setScanAllFiles(true);
>>> jarScanner.setScanBootstrapClassPath(true);
>>> jarScanner.setScanClassPath(true);
>>> jarScanner.setScanManifest(false);
>>> ctx.setJarScanner(jarScanner);
>>>
>>> Should this work with Tomcat 8 or is my expectation wrong?
>> It should work. I'd recommend putting a break-point in
>> StandardJarScanner and stepping through the Tomcat code to see what is
>> going wrong.
>>
>> Mark
> 
> Thanks Mark
> Here are the results from debugging:
> 
> 1) Tomcat 8.0.43:
> The boolean parameter "isWebapp" is false in this case and therefore the
> web-fragment is not processed at all.
> See
> org.apache.tomcat.util.descriptor.web.FragmentJarScannerCallback.scan(Jar,
> String, boolean)
> 
> // Only web application JARs are checked for web-fragment.xml
> // files.
> // web-fragment.xml files don't need to be parsed if they are never
> // going to be used.
> if (isWebapp && parseRequired) {
> is = jar.getInputStream(FRAGMENT_LOCATION);
> }
> 
> 2) Tomcat 7.0.73:
> There is no check for webApps. The member "parseRequired" is true and
> therefore the fragment is loaded.
> See
> org.apache.catalina.startup.ContextConfig.FragmentJarScannerCallback.scan(JarURLConnection)
> 
> 
>  if (parseRequired || context.getXmlValidation()) {
> is = jar.getInputStream(FRAGMENT_LOCATION);
>  }

Thanks for digging in to that. That certainly explains the different
behaviours.

> Should I open a bug?

Maybe. There might be a (spec related) reason for that. E.g. Something
that was tightened up / clarified in Servlet 3.1 that wasn't back-ported
to Tomcat 7 in case users were relying on the functionality.

The next thing to check is the svn history for those files.
https://svn.apache.org/viewvc/tomcat/ and the annotate (a.k.a blame)
view is useful for that. The key is likely to be the commit that added
the isWebapp test.

Mark


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



Re: Thread.sleep CPU time

2017-05-10 Thread Oliver Fernandez
Is there anyway to know if this is caused by specific method? For example,
if a method is waiting for a I/O operation, or network request

On 10 May 2017 at 12:05, Mark Thomas  wrote:

> On 10/05/17 11:02, Oliver Fernandez wrote:
> > But, is it correct Thread to be sleep?
>
> Yes.
>
> > On 10 May 2017 at 10:43, Oliver Fernandez  > > wrote:
> >
> > So basically we can consider this time as CPU being idle, right?
>
> Yes.
>
> Mark
>
> >
> >
> > On 10 May 2017 at 10:15, Mark Thomas  > > wrote:
> >
> > On 10/05/17 09:02, Oliver Fernandez wrote:
> > > Sorry about the image. Here's in text format
> > >
> > > 
> > >
> > >  - 
> > org.apache.tomcat.utils.trheads.TaskThreadWrappingRunnable.run()
> --->
> > > 42% CPU. This is my webapp code. It's OK
> > >
> > >  - org.apache.coyote.AbstractProtocol$AsyncTimeout.run()
> > > - AbstractProtocol.java:1138 [Wall Time]
> > > java.lang.Thread.sleep(long) > 38% CPU
> > >
> > >  - org.apache.catalina.core.ContainerBase$
> ContainerBackgroundProcessor.run()
> > > - ContainerBase.java:1355 [Wall Time]
> java.lang.Thread.sleep(long)
> > > --> 19%
> >
> > You are looking at wall time, not CPU time so those values look
> > fine.
> > For an explanation of the differences see the YourKit docs:
> > https://www.yourkit.com/docs/java/help/times.jsp
> > 
> >
> > Mark
> >
> >
> > >
> > >
> > > I'm not sure what this means. is it just that the CPU is IDLE
> waiting
> > > for other tasks to complete?
> > >
> > >
> > > On 10 May 2017 at 09:53, Stevo Slavić  
> > > >> wrote:
> > >
> > > Maybe sleep call is in a loop - busy waiting, and sleeping
> too
> > > short. Sleep
> > > longer, observe latency after the change. In Java 9 there
> will be extra
> > > option
> > > http://download.java.net/java/jdk9/docs/api/java/lang/
> Thread.html#onSpinWait--
> >  Thread.html#onSpinWait-->
> > >  Thread.html#onSpinWait--
> >  Thread.html#onSpinWait-->>
> > >
> > > On Wed, May 10, 2017 at 9:44 AM, Oliver Fernandez <
> > > oliver.fernan...@marfeel.com
> > 
> >  > >>
> > > wrote:
> > >
> > > > While profiling my Tomcat app using YourKit, I noticed
> two Threads,
> > > > consuming 57% of total CPU, in the method Thread.sleep()
> > > >
> > > > [image: Inline images 1]
> > > >
> > > > What's this Thread.sleep() about?
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > > --
> > >
> > > *Óliver Fernández*
> > >
> > > Principal Architect
> > >
> > >
> > > Inline image 2
> > >
> > >
> > >
> > >
> > > Marfeel Solutions S.L.
> > >
> > > Rambla Catalunya 35, Principal 2ª
> > >
> > > 08007 Barcelona, Spain
> > >
> > >
> > >
> > >
> > >
> > >
> > > ES: (+34) 93 178 59 50 
> >  ext. 106
> > >
> > > US: (+1) 917-341-2540 
> >  ext. 106
> > >
> > > UK: (+44) 207-048-37-28  ext. 106
> > >
> > >
> > >
> > >
> > >
> > > www.marfeel.com  <
> http://www.marfeel.com/>
> > >
> >
> >
> > 
> -
> > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > 
> > For additional commands, e-mail: users-h...@tomcat.apache.org
> > 
> >
> >
> >
> >
> > --
> >
> > *Óliver Fernández*
> >
> > Principal Architect
> >
> >
> > Inline image 2
> >
> >
> >
> >
> > Marfeel Solutions S.L.
> >
> > Rambla Catalunya 35, Principal 2ª
> >
> > 

Re: Thread.sleep CPU time

2017-05-10 Thread Mark Thomas
On 10/05/17 11:02, Oliver Fernandez wrote:
> But, is it correct Thread to be sleep?

Yes.

> On 10 May 2017 at 10:43, Oliver Fernandez  > wrote:
> 
> So basically we can consider this time as CPU being idle, right?

Yes.

Mark

> 
> 
> On 10 May 2017 at 10:15, Mark Thomas  > wrote:
> 
> On 10/05/17 09:02, Oliver Fernandez wrote:
> > Sorry about the image. Here's in text format
> >
> > 
> >
> >  - org.apache.tomcat.utils.trheads.TaskThreadWrappingRunnable.run() 
> --->
> > 42% CPU. This is my webapp code. It's OK
> >
> >  - org.apache.coyote.AbstractProtocol$AsyncTimeout.run()
> > - AbstractProtocol.java:1138 [Wall Time]
> > java.lang.Thread.sleep(long) > 38% CPU
> >
> >  - 
> org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run()
> > - ContainerBase.java:1355 [Wall Time] 
> java.lang.Thread.sleep(long)
> > --> 19%
> 
> You are looking at wall time, not CPU time so those values look
> fine.
> For an explanation of the differences see the YourKit docs:
> https://www.yourkit.com/docs/java/help/times.jsp
> 
> 
> Mark
> 
> 
> >
> >
> > I'm not sure what this means. is it just that the CPU is IDLE 
> waiting
> > for other tasks to complete?
> >
> >
> > On 10 May 2017 at 09:53, Stevo Slavić  
> > >> wrote:
> >
> > Maybe sleep call is in a loop - busy waiting, and sleeping too
> > short. Sleep
> > longer, observe latency after the change. In Java 9 there will 
> be extra
> > option
> > 
> http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait--
> 
> 
> > 
>  
> >
> >
> > On Wed, May 10, 2017 at 9:44 AM, Oliver Fernandez <
> > oliver.fernan...@marfeel.com
> 
>  >>
> > wrote:
> >
> > > While profiling my Tomcat app using YourKit, I noticed two 
> Threads,
> > > consuming 57% of total CPU, in the method Thread.sleep()
> > >
> > > [image: Inline images 1]
> > >
> > > What's this Thread.sleep() about?
> > >
> > >
> > >
> >
> >
> >
> >
> > --
> >
> > *Óliver Fernández*
> >
> > Principal Architect
> >
> >
> > Inline image 2
> >
> >
> >
> >
> > Marfeel Solutions S.L.
> >
> > Rambla Catalunya 35, Principal 2ª
> >
> > 08007 Barcelona, Spain
> >
> >
> >
> >
> >
> >
> > ES: (+34) 93 178 59 50 
>  ext. 106
> >
> > US: (+1) 917-341-2540 
>  ext. 106
> >
> > UK: (+44) 207-048-37-28  ext. 106
> >
> >
> >
> >
> >
> > www.marfeel.com  
> >
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> 
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> 
> 
> 
> -- 
> 
> *Óliver Fernández*
> 
> Principal Architect
> 
> 
> Inline image 2
> 
> 
>   
> 
> Marfeel Solutions S.L.
> 
> Rambla Catalunya 35, Principal 2ª
> 
> 08007 Barcelona, Spain
> 
> 
> 
> 
>   
> 
> ES: (+34) 93 178 59 50  ext. 106
> 
> US: (+1) 917-341-2540  ext. 106
> 
> UK: (+44) 207-048-37-28  ext. 106
> 
> 
> 
>   
> 
> www.marfeel.com  
> 
> 
> 
> 
> -- 
> 
> *Óliver Fernández*
> 
> Principal Architect
> 
> 
> Inline image 2
> 
> 
>   
> 
> Marfeel Solutions 

Re: Thread.sleep CPU time

2017-05-10 Thread Oliver Fernandez
But, is it correct Thread to be sleep?

On 10 May 2017 at 10:43, Oliver Fernandez 
wrote:

> So basically we can consider this time as CPU being idle, right?
>
>
> On 10 May 2017 at 10:15, Mark Thomas  wrote:
>
>> On 10/05/17 09:02, Oliver Fernandez wrote:
>> > Sorry about the image. Here's in text format
>> >
>> > 
>> >
>> >  - org.apache.tomcat.utils.trheads.TaskThreadWrappingRunnable.run()
>> --->
>> > 42% CPU. This is my webapp code. It's OK
>> >
>> >  - org.apache.coyote.AbstractProtocol$AsyncTimeout.run()
>> > - AbstractProtocol.java:1138 [Wall Time]
>> > java.lang.Thread.sleep(long) > 38% CPU
>> >
>> >  - org.apache.catalina.core.ContainerBase$ContainerBackgroundPr
>> ocessor.run()
>> > - ContainerBase.java:1355 [Wall Time] java.lang.Thread.sleep(long)
>> > --> 19%
>>
>> You are looking at wall time, not CPU time so those values look fine.
>> For an explanation of the differences see the YourKit docs:
>> https://www.yourkit.com/docs/java/help/times.jsp
>>
>> Mark
>>
>>
>> >
>> >
>> > I'm not sure what this means. is it just that the CPU is IDLE waiting
>> > for other tasks to complete?
>> >
>> >
>> > On 10 May 2017 at 09:53, Stevo Slavić > > > wrote:
>> >
>> > Maybe sleep call is in a loop - busy waiting, and sleeping too
>> > short. Sleep
>> > longer, observe latency after the change. In Java 9 there will be
>> extra
>> > option
>> > http://download.java.net/java/jdk9/docs/api/java/lang/T
>> hread.html#onSpinWait--
>> > > ad.html#onSpinWait-->
>> >
>> > On Wed, May 10, 2017 at 9:44 AM, Oliver Fernandez <
>> > oliver.fernan...@marfeel.com >
>> > wrote:
>> >
>> > > While profiling my Tomcat app using YourKit, I noticed two
>> Threads,
>> > > consuming 57% of total CPU, in the method Thread.sleep()
>> > >
>> > > [image: Inline images 1]
>> > >
>> > > What's this Thread.sleep() about?
>> > >
>> > >
>> > >
>> >
>> >
>> >
>> >
>> > --
>> >
>> > *Óliver Fernández*
>> >
>> > Principal Architect
>> >
>> >
>> > Inline image 2
>> >
>> >
>> >
>> >
>> > Marfeel Solutions S.L.
>> >
>> > Rambla Catalunya 35, Principal 2ª
>> >
>> > 08007 Barcelona, Spain
>> >
>> >
>> >
>> >
>> >
>> >
>> > ES: (+34) 93 178 59 50  ext. 106
>> >
>> > US: (+1) 917-341-2540  ext. 106
>> >
>> > UK: (+44) 207-048-37-28  ext. 106
>> >
>> >
>> >
>> >
>> >
>> > www.marfeel.com 
>> >
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>
>
>
> --
>
> *Óliver Fernández*
>
> Principal Architect
>
> [image: Inline image 2]
>
>
> Marfeel Solutions S.L.
>
> Rambla Catalunya 35, Principal 2ª
>
> 08007 Barcelona, Spain
>
>
>
>
> ES: (+34) 93 178 59 50 ext. 106
>
> US: (+1) 917-341-2540 ext. 106
>
> UK: (+44) 207-048-37-28 <%28%2B44%29%20704-837-28> ext. 106
>
>
> www.marfeel.com
>



-- 

*Óliver Fernández*

Principal Architect

[image: Inline image 2]


Marfeel Solutions S.L.

Rambla Catalunya 35, Principal 2ª

08007 Barcelona, Spain




ES: (+34) 93 178 59 50 ext. 106

US: (+1) 917-341-2540 ext. 106

UK: (+44) 207-048-37-28 <%28%2B44%29%20704-837-28> ext. 106


www.marfeel.com


Re: Embedded tomcat does not find web-fragment in jars outside web-inf\lib

2017-05-10 Thread Michael Heinen

Am 10.05.2017 um 00:40 schrieb Mark Thomas:

On 09/05/17 15:25, Michael Heinen wrote:

Hi all,

I am currently mirgating an application from Tomcat 7.0.73 to 8.0.43.
On development platforms we use an embedded tomcat.
On of the jars on the classpath contains a web-fragment.xml in it's
META-INF folder.
This jar file is NOT located within the webApp but simply on the classpath.
With Tomcat 7.0.73 the web-fragment is processed and the defined filter
is instantiated.
With Tomcat 8.0.43 the web-fragment is not processed at all.

Some lines of code:

final StandardContext ctx = ...
ctx.setXmlBlockExternal(false);

final StandardJarScanner jarScanner = new StandardJarScanner();
jarScanner.setScanAllDirectories(true);
jarScanner.setScanAllFiles(true);
jarScanner.setScanBootstrapClassPath(true);
jarScanner.setScanClassPath(true);
jarScanner.setScanManifest(false);
ctx.setJarScanner(jarScanner);

Should this work with Tomcat 8 or is my expectation wrong?

It should work. I'd recommend putting a break-point in
StandardJarScanner and stepping through the Tomcat code to see what is
going wrong.

Mark


Thanks Mark
Here are the results from debugging:

1) Tomcat 8.0.43:
The boolean parameter "isWebapp" is false in this case and therefore the 
web-fragment is not processed at all.
See 
org.apache.tomcat.util.descriptor.web.FragmentJarScannerCallback.scan(Jar, 
String, boolean)


// Only web application JARs are checked for web-fragment.xml
// files.
// web-fragment.xml files don't need to be parsed if they are never
// going to be used.
if (isWebapp && parseRequired) {
is = jar.getInputStream(FRAGMENT_LOCATION);
}

2) Tomcat 7.0.73:
There is no check for webApps. The member "parseRequired" is true and 
therefore the fragment is loaded.
See 
org.apache.catalina.startup.ContextConfig.FragmentJarScannerCallback.scan(JarURLConnection)


 if (parseRequired || context.getXmlValidation()) {
is = jar.getInputStream(FRAGMENT_LOCATION);
 }

Should I open a bug?

Regards,
Michael




Note that the web-fragement is processed when I move the jar to the
web-inf\lib folder.

Regards,

Michael




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



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





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



Re: Thread.sleep CPU time

2017-05-10 Thread Oliver Fernandez
So basically we can consider this time as CPU being idle, right?


On 10 May 2017 at 10:15, Mark Thomas  wrote:

> On 10/05/17 09:02, Oliver Fernandez wrote:
> > Sorry about the image. Here's in text format
> >
> > 
> >
> >  - org.apache.tomcat.utils.trheads.TaskThreadWrappingRunnable.run() --->
> > 42% CPU. This is my webapp code. It's OK
> >
> >  - org.apache.coyote.AbstractProtocol$AsyncTimeout.run()
> > - AbstractProtocol.java:1138 [Wall Time]
> > java.lang.Thread.sleep(long) > 38% CPU
> >
> >  - org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.
> run()
> > - ContainerBase.java:1355 [Wall Time] java.lang.Thread.sleep(long)
> > --> 19%
>
> You are looking at wall time, not CPU time so those values look fine.
> For an explanation of the differences see the YourKit docs:
> https://www.yourkit.com/docs/java/help/times.jsp
>
> Mark
>
>
> >
> >
> > I'm not sure what this means. is it just that the CPU is IDLE waiting
> > for other tasks to complete?
> >
> >
> > On 10 May 2017 at 09:53, Stevo Slavić  > > wrote:
> >
> > Maybe sleep call is in a loop - busy waiting, and sleeping too
> > short. Sleep
> > longer, observe latency after the change. In Java 9 there will be
> extra
> > option
> > http://download.java.net/java/jdk9/docs/api/java/lang/
> Thread.html#onSpinWait--
> >  Thread.html#onSpinWait-->
> >
> > On Wed, May 10, 2017 at 9:44 AM, Oliver Fernandez <
> > oliver.fernan...@marfeel.com >
> > wrote:
> >
> > > While profiling my Tomcat app using YourKit, I noticed two Threads,
> > > consuming 57% of total CPU, in the method Thread.sleep()
> > >
> > > [image: Inline images 1]
> > >
> > > What's this Thread.sleep() about?
> > >
> > >
> > >
> >
> >
> >
> >
> > --
> >
> > *Óliver Fernández*
> >
> > Principal Architect
> >
> >
> > Inline image 2
> >
> >
> >
> >
> > Marfeel Solutions S.L.
> >
> > Rambla Catalunya 35, Principal 2ª
> >
> > 08007 Barcelona, Spain
> >
> >
> >
> >
> >
> >
> > ES: (+34) 93 178 59 50  ext. 106
> >
> > US: (+1) 917-341-2540  ext. 106
> >
> > UK: (+44) 207-048-37-28  ext. 106
> >
> >
> >
> >
> >
> > www.marfeel.com 
> >
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


-- 

*Óliver Fernández*

Principal Architect

[image: Inline image 2]


Marfeel Solutions S.L.

Rambla Catalunya 35, Principal 2ª

08007 Barcelona, Spain




ES: (+34) 93 178 59 50 ext. 106

US: (+1) 917-341-2540 ext. 106

UK: (+44) 207-048-37-28 <%28%2B44%29%20704-837-28> ext. 106


www.marfeel.com


Re: Thread.sleep CPU time

2017-05-10 Thread Mark Thomas
On 10/05/17 09:02, Oliver Fernandez wrote:
> Sorry about the image. Here's in text format
> 
> 
> 
>  - org.apache.tomcat.utils.trheads.TaskThreadWrappingRunnable.run() --->
> 42% CPU. This is my webapp code. It's OK
> 
>  - org.apache.coyote.AbstractProtocol$AsyncTimeout.run()
> - AbstractProtocol.java:1138 [Wall Time]
> java.lang.Thread.sleep(long) > 38% CPU
> 
>  - org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run()
> - ContainerBase.java:1355 [Wall Time] java.lang.Thread.sleep(long)
> --> 19%

You are looking at wall time, not CPU time so those values look fine.
For an explanation of the differences see the YourKit docs:
https://www.yourkit.com/docs/java/help/times.jsp

Mark


> 
> 
> I'm not sure what this means. is it just that the CPU is IDLE waiting
> for other tasks to complete?
> 
> 
> On 10 May 2017 at 09:53, Stevo Slavić  > wrote:
> 
> Maybe sleep call is in a loop - busy waiting, and sleeping too
> short. Sleep
> longer, observe latency after the change. In Java 9 there will be extra
> option
> 
> http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait--
> 
> 
> 
> On Wed, May 10, 2017 at 9:44 AM, Oliver Fernandez <
> oliver.fernan...@marfeel.com >
> wrote:
> 
> > While profiling my Tomcat app using YourKit, I noticed two Threads,
> > consuming 57% of total CPU, in the method Thread.sleep()
> >
> > [image: Inline images 1]
> >
> > What's this Thread.sleep() about?
> >
> >
> >
> 
> 
> 
> 
> -- 
> 
> *Óliver Fernández*
> 
> Principal Architect
> 
> 
> Inline image 2
> 
> 
>   
> 
> Marfeel Solutions S.L.
> 
> Rambla Catalunya 35, Principal 2ª
> 
> 08007 Barcelona, Spain
> 
> 
> 
> 
>   
> 
> ES: (+34) 93 178 59 50  ext. 106
> 
> US: (+1) 917-341-2540  ext. 106
> 
> UK: (+44) 207-048-37-28  ext. 106
> 
> 
> 
>   
> 
> www.marfeel.com  
> 


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



Re: Thread.sleep CPU time

2017-05-10 Thread Oliver Fernandez
Sorry about the image. Here's in text format



 - org.apache.tomcat.utils.trheads.TaskThreadWrappingRunnable.run() --->
42% CPU. This is my webapp code. It's OK

 - org.apache.coyote.AbstractProtocol$AsyncTimeout.run()
- AbstractProtocol.java:1138 [Wall Time] java.lang.Thread.sleep(long)
> 38% CPU

 - org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run()
- ContainerBase.java:1355 [Wall Time] java.lang.Thread.sleep(long)
--> 19%


I'm not sure what this means. is it just that the CPU is IDLE waiting for
other tasks to complete?


On 10 May 2017 at 09:53, Stevo Slavić  wrote:

> Maybe sleep call is in a loop - busy waiting, and sleeping too short. Sleep
> longer, observe latency after the change. In Java 9 there will be extra
> option
> http://download.java.net/java/jdk9/docs/api/java/lang/
> Thread.html#onSpinWait--
>
> On Wed, May 10, 2017 at 9:44 AM, Oliver Fernandez <
> oliver.fernan...@marfeel.com> wrote:
>
> > While profiling my Tomcat app using YourKit, I noticed two Threads,
> > consuming 57% of total CPU, in the method Thread.sleep()
> >
> > [image: Inline images 1]
> >
> > What's this Thread.sleep() about?
> >
> >
> >
>



-- 

*Óliver Fernández*

Principal Architect

[image: Inline image 2]


Marfeel Solutions S.L.

Rambla Catalunya 35, Principal 2ª

08007 Barcelona, Spain




ES: (+34) 93 178 59 50 ext. 106

US: (+1) 917-341-2540 ext. 106

UK: (+44) 207-048-37-28 <%28%2B44%29%20704-837-28> ext. 106


www.marfeel.com


Re: Thread.sleep CPU time

2017-05-10 Thread Felix Schumacher


Am 10. Mai 2017 09:44:13 MESZ schrieb Oliver Fernandez 
:
>While profiling my Tomcat app using YourKit, I noticed two Threads,
>consuming 57% of total CPU, in the method Thread.sleep()
>
>[image: Inline images 1]

The image was removed by the mailing list. Could you post the details as text?

Regards,
 Felix

>
>What's this Thread.sleep() about?

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



Re: Thread.sleep CPU time

2017-05-10 Thread Stevo Slavić
Maybe sleep call is in a loop - busy waiting, and sleeping too short. Sleep
longer, observe latency after the change. In Java 9 there will be extra
option
http://download.java.net/java/jdk9/docs/api/java/lang/Thread.html#onSpinWait--

On Wed, May 10, 2017 at 9:44 AM, Oliver Fernandez <
oliver.fernan...@marfeel.com> wrote:

> While profiling my Tomcat app using YourKit, I noticed two Threads,
> consuming 57% of total CPU, in the method Thread.sleep()
>
> [image: Inline images 1]
>
> What's this Thread.sleep() about?
>
>
>


Thread.sleep CPU time

2017-05-10 Thread Oliver Fernandez
While profiling my Tomcat app using YourKit, I noticed two Threads,
consuming 57% of total CPU, in the method Thread.sleep()

[image: Inline images 1]

What's this Thread.sleep() about?