Metaspace problem play 2.7

Unfortunately I am getting this frequently when I try to compile

[error] Error while emitting StudentDAO.scala
[error] Metaspace
[error] ## Exception when compiling 103 sources to /mnt/important/webAppDeveloping/edu-assistant/target/scala-2.13/classes
[error] Metaspace
[error] 
[error]            
[error] a.a.ActorSystemImpl - Internal server error, sending 500 response
akka.http.impl.util.One2OneBidiFlow$OutputTruncationException: Inner flow was completed without producing result elements for 1 outstanding elements
        at akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$.apply(One2OneBidiFlow.scala:22)
        at akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$.apply(One2OneBidiFlow.scala:22)
        at akka.http.impl.util.One2OneBidiFlow$One2OneBidi$$anon$1$$anon$4.onUpstreamFinish(One2OneBidiFlow.scala:97)
        at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:506)
        at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:376)
        at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:606)
        at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:485)
        at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:581)
        at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:749)
        at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:764)

The akka-http server backend sometimes swallows error messages…
For now, can you switch to the Netty Server Backend and try again? It might give you a clearer error message.
In you build.sbt just enable the plugin (and disable akka-http):

lazy val root = ...enablePlugins(PlayNettyServer).disablePlugins(PlayAkkaHttpServer)

Ok, I am checking according to your suggestion.

@mkurz, thanks till now I have not got any java.lang.OutOfMemoryError: Metaspace

Update: I should not use PlayNettyServer in production, because PlayAkkaHttpServer’s request handling capability is tremendously better than PlayNettyServer. I found going to perform the load testing on PlayNettyServer , it freezes at a point. Where PlayAkkaHttpServer smoothly and successfully handles those huge loads.

@BnB Interesting. In my experience the netty backend outperforms the akka-http one. At least that what I see at the TechEmpower Framework Benchmarks (which I worked on the last years as well).

Did you tweak the netty settings as well? Checkout https://github.com/playframework/playframework/blob/2.7.4/transport/server/play-netty-server/src/main/resources/reference.conf
E.g. you could change play.server.netty.eventLoopThreads or if you are on Linux you could set transport to native.

What are “those huge loads”? Maybe you have problem with the netty threads?

1 Like

Oh, sorry, It was our configuration problem.