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

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.2.0-rc0
    • Component/s: MapReduce
    • Labels:
      None
    • ALL

      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

            Assignee:
            Unassigned Unassigned
            Reporter:
            william.zola@10gen.com William Zola
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: