0

I am attempting to query a deployed PredictionIO engine with something like the following:

curl --max-time 2000 --connect-timeout 60 -H "Content-Type: application/json" \
     -d '{
       "ids": [
         "AAAAAAAA-9999-4444-ACAC-18181818181818"
       ],
       "other": "value"
      }' \

But I only ever receive the following:

The server was not able to produce a timely response to your request

I know this means that the request is being received by Spray (that is a Spray timeout message), but for some reason it is never completing regardless of how long request-timeout is.

My logs indicate that the predict method is never being called, which suggests that something is getting stuck within the PredictionIO request-handler logic.

Jake Greene
  • 5,539
  • 2
  • 22
  • 26

1 Answers1

0

This is indeed a problem with the request-handler logic, specifically the query deserialization into my Query class. There is a known json4s defect which prevents a Query class with type-aliases-in-generics to be deserialized. The following will produce an infinite loop:

object User {
  type Id = Int
}

case class Query(ids: Seq[User.Id], other: String)
// This will never complete
org.json4s.jackson.Serialization.write(Query(Seq(1,2,3), "Hello World"))

removing the type alias User.Id and replacing it with Int will resolve the issue.

case class Query(ids: Seq[Int], other: String)
org.json4s.jackson.Serialization.write(Query(Seq(1,2,3), "Hello World"))
res0: String = {"users":[1,2,3],"other":"Hello World"}
Jake Greene
  • 5,539
  • 2
  • 22
  • 26