You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Graeme Dougal <gr...@tiderian.com> on 2014/04/30 09:01:46 UTC
Large data stream caching - Causing Truncated Response
Hi
When a response payload is greater than the default 64k it will be cached
to disk in a temp file in systems temp directory.
Faced an issue for the above where logging was switched on via the cxf:bus
spring config and our environments java.io.tmp dir had no space allocated
to it due to locked down environment setup.
The CXF code actually hangs in the *org.apache.cxf.helpers.FileUtils* class
in the *public static File createTempFile(String prefix, String suffix,
File parentDir,*
* boolean deleteOnExit) throws
IOException *method
where it calls *getDefaultTempDir()*
The thread itself just hangs and the client receives a truncated response
from the REST service. With logging switched off or the
*org.apache.cxf.io.CachedOutputStream.OutputDirectory* property overridden
then everything works fine..
--
Regards
Graeme Dougal
Tiderian Consulting
Office :+44(191) 215 16 50
Mobile : +44(0) 7860 950 815
Email : graeme@tiderian.com
Web : www.tiderian.com
Tiderian Consulting is the trading name of Tiderian Consulting Ltd
registered in England No. 6024579
Registered Office Address : 31 Cloverdale Gardens, High Heaton, Newcastle
Upon Tyne, NE7 7QJ
Re: Large data stream caching - Causing Truncated Response
Posted by Daniel Kulp <dk...@apache.org>.
We’ve been calling canWrite() on the File object representing the directory for a long time, so I’m a bit surprised. I guess in your case, it is writable, but there isn’t space. Interesting.
I’ve just added a couple more checks in there. First, if there is less than 1MB of “usable space” (File.getUsableSpace()) it will now log a warning. Next, instead of looping indefinitely trying to create a new directory, we’ll just make 10000 attempts (which seems high, but should be fairly quick) and if that fails, throw an exception.
That said, with CXF 3.0, this particular case (Logging interceptors) wouldn’t result in anything being buffered on disk as the default for the caching is raised to 128K and default for message size logged is reduced to 32K and the interceptors have been further optimized to only load the 32K needed for logging.
Dan
On Apr 30, 2014, at 3:01 AM, Graeme Dougal <gr...@tiderian.com> wrote:
> Hi
>
> When a response payload is greater than the default 64k it will be cached
> to disk in a temp file in systems temp directory.
>
> Faced an issue for the above where logging was switched on via the cxf:bus
> spring config and our environments java.io.tmp dir had no space allocated
> to it due to locked down environment setup.
>
> The CXF code actually hangs in the *org.apache.cxf.helpers.FileUtils* class
> in the *public static File createTempFile(String prefix, String suffix,
> File parentDir,*
> * boolean deleteOnExit) throws
> IOException *method
> where it calls *getDefaultTempDir()*
>
> The thread itself just hangs and the client receives a truncated response
> from the REST service. With logging switched off or the
> *org.apache.cxf.io.CachedOutputStream.OutputDirectory* property overridden
> then everything works fine..
>
> --
> Regards
>
> Graeme Dougal
>
> Tiderian Consulting
>
> Office :+44(191) 215 16 50
> Mobile : +44(0) 7860 950 815
>
> Email : graeme@tiderian.com
> Web : www.tiderian.com
>
> Tiderian Consulting is the trading name of Tiderian Consulting Ltd
> registered in England No. 6024579
>
> Registered Office Address : 31 Cloverdale Gardens, High Heaton, Newcastle
> Upon Tyne, NE7 7QJ
--
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com