Sending an 2xx 'early' response before end of request was received

(Mark Hammons) #1

Hi, I’m receiving this warning on an upload path I implemented:

2018-10-07 19:01:32,090 [warn] a.a.ActorSystemImpl - Sending an 2xx 'early' response before end of request was received... Note that the connection will be closed after this response. Also, many clients will not read early responses! Consider only issuing this response after the request data has been completely read!

This is the definition of the upload path:

//bodyparser definition
  def streamingUploader(experimentName: ExperimentName,
                        aid: String,
                        group: String,
                        fileName: String) = BodyParser { implicit req =>
    val path = aid match {
      case "0" => (IRODSPath(experimentName) / group / fileName).throwFault
      case n   => ???

    val expInfo = pm.tryGetExperimentStubByName(experimentName)

    val auth = PTryT(expInfo).flatMapF { exp =>
      authModule.forceUser(OwnedBy(exp.owner.userID, exp.owningTeam), Write)

    val future = auth
      .flatMapF { _ =>"creating directories for $path")
      .map { _ =>
          .getSink(overwriteExisting = true)
          .addAttributes(Attributes.inputBuffer(initial = 16, max = 64))
      .map { iSink =>"creating accumulator for $path")
          .map {
            case PFailure(f) =>
            case PSuccess(bs) =>
      .leftMap { f =>
        //todo: create a fault handler spec, and get the appropriate response with it
      .fold(identity, identity)

    Await.result(future, 3.minutes)

//path definition
  def upload(experimentName: ExperimentName,
             aid: String,
             group: String,
             filename: String) =
    PAction(streamingUploader(experimentName, aid, group, filename)) {
      request =>

Any idea why i’m getting this early response warning?

edit: just a bit of clarification; PAction is an Action wrapper I defined that takes a Future[Either[Fault, Result]]]. It just handles bridging that result type to the Result type that an action or a Future[Result] that an Action.async requires.