diff --git a/hail/src/main/scala/is/hail/backend/Backend.scala b/hail/src/main/scala/is/hail/backend/Backend.scala index 004c31fc326..54f88f51816 100644 --- a/hail/src/main/scala/is/hail/backend/Backend.scala +++ b/hail/src/main/scala/is/hail/backend/Backend.scala @@ -27,7 +27,6 @@ import scala.reflect.ClassTag import java.io._ import java.nio.charset.StandardCharsets -import com.fasterxml.jackson.core.StreamReadConstraints import org.json4s._ import org.json4s.jackson.{JsonMethods, Serialization} @@ -55,18 +54,6 @@ trait BackendContext { } abstract class Backend { - // From https://github.com/hail-is/hail/issues/14580 : - // IR can get quite big, especially as it can contain an arbitrary - // amount of encoded literals from the user's python session. This - // was a (controversial) restriction imposed by Jackson and should be lifted. - // - // We remove this restriction for all backends, and we do so here, in the - // constructor since constructing a backend is one of the first things that - // happens and this constraint should be overrided as early as possible. - StreamReadConstraints.overrideDefaultStreamReadConstraints( - StreamReadConstraints.builder().maxStringLength(Integer.MAX_VALUE).build() - ) - val persistedIR: mutable.Map[Int, BaseIR] = mutable.Map() protected[this] def addJavaIR(ir: BaseIR): Int = { diff --git a/hail/src/main/scala/is/hail/backend/service/ServiceBackend.scala b/hail/src/main/scala/is/hail/backend/service/ServiceBackend.scala index db48887a66c..52e19fd6be3 100644 --- a/hail/src/main/scala/is/hail/backend/service/ServiceBackend.scala +++ b/hail/src/main/scala/is/hail/backend/service/ServiceBackend.scala @@ -31,10 +31,11 @@ import java.io._ import java.nio.charset.StandardCharsets import java.util.concurrent._ +import com.fasterxml.jackson.databind.DeserializationFeature.USE_BIG_INTEGER_FOR_INTS + import org.apache.log4j.Logger import org.json4s.{DefaultFormats, Formats} import org.json4s.JsonAST._ -import org.json4s.jackson.JsonMethods class ServiceBackendContext( val billingProject: String, @@ -464,7 +465,17 @@ object ServiceBackendAPI { implicit val formats: Formats = DefaultFormats - val input = using(fs.openNoCompression(inputURL))(JsonMethods.parse(_)) + val JsonFactory factory = JsonFactory.builder() + .streamReadConstraints(StreamReadConstraints.builder().maxStringLength(Integer.MAX_VALUE).build()) + .build(); + + val mapper = new ObjectMapper(factory) + mapper.registerModule(new Json4sScalaModule) + mapper.configure(USE_BIG_INTEGER_FOR_INTS, true) + + val reader = mapper.readerFor(classOf[JValue]) + val input = using(fs.openNoCompression(inputURL))(reader.readValue[JValue](_)) + val rpcConfig = (input \ "config").extract[ServiceBackendRPCPayload] // FIXME: when can the classloader be shared? (optimizer benefits!)