Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-17906

Camel REST - Multipart REST service broken in Camel 3.12+

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Workaround
    • 3.12.0, 3.14.2
    • None
    • camel-servlet
    • None
    • Unknown

    Description

      After upgrading from Camel 3.11.5 to Camel 3.12.0, we experience a regression in a REST service that consumes multipart/form-data.
      (Camel REST + Camel servlet + Tomcat + Spring Boot 2.6.4 + Spring Security + OAuth2)
      When retrieving the binary attachment stored as an InputStream in the message body, the attachment is empty:
       

      byte[] content = IOUtils.toByteArray(e.getIn().getBody(InputStream.class)) <-- empty byte array 
      • The only code change is the upgrade from Camel 3.11.5 to 3.12
      • When disabling the OAuth2 authentication/authorization layer, the REST service works as expected.
      • Tested with Camel 3.14.2 with the same outcome
      • possibly related to CAMEL-17004

      stacktrace with OAuth2 enabled:

      convertBodyToFileItems:97, FileUploadRouteBuilder (no.rutebanken.marduk.routes.file)
      process:-1, 382032327 (no.rutebanken.marduk.routes.file.FileUploadRouteBuilder$$Lambda$1784)
      process:66, DelegateSyncProcessor (org.apache.camel.support.processor)
      doRun:810, RedeliveryErrorHandler$RedeliveryTask (org.apache.camel.processor.errorhandler)
      run:718, RedeliveryErrorHandler$RedeliveryTask (org.apache.camel.processor.errorhandler)
      schedule:179, DefaultReactiveExecutor$Worker (org.apache.camel.impl.engine)
      scheduleSync:69, DefaultReactiveExecutor (org.apache.camel.impl.engine)
      process:214, RedeliveryErrorHandler (org.apache.camel.processor.errorhandler)
      access$201:45, TransactionErrorHandler (org.apache.camel.spring.spi)
      process:247, TransactionErrorHandler$2 (org.apache.camel.spring.spi)
      process:83, DefaultAsyncProcessorAwaitManager (org.apache.camel.impl.engine)
      processByErrorHandler:244, TransactionErrorHandler (org.apache.camel.spring.spi)
      doInTransactionWithoutResult:207, TransactionErrorHandler$1 (org.apache.camel.spring.spi)
      doInTransaction:36, TransactionCallbackWithoutResult (org.springframework.transaction.support)
      execute:140, TransactionTemplate (org.springframework.transaction.support)
      doInTransactionTemplate:200, TransactionErrorHandler (org.apache.camel.spring.spi)
      processInTransaction:155, TransactionErrorHandler (org.apache.camel.spring.spi)
      process:123, TransactionErrorHandler (org.apache.camel.spring.spi)
      process:132, TransactionErrorHandler (org.apache.camel.spring.spi)
      process:399, CamelInternalProcessor (org.apache.camel.impl.engine)
      run:109, Pipeline$PipelineTask (org.apache.camel.processor)
      schedule:179, DefaultReactiveExecutor$Worker (org.apache.camel.impl.engine)
      scheduleMain:64, DefaultReactiveExecutor (org.apache.camel.impl.engine)
      process:184, Pipeline (org.apache.camel.processor)
      process:399, CamelInternalProcessor (org.apache.camel.impl.engine)
      process:83, DefaultAsyncProcessorAwaitManager (org.apache.camel.impl.engine)
      process:41, AsyncProcessorSupport (org.apache.camel.support)
      doExecute:319, CamelServlet (org.apache.camel.http.common)
      doService:214, CamelServlet (org.apache.camel.http.common)
      service:130, CamelServlet (org.apache.camel.http.common)
      service:764, HttpServlet (javax.servlet.http)
      internalDoFilter:227, ApplicationFilterChain (org.apache.catalina.core)
      doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
      doFilter:53, WsFilter (org.apache.tomcat.websocket.server)
      internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
      doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
      doFilter:327, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      invoke:115, FilterSecurityInterceptor (org.springframework.security.web.access.intercept)
      doFilter:81, FilterSecurityInterceptor (org.springframework.security.web.access.intercept)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilter:122, ExceptionTranslationFilter (org.springframework.security.web.access)
      doFilter:116, ExceptionTranslationFilter (org.springframework.security.web.access)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilter:126, SessionManagementFilter (org.springframework.security.web.session)
      doFilter:81, SessionManagementFilter (org.springframework.security.web.session)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilterInternal:168, OAuth2AuthorizationCodeGrantFilter (org.springframework.security.oauth2.client.web)
      doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilter:109, AnonymousAuthenticationFilter (org.springframework.security.web.authentication)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilter:149, SecurityContextHolderAwareRequestFilter (org.springframework.security.web.servletapi)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilter:63, RequestCacheAwareFilter (org.springframework.security.web.savedrequest)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilterInternal:137, BearerTokenAuthenticationFilter (org.springframework.security.oauth2.server.resource.web)
      doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilterInternal:178, OAuth2AuthorizationRequestRedirectFilter (org.springframework.security.oauth2.client.web)
      doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilter:103, LogoutFilter (org.springframework.security.web.authentication.logout)
      doFilter:89, LogoutFilter (org.springframework.security.web.authentication.logout)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilterInternal:91, CorsFilter (org.springframework.web.filter)
      doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doHeadersAfter:90, HeaderWriterFilter (org.springframework.security.web.header)
      doFilterInternal:75, HeaderWriterFilter (org.springframework.security.web.header)
      doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilter:110, SecurityContextPersistenceFilter (org.springframework.security.web.context)
      doFilter:80, SecurityContextPersistenceFilter (org.springframework.security.web.context)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilterInternal:55, WebAsyncManagerIntegrationFilter (org.springframework.security.web.context.request.async)
      doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilterInternal:211, FilterChainProxy (org.springframework.security.web)
      doFilter:183, FilterChainProxy (org.springframework.security.web)
      invokeDelegate:354, DelegatingFilterProxy (org.springframework.web.filter)
      doFilter:267, DelegatingFilterProxy (org.springframework.web.filter)
      internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
      doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
      doFilterInternal:100, RequestContextFilter (org.springframework.web.filter)
      doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
      internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
      doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
      doFilterInternal:93, FormContentFilter (org.springframework.web.filter)
      doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
      internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
      doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
      doFilterInternal:96, WebMvcMetricsFilter (org.springframework.boot.actuate.metrics.web.servlet)
      doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
      internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
      doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
      doFilterInternal:201, CharacterEncodingFilter (org.springframework.web.filter)
      doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
      internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
      doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
      invoke:197, StandardWrapperValve (org.apache.catalina.core)
      invoke:97, StandardContextValve (org.apache.catalina.core)
      invoke:540, AuthenticatorBase (org.apache.catalina.authenticator)
      invoke:135, StandardHostValve (org.apache.catalina.core)
      invoke:92, ErrorReportValve (org.apache.catalina.valves)
      invoke:78, StandardEngineValve (org.apache.catalina.core)
      service:359, CoyoteAdapter (org.apache.catalina.connector)
      service:399, Http11Processor (org.apache.coyote.http11)
      process:65, AbstractProcessorLight (org.apache.coyote)
      process:889, AbstractProtocol$ConnectionHandler (org.apache.coyote)
      doRun:1735, NioEndpoint$SocketProcessor (org.apache.tomcat.util.net)
      run:49, SocketProcessorBase (org.apache.tomcat.util.net)
      runWorker:1191, ThreadPoolExecutor (org.apache.tomcat.util.threads)
      run:659, ThreadPoolExecutor$Worker (org.apache.tomcat.util.threads)
      run:61, TaskThread$WrappingRunnable (org.apache.tomcat.util.threads)
      run:829, Thread (java.lang)

      stacktrace without OAuth2:

      convertBodyToFileItems:96, FileUploadRouteBuilder (no.rutebanken.marduk.routes.file)
      process:-1, 902585205 (no.rutebanken.marduk.routes.file.FileUploadRouteBuilder$$Lambda$1780)
      process:66, DelegateSyncProcessor (org.apache.camel.support.processor)
      doRun:810, RedeliveryErrorHandler$RedeliveryTask (org.apache.camel.processor.errorhandler)
      run:718, RedeliveryErrorHandler$RedeliveryTask (org.apache.camel.processor.errorhandler)
      schedule:179, DefaultReactiveExecutor$Worker (org.apache.camel.impl.engine)
      scheduleSync:69, DefaultReactiveExecutor (org.apache.camel.impl.engine)
      process:214, RedeliveryErrorHandler (org.apache.camel.processor.errorhandler)
      access$201:45, TransactionErrorHandler (org.apache.camel.spring.spi)
      process:247, TransactionErrorHandler$2 (org.apache.camel.spring.spi)
      process:83, DefaultAsyncProcessorAwaitManager (org.apache.camel.impl.engine)
      processByErrorHandler:244, TransactionErrorHandler (org.apache.camel.spring.spi)
      doInTransactionWithoutResult:207, TransactionErrorHandler$1 (org.apache.camel.spring.spi)
      doInTransaction:36, TransactionCallbackWithoutResult (org.springframework.transaction.support)
      execute:140, TransactionTemplate (org.springframework.transaction.support)
      doInTransactionTemplate:200, TransactionErrorHandler (org.apache.camel.spring.spi)
      processInTransaction:155, TransactionErrorHandler (org.apache.camel.spring.spi)
      process:123, TransactionErrorHandler (org.apache.camel.spring.spi)
      process:132, TransactionErrorHandler (org.apache.camel.spring.spi)
      process:399, CamelInternalProcessor (org.apache.camel.impl.engine)
      run:109, Pipeline$PipelineTask (org.apache.camel.processor)
      schedule:179, DefaultReactiveExecutor$Worker (org.apache.camel.impl.engine)
      scheduleMain:64, DefaultReactiveExecutor (org.apache.camel.impl.engine)
      process:184, Pipeline (org.apache.camel.processor)
      process:399, CamelInternalProcessor (org.apache.camel.impl.engine)
      process:83, DefaultAsyncProcessorAwaitManager (org.apache.camel.impl.engine)
      process:41, AsyncProcessorSupport (org.apache.camel.support)
      doExecute:319, CamelServlet (org.apache.camel.http.common)
      doService:214, CamelServlet (org.apache.camel.http.common)
      service:130, CamelServlet (org.apache.camel.http.common)
      service:764, HttpServlet (javax.servlet.http)
      internalDoFilter:227, ApplicationFilterChain (org.apache.catalina.core)
      doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
      doFilter:53, WsFilter (org.apache.tomcat.websocket.server)
      internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
      doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
      doFilter:327, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      invoke:115, FilterSecurityInterceptor (org.springframework.security.web.access.intercept)
      doFilter:81, FilterSecurityInterceptor (org.springframework.security.web.access.intercept)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilter:122, ExceptionTranslationFilter (org.springframework.security.web.access)
      doFilter:116, ExceptionTranslationFilter (org.springframework.security.web.access)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilter:126, SessionManagementFilter (org.springframework.security.web.session)
      doFilter:81, SessionManagementFilter (org.springframework.security.web.session)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilter:109, AnonymousAuthenticationFilter (org.springframework.security.web.authentication)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilter:149, SecurityContextHolderAwareRequestFilter (org.springframework.security.web.servletapi)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilter:63, RequestCacheAwareFilter (org.springframework.security.web.savedrequest)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilter:103, LogoutFilter (org.springframework.security.web.authentication.logout)
      doFilter:89, LogoutFilter (org.springframework.security.web.authentication.logout)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doHeadersAfter:90, HeaderWriterFilter (org.springframework.security.web.header)
      doFilterInternal:75, HeaderWriterFilter (org.springframework.security.web.header)
      doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilter:110, SecurityContextPersistenceFilter (org.springframework.security.web.context)
      doFilter:80, SecurityContextPersistenceFilter (org.springframework.security.web.context)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilterInternal:55, WebAsyncManagerIntegrationFilter (org.springframework.security.web.context.request.async)
      doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
      doFilter:336, FilterChainProxy$VirtualFilterChain (org.springframework.security.web)
      doFilterInternal:211, FilterChainProxy (org.springframework.security.web)
      doFilter:183, FilterChainProxy (org.springframework.security.web)
      invokeDelegate:354, DelegatingFilterProxy (org.springframework.web.filter)
      doFilter:267, DelegatingFilterProxy (org.springframework.web.filter)
      internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
      doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
      doFilterInternal:100, RequestContextFilter (org.springframework.web.filter)
      doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
      internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
      doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
      doFilterInternal:93, FormContentFilter (org.springframework.web.filter)
      doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
      internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
      doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
      doFilterInternal:96, WebMvcMetricsFilter (org.springframework.boot.actuate.metrics.web.servlet)
      doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
      internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
      doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
      doFilterInternal:201, CharacterEncodingFilter (org.springframework.web.filter)
      doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
      internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
      doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
      invoke:197, StandardWrapperValve (org.apache.catalina.core)
      invoke:97, StandardContextValve (org.apache.catalina.core)
      invoke:540, AuthenticatorBase (org.apache.catalina.authenticator)
      invoke:135, StandardHostValve (org.apache.catalina.core)
      invoke:92, ErrorReportValve (org.apache.catalina.valves)
      invoke:78, StandardEngineValve (org.apache.catalina.core)
      service:359, CoyoteAdapter (org.apache.catalina.connector)
      service:399, Http11Processor (org.apache.coyote.http11)
      process:65, AbstractProcessorLight (org.apache.coyote)
      process:889, AbstractProtocol$ConnectionHandler (org.apache.coyote)
      doRun:1735, NioEndpoint$SocketProcessor (org.apache.tomcat.util.net)
      run:49, SocketProcessorBase (org.apache.tomcat.util.net)
      runWorker:1191, ThreadPoolExecutor (org.apache.tomcat.util.threads)
      run:659, ThreadPoolExecutor$Worker (org.apache.tomcat.util.threads)
      run:61, TaskThread$WrappingRunnable (org.apache.tomcat.util.threads)
      run:829, Thread (java.lang)

      Attachments

        Activity

          People

            Unassigned Unassigned
            vpaturet Vincent Paturet
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: