Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7085981

XXSocket types depend on impl finalizer to close if constructor throws exception

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 6
    • core-libs
    • b06
    • unknown
    • generic
    • Verified

      There appears to be a socket leak in both DatagramSocket and MulticastSocket constructors. Both classes have constructors that create a socket and then attempt to bind. The bind can fail with a variety of exceptions none of which are caught by the constructor. Thus, the actual system socket that was allocated by impl.create() is never closed.

      Actually, it is closed by the SocketImpl finalizer, but that's too late.
      Socket and ServerSocket appear to suffer from similar issue.

            michaelm Michael McMahon
            michaelm Michael McMahon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: