[mapguide-commits] r8987 - in branches/3.1/MgDev: . Oem/geos/src/io Server/src/Services/Rendering

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Jul 13 06:20:05 PDT 2016


Author: jng
Date: 2016-07-13 06:20:04 -0700 (Wed, 13 Jul 2016)
New Revision: 8987

Modified:
   branches/3.1/MgDev/
   branches/3.1/MgDev/Oem/geos/src/io/WKTReader.cpp
   branches/3.1/MgDev/Oem/geos/src/io/WKTWriter.cpp
   branches/3.1/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
Log:
Merged revision(s) 8986 from trunk/MgDev:
#2596: Resolve instability of QUERYMAPFEATURES under high server load. This is due primarily to an improperly scoped Ptr<MgResourceLayerDefinitionCacheItem> in MgServerRenderingService::RenderForSelection(), which combined with a refcount restriction when asking for such items from the 2nd level cache (presumably due to MdfModel classes not being vetted as thread-safe) could cause the cached MdfModel::LayerDefinition pointers to be prematurely deleted under high load.

Another fix is to disable the use of CLocalizer in the GEOS library. CLocalizer temporarily forces a "C" LC_NUMERIC locale (via std::setlocale()) when reading/writing WKT text. However, std::setlocale() is not thread-safe and mgserver already forces a "C" LC_NUMERIC locale on startup. Also as there is no traces of calls to std::setlocale() in the Web Tier code, the default LC_NUMERIC locale should already be "C" on the Web Tier. Thus the use of CLocalizer is redundant.

Patch originally proposed by Andreas Morf. Reviewed, refined and vetted by me.
........



Property changes on: branches/3.1/MgDev
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355,8365,8373
/branches/3.0/MgDev:8658,8705,8710
/sandbox/VC140:8684-8759
/sandbox/adsk/2.6l:8727
/sandbox/adsk/3.0m:8563,8584,8607,8625,8694-8695
/sandbox/adsk/3.1n:8871,8895,8901,8912-8913,8921-8922,8942
/sandbox/jng/convenience_apis:8262-8268,8271-8363
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/rfc155:8872-8884
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
/trunk/MgDev:8955-8956,8969,8980-8981
   + /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355,8365,8373
/branches/3.0/MgDev:8658,8705,8710
/sandbox/VC140:8684-8759
/sandbox/adsk/2.6l:8727
/sandbox/adsk/3.0m:8563,8584,8607,8625,8694-8695
/sandbox/adsk/3.1n:8871,8895,8901,8912-8913,8921-8922,8942
/sandbox/jng/convenience_apis:8262-8268,8271-8363
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/rfc155:8872-8884
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
/trunk/MgDev:8955-8956,8969,8980-8981,8986

Modified: branches/3.1/MgDev/Oem/geos/src/io/WKTReader.cpp
===================================================================
--- branches/3.1/MgDev/Oem/geos/src/io/WKTReader.cpp	2016-07-13 13:12:46 UTC (rev 8986)
+++ branches/3.1/MgDev/Oem/geos/src/io/WKTReader.cpp	2016-07-13 13:20:04 UTC (rev 8987)
@@ -61,7 +61,7 @@
 WKTReader::read(const string &wellKnownText)
 {
 	//auto_ptr<StringTokenizer> tokenizer(new StringTokenizer(wellKnownText));
-        CLocalizer clocale;
+        //CLocalizer clocale;
 	StringTokenizer tokenizer(wellKnownText);
 	Geometry *g=NULL;
 	g=readGeometryTaggedText(&tokenizer);

Modified: branches/3.1/MgDev/Oem/geos/src/io/WKTWriter.cpp
===================================================================
--- branches/3.1/MgDev/Oem/geos/src/io/WKTWriter.cpp	2016-07-13 13:12:46 UTC (rev 8986)
+++ branches/3.1/MgDev/Oem/geos/src/io/WKTWriter.cpp	2016-07-13 13:20:04 UTC (rev 8987)
@@ -169,7 +169,7 @@
 WKTWriter::writeFormatted(const Geometry *geometry, bool isFormatted,
                           Writer *writer)
 {
-        CLocalizer clocale;
+        //CLocalizer clocale;
 	this->isFormatted=isFormatted;
   decimalPlaces = roundingPrecision == -1 ? geometry->getPrecisionModel()->getMaximumSignificantDigits() : roundingPrecision;
 	appendGeometryTaggedText(geometry, 0, writer);

Modified: branches/3.1/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
===================================================================
--- branches/3.1/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2016-07-13 13:12:46 UTC (rev 8986)
+++ branches/3.1/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2016-07-13 13:20:04 UTC (rev 8987)
@@ -1575,13 +1575,14 @@
             break;
 
         MdfModel::VectorLayerDefinition* vl = NULL;
+        Ptr<MgResourceLayerDefinitionCacheItem> cacheItem;
         auto_ptr<MdfModel::LayerDefinition> ldf;
         Ptr<MgResourceIdentifier> layerResId = layer->GetLayerDefinition();
         if (bOnlyVisibleLayers)
         {
             //get the MDF layer definition
             MgCacheManager* cacheManager = MgCacheManager::GetInstance();
-            Ptr<MgResourceLayerDefinitionCacheItem> cacheItem = cacheManager->GetResourceLayerDefinitionCacheItem(layerResId);
+            cacheItem = cacheManager->GetResourceLayerDefinitionCacheItem(layerResId);
             MdfModel::LayerDefinition* layerDefinition = cacheItem->Get();
             vl = dynamic_cast<MdfModel::VectorLayerDefinition*>(layerDefinition);
         }
@@ -1589,6 +1590,18 @@
         {
             ldf.reset(MgLayerBase::GetLayerDefinition(m_svcResource, layerResId));
             vl = dynamic_cast<MdfModel::VectorLayerDefinition*>(ldf.get());
+
+            // Modify the layer scale range only for layers that are passed in
+            MdfModel::VectorScaleRangeCollection* scaleRanges = vl->GetScaleRanges();
+            if (scaleRanges)
+            {
+                MdfModel::VectorScaleRange* scaleRange = scaleRanges->GetAt(0);
+                if (scaleRange)
+                {
+                    scaleRange->SetMinScale(0.0);
+                    scaleRange->SetMaxScale(MdfModel::VectorScaleRange::MAX_MAP_SCALE);
+                }
+            }
         }
 
         //we can only do geometric query selection for vector layers
@@ -1596,22 +1609,6 @@
         {
             ACE_DEBUG ((LM_DEBUG, ACE_TEXT("(%t) RenderForSelection(): Layer: %W  Vector Layer\n"), layer->GetName().c_str()));
 
-            //check to see if we want even layers that aren't visible at the current scale
-            if (!bOnlyVisibleLayers)
-            {
-                // Modify the layer scale range only for layers that are passed in
-                MdfModel::VectorScaleRangeCollection* scaleRanges = vl->GetScaleRanges();
-                if (scaleRanges)
-                {
-                    MdfModel::VectorScaleRange* scaleRange = scaleRanges->GetAt(0);
-                    if (scaleRange)
-                    {
-                        scaleRange->SetMinScale(0.0);
-                        scaleRange->SetMaxScale(MdfModel::VectorScaleRange::MAX_MAP_SCALE);
-                    }
-                }
-            }
-
             Ptr<MgResourceIdentifier> featResId = new MgResourceIdentifier(layer->GetFeatureSourceId());
 
             //get a transform from layer coord sys to map coord sys



More information about the mapguide-commits mailing list