[mapguide-trac] #1131: Load balancing doesn't support failover
MapGuide Open Source
trac_mapguide at osgeo.org
Wed Dec 16 22:33:16 EST 2009
#1131: Load balancing doesn't support failover
--------------------------+-------------------------------------------------
Reporter: brucedechant | Owner: brucedechant
Type: defect | Status: reopened
Priority: low | Milestone: 2.2
Component: General | Version: 2.1.0
Severity: minor | Resolution:
Keywords: | External_id:
--------------------------+-------------------------------------------------
Changes (by christinebao):
* status: closed => reopened
* resolution: fixed =>
Comment:
After adding NULL pointer check, server unit test won't crash because of
calling NULL pointer, but it still has 4 test cases fails.
This is because of code:[[BR]]
{{{
MgConnectionProperties* MgSiteManager::GetConnectionProperties(
MgUserInformation* userInfo, MgSiteInfo::MgPortType portType, bool
useSessionIp)
{
…
if (length > MgSiteInfo::HexStringLength)
{
STRING siteHexString = sessionId.substr(
length - MgSiteInfo::HexStringLength,
MgSiteInfo::HexStringLength);
Ptr<MgSiteInfo> siteInfo = GetSiteInfo(siteHexString);
if ((NULL != siteInfo.p) && (MgSiteInfo::Ok ==
siteInfo->GetStatus()))
{
connProps = GetConnectionProperties(userInfo, siteInfo,
portType);
}
else
{
// This site is not currently working
// We have a session, but it will not exist on any other
machine so we force the session exception
throw new
MgSessionExpiredException(L"MgSiteManager.GetConnectionProperties",__LINE__,__WFILE__,
NULL, L"", NULL);
}
}
}}}
[[BR]]
siteInfo from GetSiteInfo(siteHexString) is NULL, and an exception throw
out saying session expired.
Compared with the code before:[[BR]]
{{{
Ptr<MgSiteInfo> siteInfo = new MgSiteInfo(siteHexString);
if (MgSiteInfo::Ok == siteInfo->GetStatus())
{
connProps = GetConnectionProperties(userInfo, siteInfo,
portType);
}
}}}
[[BR]]
Personally I think in the GetSiteInfo(…) function, if matchingSiteInfo is
not found, we can new an instance of it. The code could be:[[BR]]
{{{
MgSiteInfo* MgSiteManager::GetSiteInfo(CREFSTRING hexString)
{
MgSiteInfo* matchingSiteInfo = NULL;
…
if (matchingSiteInfo == NULL)
matchingSiteInfo = new MgSiteInfo(hexString);
return SAFE_ADDREF(matchingSiteInfo);
}
}}}
[[BR]]
I tested it in unit test, and all test cases pass.
--
Ticket URL: <http://trac.osgeo.org/mapguide/ticket/1131#comment:7>
MapGuide Open Source <http://mapguide.osgeo.org/>
MapGuide Open Source Internals
More information about the mapguide-trac
mailing list