Re: Malformed chunked stream

2019-08-30 Thread Mark Thomas
On August 30, 2019 8:34:02 PM UTC, Dave Thorn  wrote:
>I am reading a ~900K XML response from a Tomcat 7.0.76 server, using
>Spring RestTemplate and very very intermittently I'm getting a
>MalformedChunkCodingException.[1]
>
>"Unexpected content at the end of chunk".
>
>I enabled httpclient 'wire' debugging in my client and left it running
>all day and I finally got a bite:
>
>[many things]
>DEBUG org.apache.http.wire -  << "datadatadata"
>DEBUG org.apache.http.wire -  << "[\r][\n]"
>DEBUG org.apache.http.wire -  << "1AB8[\r][\n]"
>DEBUG org.apache.http.wire -  << "datadatadata"
>DEBUG org.apache.http.wire -  << "[\r][\n]"
>DEBUG org.apache.http.wire -  << "B50[\r][\n]"
>DEBUG org.apache.http.wire -  << "datadatadata"
>DEBUG org.apache.http.wire -  << "3FC0[\r][\n]"
>[exception]
>
>That looks, to me, like the stream is missing the [\r][\n] between the
>B50 chunk and the 3FC0 count.
>
>I'm not clear on where the responsibilities lie in producing that
>chunked output - Spring in my webapp, or Tomcat as my container?
>
>Thanks for any guidance you can provide.

I suspect Tomcat is doing the chunking but I'd recommend checking with the 
Spring folks to confirm that.

I'd also recommend repeating your test with Wireshark to confirm that the 
server doesn't send it and that you aren't seeing a client side bug.

I took a quick look at Tomcat's ChunkedOutputFilter and I don't see any obvious 
way the \r\n could be skipped but a strange edge case isn't impossible.

Mark


>
>
>[1]
>Caused by: org.apache.http.MalformedChunkCodingException: Unexpected
>content at the end of chunk
>   at
>org.apache.http.impl.io.ChunkedInputStream.getChunkSize(ChunkedInputStream.java:259)
>   at
>org.apache.http.impl.io.ChunkedInputStream.nextChunk(ChunkedInputStream.java:227)
>   at
>org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:186)
>   at
>org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:137)
>   at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
>   at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
>   at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
>   at java.io.InputStreamReader.read(InputStreamReader.java:184)
>   at java.io.Reader.read(Reader.java:140)
>   at
>org.springframework.util.StreamUtils.copyToString(StreamUtils.java:74)
>   at
>org.springframework.http.converter.StringHttpMessageConverter.readInternal(StringHttpMessageConverter.java:85)
>   at
>org.springframework.http.converter.StringHttpMessageConverter.readInternal(StringHttpMessageConverter.java:40)
>   at
>org.springframework.http.converter.AbstractHttpMessageConverter.read(AbstractHttpMessageConverter.java:153)
>   at
>org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:103)
>   at
>org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:724)
>   at
>org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:709)
>   at
>org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:527)


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



Malformed chunked stream

2019-08-30 Thread Dave Thorn
I am reading a ~900K XML response from a Tomcat 7.0.76 server, using
Spring RestTemplate and very very intermittently I'm getting a
MalformedChunkCodingException.[1]

"Unexpected content at the end of chunk".

I enabled httpclient 'wire' debugging in my client and left it running
all day and I finally got a bite:

[many things]
DEBUG org.apache.http.wire -  << "datadatadata"
DEBUG org.apache.http.wire -  << "[\r][\n]"
DEBUG org.apache.http.wire -  << "1AB8[\r][\n]"
DEBUG org.apache.http.wire -  << "datadatadata"
DEBUG org.apache.http.wire -  << "[\r][\n]"
DEBUG org.apache.http.wire -  << "B50[\r][\n]"
DEBUG org.apache.http.wire -  << "datadatadata"
DEBUG org.apache.http.wire -  << "3FC0[\r][\n]"
[exception]

That looks, to me, like the stream is missing the [\r][\n] between the
B50 chunk and the 3FC0 count.

I'm not clear on where the responsibilities lie in producing that
chunked output - Spring in my webapp, or Tomcat as my container?

Thanks for any guidance you can provide.


[1]
Caused by: org.apache.http.MalformedChunkCodingException: Unexpected content at 
the end of chunk
at 
org.apache.http.impl.io.ChunkedInputStream.getChunkSize(ChunkedInputStream.java:259)
at 
org.apache.http.impl.io.ChunkedInputStream.nextChunk(ChunkedInputStream.java:227)
at 
org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:186)
at 
org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:137)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.Reader.read(Reader.java:140)
at 
org.springframework.util.StreamUtils.copyToString(StreamUtils.java:74)
at 
org.springframework.http.converter.StringHttpMessageConverter.readInternal(StringHttpMessageConverter.java:85)
at 
org.springframework.http.converter.StringHttpMessageConverter.readInternal(StringHttpMessageConverter.java:40)
at 
org.springframework.http.converter.AbstractHttpMessageConverter.read(AbstractHttpMessageConverter.java:153)
at 
org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:103)
at 
org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:724)
at 
org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:709)
at 
org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:527)

-- 
dave thorn

Hi, I'm from the Internet.


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



Re: Tomcat Bandwidth Utilization Tool

2019-08-30 Thread tomcat

Hi.

If what you are after is really the full byte traffic at the lowest level, and if you are 
under Linux, how about this :


1) cat /etc/network/interfaces
and look for the name of the interface which matches the address tomcat is 
listening on.
e.g. (in my case, real addresses scrambled) :

...
iface eth1 inet static
address 155.55.55.178
netmask 255.255.254.0
network 155.55.55.0
broadcast 155.55.55.255
gateway 155.55.55.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.20.80 155.55.55.16
dns-search mydomain.com
root@myhost:~#
(So gere the interface name is eth1)

2) then, assuming your tomcat is listening on HTTPS port 443 :
iftop -i eth1 -P -f "port https"
(see "man iftop" for additional details/options)

Note : "iftop" is a tool that works at almost the closest level to the physical network 
interface as you can get.  Any tool that works at the Java or Tomcat level, is probably 
not going to be able to show the real IP-level byte count (including the full TCP headers 
etc.).




On 30.08.2019 15:30, Michael Duffy wrote:

Thx Guido.

I would appreciate more details.

You could post them as a reply to this email or if you are on StackOverflow
I will post the question there.  I think your answer would get a lot of up
votes.

Mike

On Fri, Aug 30, 2019 at 6:01 AM Jäkel, Guido  wrote:


Dear Michael,

you may read the statistic values provided by the Connector (and others
like busy works, load, heap usage or even the request scoreboard) via JXM
or even (by help of the JMX Proxy Servlet) via HTTP. You may contact me if
you need more advice.

greetings

Guido


-Original Message-
From: Michael Duffy [mailto:mduffy...@gmail.com]
Sent: Friday, August 30, 2019 2:36 AM
To: users@tomcat.apache.org
Subject: Re: Tomcat Bandwidth Utilization Tool

There is a " Bytes received: 0.00 MB Bytes sent: 12.03 MB" in the Tomcat
Manager; however, the received count does not change and the sent count
seems low.

On Thu, Aug 29, 2019 at 7:09 PM Michael Duffy 

wrote:



Is there a simple tool that will show bandwidth utilization to and from
the Tomcat server?

I am looking for something that will provide an exact byte count of the
TCP/IP packets.

I would have thought this would be an easy find; however, after hours of
Googling around I have not yet been successful.

There are some options here:
https://www.comparitech.com/net-admin/free-bandwidth-monitoring-tools/

,but

none of them specifically mention integration with Tomcat.

At the application level, if I just measure the byte flow into and out

of

my application, I will miss the bytes in the TCP/IP headers.

Any suggestions would be greatly appreciated.

Thx.

Mike










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



Re: Tomcat Bandwidth Utilization Tool

2019-08-30 Thread Michael Duffy
 What problem are you trying to solve?

Bandwidth requirements for a data intensive web application?

On Fri, Aug 30, 2019 at 9:22 AM calder  wrote:

> On Thursday, August 29, 2019, Michael Duffy  wrote:
>
> > Is there a simple tool that will show bandwidth utilization to and from
> > the Tomcat server?
> >
> > I am looking for something that will provide an exact byte count of the
> > TCP/IP packets.
> >
> > I would have thought this would be an easy find; however, after hours of
> > Googling around I have not yet been successful.
> >
> > There are some options here:
> > https://www.comparitech.com/net-admin/free-bandwidth-monitoring-tools/
> > ,but none of them specifically mention integration with Tomcat.
> >
> > At the application level, if I just measure the byte flow into and out of
> > my application, I will miss the bytes in the TCP/IP headers.
> >
> > Any suggestions would be greatly appreciated.
> >
>
>
> What problem are you trying to solve?
>


Re: Tomcat Bandwidth Utilization Tool

2019-08-30 Thread calder
On Thursday, August 29, 2019, Michael Duffy  wrote:

> Is there a simple tool that will show bandwidth utilization to and from
> the Tomcat server?
>
> I am looking for something that will provide an exact byte count of the
> TCP/IP packets.
>
> I would have thought this would be an easy find; however, after hours of
> Googling around I have not yet been successful.
>
> There are some options here:
> https://www.comparitech.com/net-admin/free-bandwidth-monitoring-tools/
> ,but none of them specifically mention integration with Tomcat.
>
> At the application level, if I just measure the byte flow into and out of
> my application, I will miss the bytes in the TCP/IP headers.
>
> Any suggestions would be greatly appreciated.
>


What problem are you trying to solve?


Re: Tomcat Bandwidth Utilization Tool

2019-08-30 Thread Michael Duffy
Thx Guido.

I would appreciate more details.

You could post them as a reply to this email or if you are on StackOverflow
I will post the question there.  I think your answer would get a lot of up
votes.

Mike

On Fri, Aug 30, 2019 at 6:01 AM Jäkel, Guido  wrote:

> Dear Michael,
>
> you may read the statistic values provided by the Connector (and others
> like busy works, load, heap usage or even the request scoreboard) via JXM
> or even (by help of the JMX Proxy Servlet) via HTTP. You may contact me if
> you need more advice.
>
> greetings
>
> Guido
>
> >-Original Message-
> >From: Michael Duffy [mailto:mduffy...@gmail.com]
> >Sent: Friday, August 30, 2019 2:36 AM
> >To: users@tomcat.apache.org
> >Subject: Re: Tomcat Bandwidth Utilization Tool
> >
> >There is a " Bytes received: 0.00 MB Bytes sent: 12.03 MB" in the Tomcat
> >Manager; however, the received count does not change and the sent count
> >seems low.
> >
> >On Thu, Aug 29, 2019 at 7:09 PM Michael Duffy 
> wrote:
> >
> >> Is there a simple tool that will show bandwidth utilization to and from
> >> the Tomcat server?
> >>
> >> I am looking for something that will provide an exact byte count of the
> >> TCP/IP packets.
> >>
> >> I would have thought this would be an easy find; however, after hours of
> >> Googling around I have not yet been successful.
> >>
> >> There are some options here:
> >> https://www.comparitech.com/net-admin/free-bandwidth-monitoring-tools/
> ,but
> >> none of them specifically mention integration with Tomcat.
> >>
> >> At the application level, if I just measure the byte flow into and out
> of
> >> my application, I will miss the bytes in the TCP/IP headers.
> >>
> >> Any suggestions would be greatly appreciated.
> >>
> >> Thx.
> >>
> >> Mike
> >>
> >>
> >>
>


RE: Tomcat Bandwidth Utilization Tool

2019-08-30 Thread Jäkel , Guido
Dear Michael,

you may read the statistic values provided by the Connector (and others like 
busy works, load, heap usage or even the request scoreboard) via JXM or even 
(by help of the JMX Proxy Servlet) via HTTP. You may contact me if you need 
more advice.

greetings

Guido

>-Original Message-
>From: Michael Duffy [mailto:mduffy...@gmail.com]
>Sent: Friday, August 30, 2019 2:36 AM
>To: users@tomcat.apache.org
>Subject: Re: Tomcat Bandwidth Utilization Tool
>
>There is a " Bytes received: 0.00 MB Bytes sent: 12.03 MB" in the Tomcat
>Manager; however, the received count does not change and the sent count
>seems low.
>
>On Thu, Aug 29, 2019 at 7:09 PM Michael Duffy  wrote:
>
>> Is there a simple tool that will show bandwidth utilization to and from
>> the Tomcat server?
>>
>> I am looking for something that will provide an exact byte count of the
>> TCP/IP packets.
>>
>> I would have thought this would be an easy find; however, after hours of
>> Googling around I have not yet been successful.
>>
>> There are some options here:
>> https://www.comparitech.com/net-admin/free-bandwidth-monitoring-tools/ ,but
>> none of them specifically mention integration with Tomcat.
>>
>> At the application level, if I just measure the byte flow into and out of
>> my application, I will miss the bytes in the TCP/IP headers.
>>
>> Any suggestions would be greatly appreciated.
>>
>> Thx.
>>
>> Mike
>>
>>
>>


Re: Lost my CCS and resources with mod_proxy and Tomcat

2019-08-30 Thread Mark Thomas
On 29/08/2019 23:49, Edwin Quijada wrote:
> Hi!
> I have an application developed with Grails3 and Postgres, my app runs fine 
> in the port 8084 , https://server:8084/app now I am trying to put an apache 
> proxy with mod_proxy but I have an weird error
> The app load but doesnt load the resources, CSS and JavaScript, so the app 
> looks useless
> 
> [configuration for proxy]
> 
> 
> 
> ProxyPreserveHost on
> RequestHeader set X-Forwarded-Proto https
> RequestHeader set X-Forwarded-Port 443
> 
> ProxyPass /me  http://localhost:8084/menuapp/login
> ProxyPassReverse /me http://localhost:8084/menuapp/login
> 
>   
> 
> 
> 
> The app doesnt have any css or javascritp code
> 
> Any cluees about this ?

Changing the context path (/me -> /menuapp/login) is rarely as simple as
adding ProxyPass and ProxyPassReverse.

In the past I have spent days with a customer trying to fix all the
issues this created for just one of their applications.

My very strong recommendations in this area are:

1. Make sure the web application deployed to Tomcat works correctly
regardless of the context path it is deployed to. i.e. don't hard-code
the context path anywhere and ensure it works for ROOT and multi-level
contexts.

2. Never change the context path to a web application in a reverse proxy.

3. If you want to have an identifier in the WAR's file name but don't
want the identifier in the context path (since the path is derived from
the name of the WAR file) (ab)use the parallel deployment version marker
and name your war context-path-you-want##identifier.war

Mark


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



Re: Tomcat Bandwidth Utilization Tool

2019-08-30 Thread Leon Rosenberg
MoSKito (http://www.moskito.org) does visualize the stats
from GlobalRequestProcessor:
http://burgershop-hamburg.demo.moskito.org/burgershop/moskito-inspect/mskShowProducer?pProducerId=GlobalRequestProcessor

You can see the bytes sent/received from every connector.

regards
Leon

On Fri, Aug 30, 2019 at 2:36 AM Michael Duffy  wrote:

> There is a " Bytes received: 0.00 MB Bytes sent: 12.03 MB" in the Tomcat
> Manager; however, the received count does not change and the sent count
> seems low.
>
> On Thu, Aug 29, 2019 at 7:09 PM Michael Duffy  wrote:
>
> > Is there a simple tool that will show bandwidth utilization to and from
> > the Tomcat server?
> >
> > I am looking for something that will provide an exact byte count of the
> > TCP/IP packets.
> >
> > I would have thought this would be an easy find; however, after hours of
> > Googling around I have not yet been successful.
> >
> > There are some options here:
> > https://www.comparitech.com/net-admin/free-bandwidth-monitoring-tools/
> ,but
> > none of them specifically mention integration with Tomcat.
> >
> > At the application level, if I just measure the byte flow into and out of
> > my application, I will miss the bytes in the TCP/IP headers.
> >
> > Any suggestions would be greatly appreciated.
> >
> > Thx.
> >
> > Mike
> >
> >
> >
>