Akka Http错误:InvalidContentLengthException

时间:2016-09-29 21:48:08

标签: scala akka scala.js akka-http

我们有一个Akka HTTP Server在AWS上提供一些scala JS内容。我们注意到,经过一段时间后,服务器开始在日志中抛出以下错误,虽然某些网址有效,但是某些文件无法正确下载且出现Failed to load resource: net::ERR_CONTENT_LENGTH_MISMATCH错误浏览器。服务器日志如下所示(它在所有实例中都是完全相同的错误):

  

[ERROR] [09/29/2016 21:29:22.150] [designer-actor-system-akka.actor.default-dispatcher-56831] [akka.actor.ActorSystemImpl(designer-actor-system)]外向响应流错误   akka.http.scaladsl.model.InvalidContentLengthException:HTTP消息已声明Content-Length 997但实体数据流量减少了164个字节       at akka.http.scaladsl.model.InvalidContentLengthException $ .apply(ErrorInfo.scala:50)       at akka.http.impl.engine.rendering.RenderSupport $ CheckContentLengthTransformer $$ anon $ 2.onUpstreamFinish(RenderSupport.scala:130)       at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:732)       at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:616)       at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:471)       at akka.stream.impl.fusing.GraphInterpreterShell.receive(ActorGraphInterpreter.scala:433)       at akka.stream.impl.fusing.ActorGraphInterpreter.akka $ stream $ impl $ fusing $ ActorGraphInterpreter $$ processEvent(ActorGraphInterpreter.scala:603)       at akka.stream.impl.fusing.ActorGraphInterpreter $$ anonfun $ receive $ 1.applyOrElse(ActorGraphInterpreter.scala:618)       at akka.actor.Actor $ class.aroundReceive(Actor.scala:484)       at akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:529)       at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)       at akka.actor.ActorCell.invoke(ActorCell.scala:495)       at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)       at akka.dispatch.Mailbox.run(Mailbox.scala:224)       at akka.dispatch.Mailbox.exec(Mailbox.scala:234)       在scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)       在scala.concurrent.forkjoin.ForkJoinPool $ WorkQueue.runTask(ForkJoinPool.java:1339)       在scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)       在scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

我们正在运行Akka版本2.4.7和OpenJDK版本1.8.0_101-b13。如果我们重新启动Akka HTTP服务器,错误就会消失,但几小时后会再次出现。

不确定导致此问题的原因。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:2)

我想我弄明白是什么导致了它。我们有一个自动部署过程,可以将HTML / CSS / Javascript文件部署到Akka服务器。似乎Akka服务器缓存内容大小,如果静态文件更新而不重新启动,它将给出InvalidContentLengthException。我们将重新启动作为部署过程的一部分包括在内,问题似乎已得到解决。