You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2026/09/02 17:14:00 UTC
[jira] [Commented] (CAMEL-24594) RestBindingAdvice response marshalling failure is silently swallowed
[ https://issues.apache.org/jira/browse/CAMEL-24594?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18110761#comment-18110761 ]
Claus Ibsen commented on CAMEL-24594:
-------------------------------------
h4. Investigation finding: core platform-http already returns 500 (not a silent 200)
I could not reproduce the silent HTTP 200 on core Apache Camel {{camel-platform-http-vertx}}. A simulated reproducer (REST DSL {{bindingMode(json)}}, a response POJO whose getter throws so Jackson always fails to marshal, independent of java.time/JavaTimeModule) shows core Camel returns *HTTP 500 with an empty body* - which is the correct/desired behaviour (empty because {{muteException}} is enabled by default, so nothing is leaked).
Why it works in core:
* {{MarshalProcessor}} sets the exception on the exchange when marshalling fails.
* {{org.apache.camel.support.http.HttpUtil#determineResponseCode}} (in *core/camel-support*) maps {{exchange.isFailed()}} -> 500. This is shared by *all* core HTTP consumers: camel-platform-http-vertx, camel-netty-http, camel-http-common (servlet/jetty), camel-undertow.
* Both pieces of logic were already present in the *camel-4.22.0* tag that the reporter tested.
A second test disables {{muteException}} and asserts the leaked stacktrace contains {{RestBindingAdvice}} + {{MarshalProcessor}} + the getter's message, proving the 500 originates specifically in the REST DSL binding's response-marshal step (which runs after routing, so it is intentionally not routed through onException).
Conclusion: the silent-200 reported in camel-quarkus#9077 appears to be *camel-quarkus specific* - its platform-http integration ({{QuarkusPlatformHttpConsumer}}) has its own response-writing path that does not go through {{HttpUtil#determineResponseCode}} / does not honour {{isFailed()}} for this post-routing exception.
Suggested next steps:
# Track the actual HTTP-200 defect in camel-quarkus#9077 (their consumer), plus the separate {{autoDiscoverObjectMapper}} default discussion there.
# Optionally harden {{RestBindingAdvice#marshal}} to set {{HTTP_RESPONSE_CODE=500}} explicitly on marshal failure (mirroring the existing 400-on-request-failure precedent), so every consumer is robust regardless of whether it inspects {{isFailed()}}. This does not change the core vertx result (already 500).
Regression guard tests added at {{camel-platform-http-vertx/.../VertxRestBindingMarshalFailureTest}}.
_Analysis and tests by Claude Code on behalf of Claus Ibsen (davsclaus). Please verify before acting._
> RestBindingAdvice response marshalling failure is silently swallowed
> --------------------------------------------------------------------
>
> Key: CAMEL-24594
> URL: https://issues.apache.org/jira/browse/CAMEL-24594
> Project: Camel
> Issue Type: Bug
> Reporter: James Netherton
> Priority: Minor
> Fix For: 4.23.0
>
>
> With bindingMode(json) on the REST DSL, if Jackson cannot marshal the response body, the caller receives HTTP 200 with an empty body and Content-Type: text/plain; charset=utf-8. No error is logged, no exception reaches the route's error handler, and the status code stays 200.
> The silent 200 is the actual problem: a serialization failure is indistinguishable from a successful empty response, so a client (or a browser app) just sees "no data" and everything downstream fails in confusing ways. We lost a full day to this after a platform upgrade.
> More details with reproducer can be found here:
> https://github.com/apache/camel-quarkus/issues/9077
--
This message was sent by Atlassian Jira
(v8.20.10#820010)