|Anonymous | Login | Signup for a new account||2020-09-25 06:48 PDT|
|Main | My View | View Issues | Change Log | Roadmap | Summary | My Account|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0004544||opensim||[MISC] Compiling / Building||public||2010-01-23 22:16||2011-08-20 07:40|
|Product Version||master (dev code)|
|Target Version||Fixed in Version|
|Summary||0004544: Added async updates of Asset and Estates in SQLite storage mode|
|Description||Saw a comment while browsing the source requesting async updates to data tier. The attached patch adds initial support for SQLite updates in Asset (and Estate since it was a similar change.) On local development box the startup time was reduced from over 30 seconds consistently to under 10 seconds consistently. The changes use the OpenMetavers ThreadUtil.FireAndForget method.|
|Tags||No tags attached.|
|Git Revision or version number||48776b4a06a92a3428d2abf964cdb301017f2c55|
|Run Mode||Standalone (1 Region)|
|Environment||.NET / Windows64|
|Attached Files|| async.patch [^] (2,301 bytes) 2010-01-23 22:16 [Show Content]
sqlite-storeasset-async.patch [^] (2,435 bytes) 2010-01-31 12:02 [Show Content]
|I believe that asynchronous execution here would hide any exception. Could we catch and log anything that does get thrown?|
Looking at the existing code, the class isn't doing any catching and reporting of exceptions right now. The events are bubbling up the call stack and waiting to be caught elsewhere. With Fire and Forget it's true the specific exception could be lost and an error would happen elsewhere up the stack.
This can be changed to catch the callback when the thread ends and log any exceptions that come with it. (Exceptions thrown while a delegate is executing asynchronously is caught and returned with the IAsyncResult on EndInvoke call.)
If this is desired, I suggest an alteration to the class for more robust error handling (such as attempting a reconnect, printing a specific message to the log, etc.)
How would you suggest handling the errors? Refactoring to grab the exception is possible but since the calling code would have already returned all we can do is log it (and will trail an error up the chain of events because of this.)
New patch, sqlite-storeasset-async.patch, adds support for asynchronous calls to StoreAsset in the SQLite project. A delegate useable in the other modules is added to the OpenSim.Data.AssetDataBase base class.
This version is an alternate to the other patch which used the FireAndForget method to start the thread and forget about it. This version uses a callback which calls EndInvoke on the thread when it's complete in order to catch any exceptions that may have been thrown while the thread was executing. Right now the exception is logged. There seems to be no uniform way of catching and reporting exceptions so for now we just log it.
This patch is just preliminary support to get community feedback. If the format is acceptable, more updates will be made.
I have to confess that I'm still a little scared of this. All the database connectors currently execute this code synchronously and switching to async under the covers breaks the implict contract. There is so much room within OpenSim to introduce subtle race conditions.
I'm still happy to experiment here but if you don't mind, I'd really rather that application of this patch to Master be left until immediately after we branch the 0.7 line.
|2010-01-23 22:16||VikingErik||New Issue|
|2010-01-23 22:16||VikingErik||File Added: async.patch|
|2010-01-23 22:16||VikingErik||Git Revision||=> 48776b4a06a92a3428d2abf964cdb301017f2c55|
|2010-01-23 22:16||VikingErik||SVN Revision||=> 0|
|2010-01-23 22:16||VikingErik||Run Mode||=> Standalone (1 Region)|
|2010-01-23 22:16||VikingErik||Physics Engine||=> BasicPhysics|
|2010-01-23 22:16||VikingErik||Environment||=> .NET / Windows64|
|2010-01-23 22:16||VikingErik||Mono Version||=> None|
|2010-01-23 22:17||VikingErik||Status||new => patch included|
|2010-01-29 13:58||justincc||Note Added: 0014898|
|2010-01-29 13:58||justincc||Status||patch included => patch feedback|
|2010-01-29 19:53||VikingErik||Note Added: 0014914|
|2010-01-31 12:02||VikingErik||File Added: sqlite-storeasset-async.patch|
|2010-01-31 12:09||VikingErik||Note Added: 0014924|
|2010-01-31 12:09||VikingErik||Status||patch feedback => patch included|
|2010-02-12 14:59||justincc||Note Added: 0014968|
|2011-08-20 07:39||makopoppo||Status||patch included => patch feedback|
|2011-08-20 07:40||makopoppo||Assigned To||=> justincc|
|Copyright © 2000 - 2012 MantisBT Group|