thanks for  your reply

> -----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?
>

yes

>> 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?
>
Also the size I am getting on tomcat  from sending the same file varies
(around 40-50 K). It is look like possible read  timeout or what?.


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

What is that stuff up there?
this is jersey REST API     annotation @PUT

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

sorry, cut code too much ..., I have normal loop:

 while ((len = digestInputStream.read(buf)) != -1) {
                                        byteArrayOutputStream.write(buf, 0, 
len);
                                    }

> 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?
>

yes,
the program continue to execute with truncated stream.

>>
>> 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?
>

Apache sends chunk  of 4194304 in size, I was experimenting on effect of
buffer size on this situation. But no difference as only silly buffer
size.  I installed tomcat 7, but it is the same.


>> 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.
>
So no any restriction on PUT ?
I do not have content-type since it is our own  combinations of headers
and binary stream.

>> 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

Yes, packages are sent by apache client untill eof,  no socket problem
reported. And it works for binary and text. And the input stream I am
getting  from request in tomcat  already truncated  for some longer
lasting requests.



> -----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
>
>


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

Reply via email to