Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-2523

Cap max data read by TcpConnection or NioConnection

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Minor Minor
    • 4.2.11, 5.1.4
    • None
    • None
    • False
    • False
    • Undefined

      Both NioConnection and TcpConnection read the length (4 bytes) first, then allocate a buffer and call InputStream.readFully().
      If some random client (nc, curl, wget etc)connects accidentally, length might be huge and the memory allocation will fail with an OOME. This may even terminate the JVM, e.g. if -XX:+ExitOnOutOfMemoryError is set.
      Solution: introduce an attribute which caps the max length, and throws an exception (closing the connection), avoiding reading the data. If 0, the length will not be capped.

            rhn-engineering-bban Bela Ban
            rhn-engineering-bban Bela Ban
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: