Skip to content

Commit

Permalink
Merge pull request #489 from mtconnect/487_agent_crash
Browse files Browse the repository at this point in the history
Agent crash when performing current after reloading identical Device.xml file
  • Loading branch information
wsobel authored Sep 23, 2024
2 parents 5d1510c + 1efb81b commit e2c5313
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 27 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set(AGENT_VERSION_MAJOR 2)
set(AGENT_VERSION_MINOR 4)
set(AGENT_VERSION_PATCH 0)
set(AGENT_VERSION_BUILD 1)
set(AGENT_VERSION_BUILD 2)
set(AGENT_VERSION_RC "")

# This minimum version is to support Visual Studio 2019 and C++ feature checking and FetchContent
Expand Down
1 change: 1 addition & 0 deletions conan/profiles/vs32
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ compiler.runtime=static
compiler.runtime_type=Release
build_type=Release


1 change: 1 addition & 0 deletions conan/profiles/vs32debug
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ arch=x86
compiler.runtime=static
compiler.runtime_type=Debug
build_type=Debug

1 change: 1 addition & 0 deletions conan/profiles/vs32shared
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ compiler.runtime=dynamic
compiler.runtime_type=Release
build_type=Release


[options]
shared=True
2 changes: 1 addition & 1 deletion conan/profiles/vs64
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ compiler.cppstd=17
arch=x86_64
compiler.runtime=static
compiler.runtime_type=Release
build_type=Release
build_type=Release
1 change: 0 additions & 1 deletion conan/profiles/vs64debug
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ arch=x86_64
compiler.runtime=static
compiler.runtime_type=Debug
build_type=Debug

25 changes: 1 addition & 24 deletions src/mtconnect/agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,27 +568,7 @@ namespace mtconnect {
LOG(error) << "Device does not have a name: " << *device->getUuid();
return false;
}

// if different, and revise to new device leaving in place
// the asset changed, removed, and availability data items
ErrorList errors;
if (auto odi = oldDev->getAssetChanged(), ndi = device->getAssetChanged(); odi && !ndi)
device->addDataItem(odi, errors);
if (auto odi = oldDev->getAssetRemoved(), ndi = device->getAssetRemoved(); odi && !ndi)
device->addDataItem(odi, errors);
if (auto odi = oldDev->getAvailability(), ndi = device->getAvailability(); odi && !ndi)
device->addDataItem(odi, errors);
if (auto odi = oldDev->getAssetCount(), ndi = device->getAssetCount(); odi && !ndi)
device->addDataItem(odi, errors);

if (errors.size() > 0)
{
LOG(error) << "Error adding device required data items for " << *device->getUuid() << ':';
for (const auto &e : errors)
LOG(error) << " " << e->what();
return false;
}


verifyDevice(device);
createUniqueIds(device);

Expand Down Expand Up @@ -929,9 +909,6 @@ namespace mtconnect {
{
NAMED_SCOPE("Agent::initializeDataItems");

// Grab data from configuration
string time = getCurrentTime(GMT_UV_SEC);

// Initialize the id mapping for the devices and set all data items to UNAVAILABLE
for (auto item : device->getDeviceDataItems())
{
Expand Down

0 comments on commit e2c5313

Please sign in to comment.