[mapguide][MG35][New] Improve tile service thread-safety
Walt Welton-Lair
walt.welton-lair at autodesk.com
Tue Feb 28 02:55:51 EST 2006
You can view the artifact detail at the following URL:
https://mapguide.osgeo.org/servlets/Scarab/id/MG35
Type
OS:Issue
Artifact ID
MG35 (Improve tile service thread-safety)
Reported by
Walt Welton-Lair
waltweltonlair (walt.welton-lair at autodesk.com)
New artifact details:
---------------------------------------------------------
- OS:Resolution set to new value
Submitted
- OS:Target Milestone set to new value
1.0.0
- OS:Type set to new value
Task
- OS:Operating System set to new value
All
- Artifact created
- OS:Priority set to new value
P1
- OS:Subcomponent set to new value
Tile Service
- OS:Resolution Description set to new value
The fix for this is easy, and also cleans up the code. ACE defines an ACE_RW_Mutex class, which is used to synchronize read /write operations. In particular, multiple simultaneous reads are allowed, but only one write can occur at any one time. Also, no reads are allowed while a write is active.
So in MgTileCache::GetTile, we simply acquire a read lock. This blocks if a write lock is already active. And then in SetTile and ClearCache we acquire a write lock. This blocks if there are any read locks or a write lock active.
- OS:Summary set to new value
Improve tile service thread-safety
- OS:Component set to new value
Server
- OS:Platform set to new value
PC
- OS:Description set to new value
Every now and then the tile service unit test will encounter an error. I tracked it down to the case where two threads are simultaneously trying to get / set the same tile. Actually it's a bit more: two threads need to be simultaneously getting a tile, while a third thread needs to be setting one of those two tiles.
The mutex logic I implemented handled the case where you have two threads concurrently setting / getting tiles. But when you add the third then a flaw in the logic was exposed. As soon as one of the "GetTile" threads finished the "SetTile" thread would think it's free to start, even though there was still another "GetTile" thread active.
- OS:Version set to new value
1.0.0
- OS:Status set to new value
New
---------------------------------------------------------
This message was automatically generated by Project Tracker.
More information about the Mapguide_issues
mailing list