【问题标题】:Finatra TooLongMessageException HTTP content length exceeded 5242880 bytes, despite flag setting more bytesFinatra TooLongMessageException HTTP 内容长度超过 5242880 字节,尽管标志设置了更多字节
【发布时间】:2018-08-22 16:59:05
【问题描述】:

我看到一个 TooLongMessageException HTTP content length exceeded 5242880 bytes. 我的 Finatra 服务器抛出异常。查看通过-help=true 提供的标志,看起来要设置的标志是maxRequestSize。这是帮助命令的输出

flags:
  -admin.announce='java.lang.String': Address for announcing admin server
  -admin.port=':9990': Admin http server port
  -cert.path='': path to SSL certificate
  -doc.root='': File serving directory/namespace for classpath resources
  -help='false': Show this help
  -http.announce='java.lang.String': Address for announcing HTTP server
  -http.name='http': Http server name
  -http.port=':8080': External HTTP server port
  -http.response.charset.enabled='true': Return HTTP Response Content-Type UTF-8 Charset
  -https.announce='java.lang.String': Address for announcing HTTPS server
  -https.name='https': Https server name
  -https.port='': HTTPs Port
  -key.path='': path to SSL key
  -local.doc.root='': File serving directory for local development
  -log.append='true': If true, appends to existing logfile. Otherwise, file is truncated.
  -log.async='true': Log asynchronously
  -log.async.inferClassNames='false': Infer class and method names synchronously. See com.twitter.logging.QueueingHandler
  -log.async.maxsize='4096': Max queue size for async logging
  -log.level='INFO': Log level
  -log.output='/dev/stderr': Output file
  -log.rollPolicy='Never': When or how frequently to roll the logfile. See com.twitter.logging.Policy#parse documentation for DSL details.
  -log.rotateCount='-1': How many rotated logfiles to keep around
  -maxRequestSize='5242880.bytes': HTTP(s) Max Request Size
  -mustache.templates.dir='templates': templates resource directory
  -shutdown.time='1.minutes': Maximum amount of time to wait for pending requests to complete on shutdown
  -thrift.announce='java.lang.String': Address for announcing Thrift server
  -thrift.name='thrift': Thrift server name
  -thrift.port=':9999': External Thrift server port
  -thrift.shutdown.time='1.minutes': Maximum amount of time to wait for pending requests to complete on shutdown

我已经传入 -maxRequestSize=10.megabytes 并且可以在 /admin/registry.json 文档中看到该值:maxRequestSize: "10485760.bytes" 但我仍然看到具有 5 兆字节值的 TooLongMessageException。如何增加这个最大尺寸?

【问题讨论】:

    标签: java scala http finagle finatra


    【解决方案1】:

    也许在代码中它被覆盖了?

    你可以通过编程来实现

    > override def configureHttpServer(server: Http.Server): Http.Server = {
    >     server.withAdmissionControl.concurrencyLimit(maxConcurrentRequests = 2000, maxWaiters = 0)
    >       .withResponseClassifier(HttpResponseClassifier.ServerErrorsAsFailures)
    >       .withMaxRequestSize(StorageUnit.fromMegabytes(200))
    >       .withRequestTimeout(50.seconds)   }
    

    【讨论】:

      猜你喜欢
      • 2021-06-14
      • 2016-07-15
      • 2019-10-15
      • 2018-12-22
      • 2014-02-09
      • 1970-01-01
      • 1970-01-01
      • 2013-05-16
      相关资源
      最近更新 更多