Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-6682

SocketOutputStream doesn't handle short writes properly

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Classlib
    • Labels:
      None
    • Environment:
      Tested/noticed on Android, same issue identified in the Harmony code base, too
    • Patch Info:
      Patch Available
    • Estimated Complexity:
      Novice

      Description

      Even blocking writes can return before the full amount is written, e.g. if a signal is received, or for any other arbitrary reason.

      The java.io.OutputStream.write() interface that SocketOutputStream implements returns void, and cannot report short writes to the caller, and therefore is required to loop to retry writing until everything is written, or until writing fails.

      The same issue is reported to Android at https://review.source.android.com/21459.

        Attachments

        1. outputstream-shortwrite.patch
          1 kB
          Martin Storsjö

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mstorsjo Martin Storsjö
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: