Commit Graph

205 Commits (732d04cb4a81477074b4f6f0bec2d5047b7294c3)

Author SHA1 Message Date
Oren Hurvitz e41e52e097 Close streams immediately when we finish using them 2014-08-02 00:55:57 +01:00
Justin Clark-Casey (justincc) 539ffb7769 Use thread-safe version of .NET Random as the SDK class is not thread-safe.
As per http://msdn.microsoft.com/en-us/library/system.random%28v=vs.100%29.aspx, the .NET Random class is not thread-safe.
If called by multiple threads at once, methods may return 0.
Except for llRand(), other OpenSimulator code did not lock before calling a shared Random instance.
This commit adds a ThreadSafeRandom class that extends Random but does internal locking so that it is thread-safe.
This change is invisible to existing callers and the explicit locking in the llFrand() implementation is now redundant.
2014-08-02 00:54:42 +01:00
Justin Clark-Casey (justincc) ba745a524d Actually call Close() for shared region modules when the simulator is being shutdown.
Adds regression test for this case.
2014-08-02 00:50:10 +01:00
Melanie a108fcac95 Restore overload mode accidentally disabled in a prior commit. Add a new
config option, LogOverloads, to log when a thread pool overload occurs.
This option defaults to "True" because the logging data is useful for
diagnosing threading issues.
2014-04-25 21:34:29 +01:00
Melanie 5dc0298f83 Apply logging flag to a spammy message that may have been overlooked.
No one needs to see every thread launch.....
2014-04-24 01:44:11 +01:00
Oren Hurvitz d1c3f8eef5 Added assets service method AssetsExist(), which returns whether the given list of assets exist.
This method is used to optimize sending assets with embedded assets: e.g., when a Hypergrid visitor takes an item into the inventory.
2014-04-02 06:30:57 +01:00
Oren Hurvitz 7a47c15edb - Increased the threadpool timeout to 10 minutes
- Changed a few places that launch long-lasting threads to skip the timeout altogether
2014-03-26 20:34:55 +01:00
Oren Hurvitz f901a38204 Improved logging of HTTP requests
- MemoryBuffer isn't seekable, so we can't log it. Log the string instead.
- Handle compressed streams
- Don't attempt to dump binary data. Either don't log it at all (if we know it's binary), or at least convert non-ASCII characters to ASCII.
- Log responses to HTTP requests
- Use the same log prefix for all of these log messages ("[LOGHTTP]"), to make them easy to see at a glance
- Increased the snippet length to 200 (80 doesn't show enough), and add "..." only if the message was actually truncated

Resolves http://opensimulator.org/mantis/view.php?id=6949
2014-03-25 09:36:53 +01:00
Oren Hurvitz 4289b71141 Fixed unit tests due to changes in the threadpool 2014-03-25 10:04:52 +02:00
Oren Hurvitz e131e73652 Run slow operations in a separate thread, instead of using FireAndForget (which has a 1-minute timeout)
Resolves http://opensimulator.org/mantis/view.php?id=6945
2014-03-25 08:01:55 +01:00
Oren Hurvitz 84d7227dfd Changed LogThreadPool to have 4 logging levels. Added console command "debug threadpool level" to set the logging level.
Resolves http://opensimulator.org/mantis/view.php?id=6945
2014-03-25 08:01:50 +01:00
Oren Hurvitz b13214af27 Added a watchdog to abort slow threads in the main thread pool
If a task in the thread pool hangs then it will permanently take up
one of the threads. If this happens repeatedly then the thread pool will
become exhausted and OpenSim will fail. This watchdog terminates threads in the
thread pool that have been executing for over a minute (which probably
means they're hung).

Resolves http://opensimulator.org/mantis/view.php?id=6945
2014-03-25 08:01:45 +01:00
Oren Hurvitz e735f76553 LogThreadPool: when the thread is for ProcessPacketMethod, also log the packet type
Resolves http://opensimulator.org/mantis/view.php?id=6945
2014-03-25 08:01:41 +01:00
Oren Hurvitz 4031933475 Refactored DebugFlagsEnum
Resolves http://opensimulator.org/mantis/view.php?id=6945
2014-03-25 08:01:37 +01:00
Oren Hurvitz 8555e54e22 Automatically start logging FireAndForget activity if the threadpool is full
Resolves http://opensimulator.org/mantis/view.php?id=6945
2014-03-25 08:01:32 +01:00
Oren Hurvitz 7c0ebcb984 Added debug flag: LogThreadPool. It makes us log every use of the main threadpool.
Resolves http://opensimulator.org/mantis/view.php?id=6945
2014-03-25 08:01:13 +01:00
Oren Hurvitz 89945f8829 Refactored: ExternalRepresentationUtils should be the only place where the "CreatorData" field is calculated, to ensure uniformity
Resolves http://opensimulator.org/mantis/view.php?id=6933
2014-03-24 18:00:59 +01:00
Oren Hurvitz 921f0052f4 Get the full viewer name even if it's (incorrectly) sent in the 'Channel' field
Recent versions of Firestorm and Singularity have started sending the viewer name in the 'Channel' field, leaving only their version number in the 'Viewer' field. So we need to search both of these fields for the viewer name.

This resolves http://opensimulator.org/mantis/view.php?id=6952
2014-03-24 12:26:52 +01:00
Justin Clark-Casey (justincc) cf97535d9e Revert "Simplify DoubleQueue to eliminate redundant sempahore work."
This reverts commit 52b7b40034.

Got the semantics wrong - the sempahore is required so that the blocking thread waits for a signal.
2014-03-19 01:40:56 +00:00
Justin Clark-Casey (justincc) 52b7b40034 Simplify DoubleQueue to eliminate redundant sempahore work.
Exclusion is already guaranteed by the lock on m_syncRoot.
Semaphore could not allow more than one thread in these sections anyway since the underlying SDK structures are not thread-safe.
2014-03-19 00:48:13 +00:00
Justin Clark-Casey (justincc) c605c7a7b7 Lock m_syncRoot on DoubleQueue.Count. This is not documented as a thread-safe operation 2014-03-18 19:54:07 +00:00
Dev Random 6955190c7d Add Util method to load OpSys env vars 2014-02-26 23:39:45 +00:00
Justin Clark-Casey (justincc) 733e067958 Log information about which function, request data and agent ID triggered an XmlRpcGroupsServiceConnector error 2014-02-14 21:28:45 +00:00
Robert Adams 08fa0a6a8a Fix casting error for float type INI file parameter parsing. 2014-01-19 07:26:55 -08:00
Justin Clark-Casey (justincc) b5ef585069 Merge branch 'justincc-master' 2014-01-11 01:22:42 +00:00
Oren Hurvitz bc0ff5e7d4 Allow Boolean nodes in XML to be specified as "0/1". AuroraSim does that. 2014-01-11 00:54:41 +00:00
Robert Adams d9848943a9 Add routines in Util.cs for conversion of region handles to region
locations and for the conversion of region world location to region
'region' location. These routines will replace all the arithmatic
scattered throughout OpenSimulator.
2014-01-04 19:01:03 -08:00
Justin Clark-Casey (justincc) 431156f6c4 minor simplification of some unix date functions in Util. No functional change. 2013-09-03 00:17:50 +01:00
Justin Clark-Casey (justincc) 4035badd20 Add experimental "show grid users online" console command to show grid users online from a standalone/robust instance.
This is not guaranteed to be accurate since users may be left "online" in certain situations.
For example, if a simulator crashes and they never login/logout again.
To counter this somewhat, only users continuously online for less than 5 days are shown.
2013-09-03 00:04:12 +01:00
Kevin Cozens 64216b34a4 Fixed error in BuildFakeParcelID() which was detected by regression tests. 2013-08-08 01:02:04 +01:00
Dan Lake ae997fffee Merge branch 'master' of git://opensimulator.org/git/opensim 2013-07-18 02:28:36 -07:00
Dan Lake 6572847518 Added MinPoolThreads to ini [Startup] section to control SmartThreadPool. 2013-07-18 02:28:07 -07:00
Justin Clark-Casey (justincc) 077be8b496 Fix what apepars to be a bug in DoubleQueue<T>.Enqueue(Queue<T> q, T data) where the q parmater is ignored and everyghig is always placed on m_lowQueue.
No actual impact presently since nothing ends up calling EnqueueHigh()
2013-07-18 01:23:33 +01:00
Diva Canto 60325f81d8 This might address the following observed exception:
17:14:28 - [APPLICATION]:
APPLICATION EXCEPTION DETECTED: System.UnhandledExceptionEventArgs
Exception: System.InvalidOperationException: Operation is not valid due to the current state of the object
  at System.Collections.Generic.Queue`1[OpenSim.Region.ClientStack.Linden.WebFetchInvDescModule+aPollRequest].Peek () [0x00011] in /root/install/mono-3.1.0/mono/mcs/class/System/System.Collections.Generic/Queue.cs:158
  at System.Collections.Generic.Queue`1[OpenSim.Region.ClientStack.Linden.WebFetchInvDescModule+aPollRequest].Dequeue () [0x00000] in /root/install/mono-3.1.0/mono/mcs/class/System/System.Collections.Generic/Queue.cs:140
  at OpenSim.Framework.DoubleQueue`1[OpenSim.Region.ClientStack.Linden.WebFetchInvDescModule+aPollRequest].Dequeue (TimeSpan wait, OpenSim.Region.ClientStack.Linden.aPollRequest& res) [0x0004e] in /home/avacon/opensim_2013-07-14/OpenSim/Framework/Util.cs:2297
2013-07-15 10:29:42 -07:00
Justin Clark-Casey (justincc) 44e9849ed1 Fix regression where llHTTPRequests which did not get an OK response returned 499 and the exception message in the http_response event rather than the actual response code and body.
This was a regression since commit 831e4c3 (Thu Apr 4 00:36:15 2013)
This commit also adds a regression test for this case, though this currently only works with Mono
This aims to address http://opensimulator.org/mantis/view.php?id=6704
2013-07-11 23:02:30 +01:00
Justin Clark-Casey (justincc) b7c9dee033 refactor: Move existing code to generate report information on the threadpool to the ServerBase rather than being in Util 2013-06-17 23:57:10 +01:00
Justin Clark-Casey (justincc) c0a00cd7fd Fix bug where no threadpool data would be displayed in the "show threads" command if threadpool type was QueueUserWorkItem (Unsafe worked as expected) 2013-06-17 23:34:09 +01:00
Melanie a7dbafb0e3 Port Avination's inventory send throttling 2013-06-05 23:42:50 +01:00
Justin Clark-Casey (justincc) 06ab168897 To further help with tracking down the apperance of too much "Unknown User" in chatlogs, etc. temporarily change each instance of this in OpenSimulator so we can identify where it's coming from
For instance, the "Unknown User" in Util.ParseUniversalUserIdenitifer becaomes "Unknown UserUPUUI (class initials + method initials)
This is to help with http://opensimulator.org/mantis/view.php?id=6625
2013-05-21 22:26:15 +01:00
Justin Clark-Casey (justincc) 206fb306a7 Update SmartThreadPool to latest version 2.2.3 with a major and minor change.
SmartThreadPool code comes from http://www.codeproject.com/Articles/7933/Smart-Thread-Pool
This version implements thread abort (via WorkItem.Cancel(true)), threadpool naming, max thread stack, etc. so we no longer need to manually patch those.
However, two changes have been made to stock 2.2.3.
Major change: WorkItem.Cancel(bool abortExecution) in our version does not succeed if the work item was in progress and thread abort was not specified.
This is to match previous behaviour where we handle co-operative termination via another mechanism rather than checking WorkItem.IsCanceled.
Minor change: Did not add STP's StopWatch implementation as this is only used WinCE and Silverlight and causes a build clash with System.Diagnostics.StopWatch
The reason for updating is to see if this improves http://opensimulator.org/mantis/view.php?id=6557 and http://opensimulator.org/mantis/view.php?id=6586
2013-05-01 19:01:43 +01:00
Melanie 5f4c4df227 Phase 1 of implementing a transfer permission. Overwrite libOMV's PermissionMask
with our own and add export permissions as well as a new definition for "All" as meaning "all conventional permissions" rather than "all possible permissions"
2013-03-26 03:40:06 +00:00
Justin Clark-Casey (justincc) 39a0928052 minor: Remove some mono compiler warnings in OpenSim.Framework.dll 2013-03-13 23:17:27 +00:00
Justin Clark-Casey (justincc) d0cb4fc326 Move map related settings from [Startup] to a new [Map] section in OpenSim.ini
Existing map settings in [Startup] will continue to work, and if present will override anything in [Map]
However, the proper place for such settings would now be [Map]
This is to reduce the use of [Startup] as a bag for non-generic settings which should really go in sections, in common with other settings.
This commit also extends Diva's previous work to allow a default setting to be given when looking at multiple sections for settings.
2013-02-25 23:04:38 +00:00
Diva Canto 0e8289cd00 Added new Util function for reading config vars that's more generic than the one I added yesterday -- this is for helping move config vars out of [Startup] 2013-02-22 15:57:33 -08:00
Diva Canto e515cdddec Simplification of HG configs: HomeURI and GatekeeperURI now are defined as default under [Startup]. They can then be overwritten in the other sections (but probably shouldn't). I kept the existing code for backwards compatibility, so this should not cause any breaks from people's current configurations. But people should move to have these 2 vars under [Startup] -- see OpenSim.ini.example and Robust.HG.ini.example. And yes, both names now end with "URI" for consistency. 2013-02-21 17:26:19 -08:00
Dan Lake df37738ce7 WebStats will now use actual logfile as specified in OpenSim.exe.config rather than hardcoded ./OpenSim.log. This allows for rotating logs and other file appender types 2013-02-06 16:44:59 -08:00
Oren Hurvitz b77da5039e Assign the SmartThreadPool name in the constructor
This is required because some threads are created in the constructor, so assigning the name afterwards would be too late.
2013-01-19 02:08:58 +00:00
Robert Adams caad1edabf Add utility function to clamp a vector to a maximum magnitude. 2013-01-17 14:44:54 -08:00
Oren Hurvitz 1b826b4877 Allow registering regions whose names are equivalent under LIKE but not truly equal 2013-01-02 23:31:19 +00:00
Justin Clark-Casey (justincc) bc9a7ba0d6 minor: Assign names to the different SmartThreadPools for debugging purposes.
A different approach to the patch in http://opensimulator.org/mantis/view.php?id=6462
that doesn't involve further forking of SmartThreadPool
2013-01-01 23:57:20 +00:00