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

Duplicate key violation causes 'Unable to translate bytes [86] at index 1 from specified code page to Unicode.' with collation

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 5.0.2
    • Component/s: None
    • None

      This is effectively the same issue as SERVER-50454, however it occurs in Mongo 5.0.2 on Windows whereas the original case states that it was resolved in 5.0-rc2. This test app:

      https://github.com/blushingpenguin/MongoInvalidUTF8Bug

      can be used to reproduce the problem

      Exception has occurred: CLR/System.Text.DecoderFallbackException
      An exception of type 'System.Text.DecoderFallbackException' occurred in System.Private.CoreLib.dll but was not handled in user code: 'Unable to translate bytes [86] at index 1 from specified code page to Unicode.'
      at System.Text.DecoderExceptionFallbackBuffer.Throw(Byte[] bytesUnknown, Int32 index)
      at System.Text.DecoderExceptionFallbackBuffer.Fallback(Byte[] bytesUnknown, Int32 index)
      at System.Text.Encoding.GetCharCountWithFallback(ReadOnlySpan`1 bytes, Int32 originalBytesLength, DecoderNLS decoder)
      at System.Text.Encoding.GetCharCountWithFallback(Byte* pBytesOriginal, Int32 originalByteCount, Int32 bytesConsumedSoFar)
      at System.Text.UTF8Encoding.GetCharCount(Byte* bytes, Int32 count)
      at System.String.CreateStringFromEncoding(Byte* bytes, Int32 byteLength, Encoding encoding)
      at System.Text.UTF8Encoding.GetString(Byte[] bytes, Int32 index, Int32 count)
      at MongoDB.Bson.IO.Utf8Helper.DecodeUtf8String(Byte[] bytes, Int32 index, Int32 count, UTF8Encoding encoding)
      at MongoDB.Bson.IO.ByteBufferStream.ReadString(UTF8Encoding encoding)
      at MongoDB.Bson.IO.BsonBinaryReader.ReadString()
      at MongoDB.Bson.Serialization.Serializers.BsonStringSerializer.DeserializeValue(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.Serializers.BsonValueSerializerBase`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize[TValue](IBsonSerializer`1 serializer, BsonDeserializationContext context)
      at MongoDB.Bson.Serialization.Serializers.BsonValueSerializer.DeserializeValue(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.Serializers.BsonValueSerializerBase`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize[TValue](IBsonSerializer`1 serializer, BsonDeserializationContext context)
      at MongoDB.Bson.Serialization.Serializers.BsonDocumentSerializer.DeserializeValue(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.Serializers.BsonValueSerializerBase`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize[TValue](IBsonSerializer`1 serializer, BsonDeserializationContext context)
      at MongoDB.Bson.Serialization.Serializers.BsonValueSerializer.DeserializeValue(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.Serializers.BsonValueSerializerBase`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize[TValue](IBsonSerializer`1 serializer, BsonDeserializationContext context)
      at MongoDB.Bson.Serialization.Serializers.BsonDocumentSerializer.DeserializeValue(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.Serializers.BsonValueSerializerBase`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize[TValue](IBsonSerializer`1 serializer, BsonDeserializationContext context)
      at MongoDB.Bson.Serialization.Serializers.BsonValueSerializer.DeserializeValue(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.Serializers.BsonValueSerializerBase`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize[TValue](IBsonSerializer`1 serializer, BsonDeserializationContext context)
      at MongoDB.Bson.Serialization.Serializers.BsonArraySerializer.DeserializeValue(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.Serializers.BsonValueSerializerBase`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize[TValue](IBsonSerializer`1 serializer, BsonDeserializationContext context)
      at MongoDB.Bson.Serialization.Serializers.BsonValueSerializer.DeserializeValue(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.Serializers.BsonValueSerializerBase`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize[TValue](IBsonSerializer`1 serializer, BsonDeserializationContext context)
      at MongoDB.Bson.Serialization.Serializers.BsonDocumentSerializer.DeserializeValue(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.Serializers.BsonValueSerializerBase`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize[TValue](IBsonSerializer`1 serializer, BsonDeserializationContext context)
      at MongoDB.Bson.IO.BsonWriter.WriteRawBsonDocument(IByteBuffer slice)
      at MongoDB.Bson.Serialization.Serializers.RawBsonDocumentSerializer.SerializeValue(BsonSerializationContext context, BsonSerializationArgs args, RawBsonDocument value)
      at MongoDB.Bson.Serialization.Serializers.BsonValueSerializerBase`1.Serialize(BsonSerializationContext context, BsonSerializationArgs args, TBsonValue value)
      at MongoDB.Bson.Serialization.Serializers.SerializerBase`1.MongoDB.Bson.Serialization.IBsonSerializer.Serialize(BsonSerializationContext context, BsonSerializationArgs args, Object value)
      at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Serialize(IBsonSerializer serializer, BsonSerializationContext context, Object value)
      at MongoDB.Bson.Serialization.Serializers.BsonValueSerializerBase`1.Serialize(BsonSerializationContext context, BsonSerializationArgs args, TBsonValue value)
      at MongoDB.Bson.Serialization.Serializers.SerializerBase`1.MongoDB.Bson.Serialization.IBsonSerializer.Serialize(BsonSerializationContext context, BsonSerializationArgs args, Object value)
      at MongoDB.Bson.BsonExtensionMethods.ToJson(Object obj, Type nominalType, JsonWriterSettings writerSettings, IBsonSerializer serializer, Action`1 configurator, BsonSerializationArgs args)
      at MongoDB.Bson.BsonExtensionMethods.ToJson[TNominalType](TNominalType obj, JsonWriterSettings writerSettings, IBsonSerializer`1 serializer, Action`1 configurator, BsonSerializationArgs args)
      at MongoDB.Bson.BsonDocument.ToString()
      at MongoInvalidUTF8Bug.Program.OnCommandSucceeded(CommandSucceededEvent evt) in /home/mark/proto/MongoInvalidUTF8Bug/Program.cs:line 28
      at MongoDB.Driver.Core.Connections.CommandEventHelper.ProcessCommandResponseMessage(CommandState state, CommandResponseMessage message, IByteBuffer buffer, ConnectionId connectionId, Nullable`1 serviceId, MessageEncoderSettings encoderSettings)
      at MongoDB.Driver.Core.Connections.CommandEventHelper.AfterReceiving(ResponseMessage message, IByteBuffer buffer, ConnectionId connectionId, Nullable`1 serviceId, MessageEncoderSettings encoderSettings)
      at MongoDB.Driver.Core.Connections.BinaryConnection.ReceiveMessageHelper.ReceivedMessage(IByteBuffer buffer, ResponseMessage message)
      at MongoDB.Driver.Core.Connections.BinaryConnection.<ReceiveMessageAsync>d__57.MoveNext()

            Assignee:
            edwin.zhou@mongodb.com Edwin Zhou
            Reporter:
            mark.weaver@trelica.com Mark Weaver
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: