-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lyudmila,

On 10/18/2011 12:26 PM, Lyudmila L. Balakireva wrote:
> I am using tomcat 6.0.33, java   "1.6.0_20" and  Red Hat 4.5.1-4
> .

Thanks.

> Our application under tomcat  has put method to save data on the
> server. Data send by remote apache server  using apr socket and
> chunked encoding.

So you have Apache as a client for Tomcat?

> It is working if the files around 40K or less, but for example for
> 11M file I am not getting any errors on server, but size of input
> stream is around 40K.

So files look like they are truncated around 40K?

> @PUT Response put_data (InputStream input, @PathParam("id") String 
> url,@Context HttpServletRequest req){

What is that stuff up there?

> .... digestInputStream = new DigestInputStream( new 
> BufferedInputStream(input), hash); byte[] buffer = new byte[8192];
> 
> while (digestInputStream.read(buffer) != -1) { 
> byteArrayOutputStream.write(buffer); .. }

You have a bug in this loop: you will always write a multiple of 8192
bytes to the disk, including some garbage at the end of most files.
Consider capturing the return value from InputStream.read() and using
it in your call to OutputStream.write().

> ... } I added max-post-size-bytes="0" and  upped timeout on http
> connector but no effect.

Are there any log messages that are emitted during/after the upload?

> 
> I    <Connector port="8080" protocol="HTTP/1.1"
> socket.rxBufSize="4194304" socket.appReadBufSize="4194304"

Wow, a 4MiB socket receive buffer and a 4MiB app buffer, too? That
seems very wasteful. Note that socket.appReadBufSize is only
applicable for the NIO connector, which you haven't specified in your
configuration. Also, the "socket.*" attributes are only recognized in
Tomcat 7, not in Tomcat 6 which you are using. Are you reading the
right documentation?

> max-post-size-bytes="0"

What's wrong with "maxPostSize"?

http://tomcat.apache.org/tomcat-6.0-doc/config/ajp.html

Also, what is the "content-type" being provided to the server? If it's
anything other than application/x-www-form-urlencoded, then Tomcat
does not use maxPostSize to limit the upload. When Tomcat does veto a
POST with too much data, it logs an error ans simply does not parse
the request entity.

> connectionTimeout="60000" keepAliveTimeout="60000" 
> redirectPort="8443" />
> 
> What can cause premature close of input stream?

Are you sure it's being closed too soon? Do you have any debugging in
your own code to rule-out application error?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6d2fEACgkQ9CaO5/Lv0PDj1wCdGVSBHyevpXi9lr+rVIda2shu
1MIAnj4w5Qh2MKLII4zQ3wc/XGanUJi3
=NPv6
-----END PGP SIGNATURE-----

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

Reply via email to