Petals BC REST

Error "org.apache.http.ContentTooLongException: Content length is too long" on multipart HTTP request

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 2.2.0-BC
  • Fix Version/s: 2.2.1-BC
  • Component/s: Provider mode
  • Security Level: Public
  • Description:
    Hide

    The following error occurs sending a file as a part in a multipart HTTP Rest request:

    org.apache.http.ContentTooLongException: Content length is too long: 768909
        at org.apache.http.entity.mime.MultipartFormEntity.getContent(MultipartFormEntity.java:103)
        at org.apache.http.nio.entity.EntityAsyncContentProducer.produceContent(EntityAsyncContentProducer.java:65)
        at org.apache.http.nio.protocol.BasicAsyncRequestProducer.produceContent(BasicAsyncRequestProducer.java:125)
        at org.apache.http.impl.nio.client.MainClientExec.produceContent(MainClientExec.java:262)
        at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.produceContent(DefaultClientExchangeHandlerImpl.java:140)
        at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.outputReady(HttpAsyncRequestExecutor.java:241)
        at org.apache.http.impl.nio.DefaultNHttpClientConnection.produceOutput(DefaultNHttpClientConnection.java:290)
        at org.apache.http.impl.nio.client.InternalIODispatch.onOutputReady(InternalIODispatch.java:86)
        at org.apache.http.impl.nio.client.InternalIODispatch.onOutputReady(InternalIODispatch.java:39)
        at org.apache.http.impl.nio.reactor.AbstractIODispatch.outputReady(AbstractIODispatch.java:145)
        at org.apache.http.impl.nio.reactor.BaseIOReactor.writable(BaseIOReactor.java:188)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:341)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
        at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
        at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:588)
        at java.lang.Thread.run(Thread.java:748)
    Show
    The following error occurs sending a file as a part in a multipart HTTP Rest request:
    org.apache.http.ContentTooLongException: Content length is too long: 768909
        at org.apache.http.entity.mime.MultipartFormEntity.getContent(MultipartFormEntity.java:103)
        at org.apache.http.nio.entity.EntityAsyncContentProducer.produceContent(EntityAsyncContentProducer.java:65)
        at org.apache.http.nio.protocol.BasicAsyncRequestProducer.produceContent(BasicAsyncRequestProducer.java:125)
        at org.apache.http.impl.nio.client.MainClientExec.produceContent(MainClientExec.java:262)
        at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.produceContent(DefaultClientExchangeHandlerImpl.java:140)
        at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.outputReady(HttpAsyncRequestExecutor.java:241)
        at org.apache.http.impl.nio.DefaultNHttpClientConnection.produceOutput(DefaultNHttpClientConnection.java:290)
        at org.apache.http.impl.nio.client.InternalIODispatch.onOutputReady(InternalIODispatch.java:86)
        at org.apache.http.impl.nio.client.InternalIODispatch.onOutputReady(InternalIODispatch.java:39)
        at org.apache.http.impl.nio.reactor.AbstractIODispatch.outputReady(AbstractIODispatch.java:145)
        at org.apache.http.impl.nio.reactor.BaseIOReactor.writable(BaseIOReactor.java:188)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:341)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
        at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
        at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:588)
        at java.lang.Thread.run(Thread.java:748)
  • Environment:
    -

Activity

Hide
Christophe DENEUX added a comment - Wed, 14 Apr 2021 - 10:34:46 +0200

This error is due to a limitation of Apache HTTP Client that limit the size of a multupart to 25Ko, see org.apache.http.entity.mime.MultipartFormEntity#getContent().
No explanation was found about this limitation.

A workaround should be included to remove this limitation.

Show
Christophe DENEUX added a comment - Wed, 14 Apr 2021 - 10:34:46 +0200 This error is due to a limitation of Apache HTTP Client that limit the size of a multupart to 25Ko, see org.apache.http.entity.mime.MultipartFormEntity#getContent(). No explanation was found about this limitation. A workaround should be included to remove this limitation.
Hide
Christophe DENEUX added a comment - Wed, 14 Apr 2021 - 10:47:12 +0200

Fixed in branch 'petals-bc-rest-1.3.x'

Show
Christophe DENEUX added a comment - Wed, 14 Apr 2021 - 10:47:12 +0200 Fixed in branch 'petals-bc-rest-1.3.x'
Hide
Christophe DENEUX added a comment - Wed, 14 Apr 2021 - 10:47:24 +0200

Reopened to be merged in trunk

Show
Christophe DENEUX added a comment - Wed, 14 Apr 2021 - 10:47:24 +0200 Reopened to be merged in trunk
Hide
Christophe DENEUX added a comment - Wed, 14 Apr 2021 - 10:55:08 +0200

Merged in trunk

Show
Christophe DENEUX added a comment - Wed, 14 Apr 2021 - 10:55:08 +0200 Merged in trunk

People

Dates

  • Created:
    Wed, 14 Apr 2021 - 10:32:53 +0200
    Updated:
    Wed, 14 Apr 2021 - 10:55:08 +0200
    Resolved:
    Wed, 14 Apr 2021 - 10:55:08 +0200