Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1E74611351 for ; Sun, 6 Jul 2014 16:40:34 +0000 (UTC) Received: (qmail 17286 invoked by uid 500); 6 Jul 2014 16:40:34 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 17245 invoked by uid 500); 6 Jul 2014 16:40:34 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 17229 invoked by uid 99); 6 Jul 2014 16:40:34 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Jul 2014 16:40:34 +0000 Date: Sun, 6 Jul 2014 16:40:34 +0000 (UTC) From: "Sylvain Mougenot (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CXF-5837) Upload size limit status 500 for files twice bigger than the limit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CXF-5837?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14053148#comment-14053148 ] Sylvain Mougenot commented on CXF-5837: --------------------------------------- Thank you for your efforts Sergey and your hints Daniel. I'm impressed you fixed it so fast ! cool I will give it a try as soon as possible. Great job! > Upload size limit status 500 for files twice bigger than the limit > ------------------------------------------------------------------ > > Key: CXF-5837 > URL: https://issues.apache.org/jira/browse/CXF-5837 > Project: CXF > Issue Type: Bug > Components: JAX-RS > Affects Versions: 2.7.11 > Environment: Java 7, Tomcat 7 > Reporter: Sylvain Mougenot > Assignee: Sergey Beryozkin > Fix For: 2.7.12, 3.0.1 > > > I'm using cxf to manage uploads within jax-rs application. > I used system properties to adjust behaviour on upload in order to limit size to 10MB (10 * 1024 * 1024 = .10 485 760) > {code} > java .... > -Dorg.apache.cxf.io.CachedOutputStream.Threshold=102400 > -Dorg.apache.cxf.io.CachedOutputStream.OutputDirectory=/temp/upload > -Dorg.apache.cxf.io.CachedOutputStream.MaxSize=10485760 > ... > {code} > This works fine if the user send *files a little too big* (11MB for exemple) : \\ client gets the http *status 413*. > But if the sent file is more than *twice bigger* than the limit (21MB for exemple) it fails :\\ > client gets the http *status 500*. > The reason why seems to be in *org.apache.cxf.transport.http.AbstractHTTPDestination#cacheInput*. > In my opinion, before writing the response out, this method is responsible for reading the remains of the request. > But it does it the same way as when it tried to read attachement file : with size limitations. Because the remaining datas are again bigger than the limit (the file is more than twice too big) have an error. > Maybe, > * It would be nice to detect the status 413 (already set for the response). > So that we could just consume the data (without caching it at all). > * It would also be nice no to limit this consuming to a multiple of the value "MaxSize" setting, not a hard coded 16MB. See code line 549 : IOUtils.consume(in, 16 * 1024 * 1024) ;) > Sory, > I would have liked to submit a pullrequest (or patch) but I've no idea how to find the status code inside the argument (Message outMessage). -- This message was sent by Atlassian JIRA (v6.2#6252)