Re: [ogpx] type-system : guidance for binary serialization implementers

Meadhbh Hamrick <ohmeadhbh@gmail.com> Mon, 29 March 2010 04:19 UTC

Return-Path: <ohmeadhbh@gmail.com>
X-Original-To: ogpx@core3.amsl.com
Delivered-To: ogpx@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 65FE53A6877 for <ogpx@core3.amsl.com>; Sun, 28 Mar 2010 21:19:44 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 1.131
X-Spam-Level: *
X-Spam-Status: No, score=1.131 tagged_above=-999 required=5 tests=[BAYES_50=0.001, DNS_FROM_OPENWHOIS=1.13]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yIEBxl+5IeHG for <ogpx@core3.amsl.com>; Sun, 28 Mar 2010 21:19:41 -0700 (PDT)
Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.25]) by core3.amsl.com (Postfix) with ESMTP id 39E6C3A67E7 for <ogpx@ietf.org>; Sun, 28 Mar 2010 21:19:41 -0700 (PDT)
Received: by qw-out-2122.google.com with SMTP id 9so169567qwb.31 for <ogpx@ietf.org>; Sun, 28 Mar 2010 21:20:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:received:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=nxZuzwE1i5wRdU+ut4PFszMzEZxyEcQPA94VCWrKL7g=; b=p26QHAIMRlCylkBVd5YW8YszXt6a/GXkirbJOYAguR9TfNTOPnb7qAVw+hcwSk/qo6 +NR+Kt7AZwsy/1dTg1v4hkuUid2PMnqE2W1tRIfqJDzf4x55JCZR2pHQboA/XLOx4KOA mtAFSeFzbLVwSIe48OBfX4TDdfC8tSsP9XbSg=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=ulcqiwOyv0r5squeCjOg1dF0iLls+rcv9P003yn9oIpeGTx5Roz6Wm94PCiffmNf/X 5G5Cih/bF1VN+pRv50K6Oh+ElqM2sDH7xhO8FAowLXGoka+furjehunaGDIre5VWTpqY 1GcGTz8p9y3c4838TiMgBM+DFioT8ftqpJqHI=
MIME-Version: 1.0
Received: by 10.229.20.209 with HTTP; Sun, 28 Mar 2010 21:19:44 -0700 (PDT)
In-Reply-To: <ab84ceb11003282104mc2b02cfg326bc163d0fd279e@mail.gmail.com>
References: <b325928b1003281034s55fae732n7be979446759bd12@mail.gmail.com> <ab84ceb11003282104mc2b02cfg326bc163d0fd279e@mail.gmail.com>
From: Meadhbh Hamrick <ohmeadhbh@gmail.com>
Date: Sun, 28 Mar 2010 21:19:44 -0700
Received: by 10.229.218.203 with SMTP id hr11mr1195912qcb.85.1269836404177; Sun, 28 Mar 2010 21:20:04 -0700 (PDT)
Message-ID: <b325928b1003282119w19949ca4l9998de8cba4aa8d0@mail.gmail.com>
To: Dahlia Trimble <dahliatrimble@gmail.com>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
Cc: ogpx <ogpx@ietf.org>
Subject: Re: [ogpx] type-system : guidance for binary serialization implementers
X-BeenThere: ogpx@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Virtual World Region Agent Protocol - IETF working group <ogpx.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/ogpx>, <mailto:ogpx-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/ogpx>
List-Post: <mailto:ogpx@ietf.org>
List-Help: <mailto:ogpx-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ogpx>, <mailto:ogpx-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Mar 2010 04:19:44 -0000

well.. john hurliman's been pretty supportive of VWRAP generally.
(thanks, john!) so it's not outside the realm of possibility that
libOMV would get modified to be compliant with the VWRAP specs.

--
meadhbh hamrick * it's pronounced "maeve"
@OhMeadhbh * http://meadhbh.org/ * OhMeadhbh@gmail.com



On Sun, Mar 28, 2010 at 9:04 PM, Dahlia Trimble <dahliatrimble@gmail.com> wrote:
> OpenSim in general uses the serializer and deserializer classes in
> libOpenmetaverse (1). There may be a few lingering places in the code base
> where they are hard coded with other methods, but I suspect they would be
> converted to using the libOpenmetaverse implementation rather than be
> modified to conform to any spec modifications.
>
>
> 1. http://www.openmetaverse.org/projects/libopenmetaverse
>
> On Sun, Mar 28, 2010 at 10:34 AM, Meadhbh Hamrick <ohmeadhbh@gmail.com>
> wrote:
>>
>> so this has stuck in my craw for a couple weeks, finally remembering
>> to post it to the list.
>>
>> the JSON and XML serialization schemes use well known grammars that
>> have wide adoption. not so for the binary serialization. so if i
>> wanted to write an XML parser, i would have a lot of 3rd party
>> resources and discussion to guide me. specifically when it comes to
>> handling errors.
>>
>> as i was writing my own implementation of the LLSD binary
>> serialization scheme, a couple issues came up.
>>
>> i think we should *somewhere* address them. either as a section of the
>> type-system document, or as an informational RFC. i would like to have
>> clear guidance for how implementers would handle the following
>> exceptional events.
>>
>> one of the things we were trying to do was make a type system and
>> serialization schemes that were resilient in the face of error. so i
>> think there's a strong preference that we recover as best we can from
>> an error instead of throwing up our hands and just saying "error!"
>>
>> i would actually go and look at how LL implemented the binary
>> serialization (i'm sure it's in the viewer code somewhere) but i'm in
>> the middle of my gnu/bsd cool down period, and i don't want to reset
>> the timer. i think there may be other people in the same situation,
>> which is why we should have a document describing what we should do in
>> the face of parsing errors.
>>
>> so... if someone out there who's more of a viewer person wants to look
>> at the linden implementation and describe it's behavior in a textual
>> format, and then someone wants to look at the opensim implementation
>> and describe it's behavior in a textual format, we could then document
>> how things work and avoid this situation for other people.
>>
>> here's a list of encoding / decoding errors i think about, along with
>> suggestions for how to handle them.
>>
>> 1. the object count following the opening tag ('{' or '[') is less
>> than the actual number of objects in the collection. (that is, the
>> closing tag is not found after iterating through "object count" number
>> of elements, but is found later in the stream.)
>>
>> the "simple" thing to do would be to simply say, "the array ends after
>> $(OBJECT_COUNT) number of elements, even if there's not a closing
>> tag."
>>
>> the "smart" thing to do would be to look at the LLIDL definition of
>> the array you're parsing and try to come up with a "best fit" for
>> what's supposed to be there vs. what's actually there. in other words,
>> you look at the LLIDL and if it says you're supposed to have three
>> elements in the array and you have three elements in the array, then
>> you're done. or maybe you're supposed to have one additional element
>> in the array.
>>
>> the "smart" thing to do could get quite complicated while the "simple"
>> thing is sure to introduce failures the "smart" thing could recover
>> from.
>>
>> 2. the object count following the opening tag ('{' or '[') is greater
>> than the actual number of objects in the collection. (that is, you get
>> a closing tag before "object count" number of elements)
>>
>> the "simple" thing to do is to simply say, "a closing tag ends the
>> collection"
>>
>> combining this with the previous error case, we could say, "a
>> collection continues until the closing tag is reached or
>> $(OBJECT_COUNT) elements are found in the collection."
>>
>> 3. there is no closing tag. (that is, after "object count" number of
>> elements, you find a tag that is not a '}' or a ']'.)
>>
>> this is more or less the same as error case number 1 above.
>>
>> though i wonder if it makes sense to differentiate the two cases. if
>> we were, we would have to have the smarts enough to look forward in
>> the stream, count the number of opening tags, then count the number of
>> closing tags and see if they're unbalanced. ugh.
>>
>> 4. lack of 'k' elements in a map. (that is, you haven't reached the
>> "object count" number of elements and are expecting a 'k' but get
>> something else.)
>>
>> my druthers would be to say, if you encounter a type that can be
>> converted to a string, you just do the conversion and use the result
>> as the key.
>>
>> another way to handle it would be to ignore it.
>>
>> 5. you encounter a bare 'k'. (that is, you encounter a 'k' tag outside
>> the context of a map.)
>>
>> i vote for "convert to string"
>>
>> 6. duplicate keys in a map. (actually this applies to all serializations)
>>
>> i vote for "the last key in the map with the same name wins." that is,
>> if you have two or more keys with the same name, the one found
>> furthest in the stream is the one that's used.
>>
>> ideas? comments?
>> --
>> meadhbh hamrick * it's pronounced "maeve"
>> @OhMeadhbh * http://meadhbh.org/ * OhMeadhbh@gmail.com
>> _______________________________________________
>> ogpx mailing list (VWRAP working group)
>> ogpx@ietf.org
>> https://www.ietf.org/mailman/listinfo/ogpx
>
>