Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-6012

Improve GridJettyRestHandler.processRequest()

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.3
    • Component/s: rest
    • Labels:
      None

      Description

      In case of large result

      private void processRequest(String act, HttpServletRequest req, HttpServletResponse res) {
      ...
      json = jsonMapper.writeValueAsString(cmdRes)
      ....
      

      Will fail with OOME, beacuse jsonMapper.writeValueAsString(cmdRes) internally will create a StringBuilder and will try to allocate large amount of memory.

      This could be easily fixed by writing object directly to response output stream via.

      jsonMapper.writeValue(out, cmdRes);
      

        Attachments

          Activity

            People

            • Assignee:
              kuaw26 Alexey Kuznetsov
              Reporter:
              kuaw26 Alexey Kuznetsov
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: