Hi,

Could you please provide the reproducer for that 
DelayedCachedOutputStreamCleaner expires the streams prematurely? Thank you.

Best Regards,
    Andriy Redko

On 2025/03/11 08:43:32 Ralph Bastiaansen wrote:
> Hi,
> In Apache CXF 4.1.1,  org.apache.cxf.io.DelayedCachedOutputStreamCleaner
> 
> It seems periodically all registered streams are killed, even young streams 
> that are not even a second old.
> A DelayedCloseable has expireAt value, but it isn’t checked.
> 
>         private void clean(Collection<DelayedCloseable> closeables) {
>             final Iterator<DelayedCloseable> iterator = closeables.iterator();
>             while (iterator.hasNext()) {
>                 final DelayedCloseable next = iterator.next();
>                 try {
>                     iterator.remove();
>                     LOG.warning("Unclosed (leaked?) stream detected: " + 
> next.closeable.hashCode());
>                     next.closeable.close();
>                 } catch (final IOException | RuntimeException ex) {
>                     LOG.warning("Unable to close (leaked?) stream: " + 
> ex.getMessage());
>                 }
>             }
>         }
> https://github.com/apache/cxf/blob/5aef1e4fbef4877f7e1b310e054dfb8e7af25a85/core/src/main/java/org/apache/cxf/io/DelayedCachedOutputStreamCleaner.java#L133
> 
> To reproduce the issue more quickly while testing, use bus properties
> - set "bus.io.CachedOutputStream.Threshold" to a lower value to write the 
> stream to file.
> - set "bus.io.CachedOutputStreamCleaner.Delay" to a lower value to trigger 
> the timer.
> 
> Kind regards,
> Ralph
> 

Reply via email to