Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-6747

Confusing error message when mapReduce() encounters invalid UTF-16 string data in collection

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Gone away
    • Affects Version/s: 2.2.0-rc0
    • Fix Version/s: None
    • Component/s: MapReduce
    • Labels:
      None
    • Operating System:
      ALL

      Description

      If you insert invalid UTF-16 text into a string and save it in MongoDB, the database will happily store it, but if you try to run mapReduce() on it, you'll get one of the following two errors:

      map reduce failed:{
      "errmsg" : "exception: map invoke failed: JS Error: InternalError: buffer too small (anon):1",
      "code" : 9014,
      "ok" : 0
      }

      map reduce failed:{
      "errmsg" : "exception: map invoke failed: JS Error: TypeError: bad surrogate character 0x61 (anon):1",
      "code" : 9014,
      "ok" : 0
      }

      Suggested fixes:

      • Change MongoDB to not accept broken UTF-16 surrogate pairs
      • Print a more informative error message when encountering this

      Reproducable test case attached

        Attachments

          Activity

            People

            • Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: