[Opensim-dev] So I decided to give this one more shot before I start chopping it up with a chain
Stefan Andersson
stefan at tribalmedia.se
Fri Dec 14 07:30:00 UTC 2007
Yes, but just to be sure, we should check that you can use 'Guid?' which translates to Nullable<Guid> - it's the Nullable<> I'm wary of.
I think we're all in on this anti-LLUUID crusade.
/Stefan
Date: Fri, 14 Dec 2007 02:13:13 -0500From: teravus at gmail.comTo: opensim-dev at lists.berlios.deSubject: Re: [Opensim-dev] So I decided to give this one more shot before I start chopping it up with a chain
At this moment, I'm using System.Guid for inter region communications with most of the inter-region remoting calls. I think it's safe to say that it's serializable on both Windows and Unix :D
I'm for this anti-'LLUUID' use movement :D
Best Regards
Tera
On 12/14/07, Stefan Andersson <stefan at tribalmedia.se> wrote:
I suggest we eliminate the use if LLUUID outside of the ClientStack entirely; all conversions to and from LLUUID should be in the ClientStack endpoints. This would be a big step towards decoupling from libsl, as many project include it only because of LLUUID. Now, this said, I warn you that using Guid directly will lead to a LOT of GC on Guids, as they are value types and are copied on all calls. You really want a reference-type wrapper to pass around. A quick solution for this would be to actually start using 'Guid?' which is a short for Nullable<Guid> which incidentally gives us the opportunity to check for .HasValue instead of checking for Guid.Empty, which can lead to unpredictable behaviour (and vulnerabilities) (Of course you need to do a test to see if Guid? actually serializes ok on mono vs .net) This is also a worthy task for 0.5, and should be rather easily done, actually. Just replace 'LLUUID' with 'Guid?', revert the clientstack and start coping with the errors... ;) Sincerely,/Stefan
Date: Fri, 14 Dec 2007 01:50:06 -0500From: teravus at gmail.comTo: opensim-dev at lists.berlios.deSubject: [Opensim-dev] So I decided to give this one more shot before I start chopping it up with a chainsaw.......
Hey Guys'n Gals..
Digging into Bug number 145 on Mantis.. I discovered profuse and prolific use of the unserializable LLUUID in inventory.. It's used *everywhere*.
It's no wonder inventory is spotty and error prone!
It's used in InventoryFolderBase
It's used in InventoryItemBase
It's used in the REST calls
All of this data is being transferred over Grid Communications :/
Once again, I restate that the LLUUID is no longer serializable. It now implements the IComparable interface which is *not* serializable.. Therefore, it can 'never' be used in any grid communications, period.
We all need to take a good look at the grid inventory service and 'fix' all uses of LLUUID.
It's *really* easy to use a Guid instead.
To go from a System.Guid to a LLUUID, you instantiate a new LLUUID and pass the Guid to it's constructor.
ex:
Guid gAgentID = 'xxxxxxx-xx-x--x-x--xx';
LLUUID AgentID = new LLUUID(gAgentID);
To go from a LLUUID to a guid, you use the UUID property of the LLUUID.
ex:
Guid gAgentID = AgentID.UUID;
So, given that you've got a userID LLUUID.. to get it over grid communications reliably.. you have to turn it into a Guid.
requester.BeginPostObject<Guid>(_inventoryServerUrl + "/GetInventory/", userID.UUID);
Then on the receiving side,
httpServer.AddStreamHandler( new RestDeserialisehandler<Guid, InventoryCollection>("POST", "/GetInventory/", m_inventoryService.GetUserInventory));
public InventoryCollection GetUserInventory(Guid userID) { InventoryCollection invCollection = new InventoryCollection(); List<InventoryFolderBase> folders; List<InventoryItemBase> allItems; if (TryGetUsersInventory(new LLUUID(userID), out folders, out allItems)) { invCollection.AllItems = allItems; invCollection.Folders = folders; invCollection.UserID = new LLUUID(userID); } return invCollection; }
Additionally,
Any object that encapsulates a LLUUID directly, is NOT serializable... that means.. the objects;
InventoyFolderBase
and
InventoryItemBase
Are not serializable because they encapsulate LLUUIDs. This is *bad* :D. They cannot go over Grid Communications reliably.
They all need to be changed to Guids, or we'll continue to have spotty inventory.
:D
I'm mentioning this because it's a big problem..
I don't really know this portion of the code well.. so if I edit it, it's likely to break.. hence the subject.
Someone take this on please.. so I don't have to chop it up with a chainsaw.. grind it down with a tree stump grinder, run it over with a steam roller and jack-hammer it to itty bitty bite sized serializable components that can reliably be transferred over grid communications. :D
Best Regards
Tera_______________________________________________Opensim-dev mailing listOpensim-dev at lists.berlios.de https://lists.berlios.de/mailman/listinfo/opensim-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20071214/f8cf3695/attachment-0001.html>
More information about the Opensim-dev
mailing list