New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpEntity.toStrict - JavaApi - is ignoring maxBytes #2287

Closed
miroslavhornak opened this Issue Nov 21, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@miroslavhornak
Copy link

miroslavhornak commented Nov 21, 2018

akka-http version: 10.1.5

HttpEntity.scala:

Current (lines 185-187):

/** Java API */
override def toStrict(timeoutMillis: Long, maxBytes: Long, materializer: Materializer): CompletionStage[jm.HttpEntity.Strict] =
   toStrict(timeoutMillis.millis)(materializer).toJava

Shall be (calling toStrict with maxBytes):

/** Java API */
  override def toStrict(timeoutMillis: Long, maxBytes: Long, materializer: Materializer): CompletionStage[jm.HttpEntity.Strict] =
    toStrict(timeoutMillis.millis, maxBytes)(materializer).toJava

to avoid unnecessary parsing of config.getPossiblyInfiniteBytes("akka.http.parsing.max-to-strict-bytes") with every single HttpResponse (on which toStrict() is called) ...
Btw. parsing of that value (most probably default one in the config) (not specified in our own application.conf) throws a lot of exceptions that can be seen in any java profiler ...

screenshot 2018-11-21 at 16 33 47

@miroslavhornak

This comment has been minimized.

Copy link

miroslavhornak commented Nov 26, 2018

Just a side note: exceptions reported by the java profiller come from the Typesafe Config project itself ... see: https://github.com/lightbend/config/blob/master/config/src/main/java/com/typesafe/config/impl/DefaultTransformer.java

jlprat added a commit that referenced this issue Nov 26, 2018

Merge pull request #2290 from miroslavhornak/HttpEntity_toStrict_resp…
…ect_maxBytes

Java API - call scala HttpEntity.toStrict that respects maxBytes #2287
@jlprat

This comment has been minimized.

Copy link
Member

jlprat commented Nov 26, 2018

Done by e92456c

@jlprat jlprat closed this Nov 26, 2018

@jlprat jlprat added this to the 10.1.6 milestone Nov 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment