You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@livy.apache.org by "Soumyadeep Roy (Jira)" <ji...@apache.org> on 2026/09/17 06:32:00 UTC
[jira] [Created] (LIVY-1083) Coerce batch/session Int fields sent as JSON strings (avoid opaque 500s)
Soumyadeep Roy created LIVY-1083:
------------------------------------
Summary: Coerce batch/session Int fields sent as JSON strings (avoid opaque 500s)
Key: LIVY-1083
URL: https://issues.apache.org/jira/browse/LIVY-1083
Project: Livy
Issue Type: Bug
Reporter: Soumyadeep Roy
CreateBatchRequest and CreateInteractiveRequest declare driverCores, executorCores and numExecutors as Option[Int]. Because of Scala type erasure, Option[Int] erases to Option[Object], so jackson-module-scala cannot tell the element type is Integer. When a client sends one of these fields as a JSON string (e.g. "4" instead of 4), Jackson stores it verbatim as Some("4") without error. The bad value only surfaces later as a ClassCastException when the code unboxes it to Int while building the Spark submit command (e.g. BatchSession.createSparkApp), which the servlet returns to callers as an opaque HTTP 500.
Fix: annotate the three fields on both request classes with @JsonDeserialize(contentAs = classOf[java.lang.Integer]) so Jackson coerces numeric strings to Int during deserialization, and rejects truly non-numeric strings with a client-facing 400 (JsonMappingException) instead of a 500 later in app creation.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)