Skip to content

Commit

Permalink
ASAN fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eisenhauer committed Jan 4, 2024
1 parent c093fb1 commit dd9bfdb
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 15 deletions.
11 changes: 0 additions & 11 deletions CTestConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,4 @@ set(MEMORYCHECK_SUPPRESSIONS_FILE ${CMAKE_SOURCE_DIR}/scripts/dashboard/nightly/

# Ignore tests that are currently failing, remove tests here as they are fixed
list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE
Remote.BPWriteReadADIOS2stdio.GetRemote
Remote.BPWriteMemorySelectionRead.GetRemote
Remote.BPWriteMemorySelectionRead.FileRemote
remoteServerCleanup
Engine.SST.SstWriteFails.InvalidBeginStep.Serial
Staging.1x1.Local2.CommMin.BP5.SST
Staging.1x1Struct.CommMin.BP5.SST
Staging.WriteMemorySelectionRead.1x1.CommMin.BP5.SST
Staging.1x1.Local2.CommMin.BP.SST
Staging.WriteMemorySelectionRead.1x1.CommMin.BP.SST
Staging.1x1Struct.BP5
)
4 changes: 3 additions & 1 deletion scripts/ci/cmake/adios-asan.supp
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
leak:ps_make_timer_name_
leak:ibv_get_device_list
leak:ibv_get_device_list
leak:add_transport_to_cm
leak:INT_CMadd_delayed_task
4 changes: 4 additions & 0 deletions source/adios2/toolkit/format/bp5/BP5Deserializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1986,6 +1986,10 @@ BP5Deserializer::~BP5Deserializer()
free(VarRec.second->VarName);
if (VarRec.second->Operator)
free(VarRec.second->Operator);
if (VarRec.second->Def)
delete VarRec.second->Def;
// if (VarRec.second->ReaderDef)
// delete VarRec.second->ReaderDef;
delete VarRec.second;
}
if (m_FreeableMBA)
Expand Down
6 changes: 6 additions & 0 deletions source/adios2/toolkit/format/bp5/BP5Serializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ namespace format
BP5Serializer::BP5Serializer() { Init(); }
BP5Serializer::~BP5Serializer()
{
if (CurDataBuffer)
delete CurDataBuffer;
if (!Info.RecNameMap.empty())
{
for (auto &rec : Info.RecNameMap)
Expand Down Expand Up @@ -553,6 +555,8 @@ BP5Serializer::BP5WriterRec BP5Serializer::CreateWriterRec(void *Variable, const
struct_list[0].struct_size = (int)SD->StructSize();

FMFormat Format = register_data_format(Info.LocalFMContext, &struct_list[0]);
free_FMfield_list(List);
free((void *)struct_list[0].format_name);

int IDLength;
char *ServerID = get_server_ID_FMformat(Format, &IDLength);
Expand Down Expand Up @@ -639,6 +643,8 @@ BP5Serializer::BP5WriterRec BP5Serializer::CreateWriterRec(void *Variable, const
// Changing the formats renders these invalid
Info.MetaFormat = NULL;
}
if (TextStructID)
free((void *)TextStructID);
Info.RecCount++;
return Rec;
}
Expand Down
13 changes: 11 additions & 2 deletions source/adios2/toolkit/remote/Remote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ namespace adios2
Remote::Remote() {}

#ifdef ADIOS2_HAVE_SST
Remote::~Remote()
{
if (m_conn)
CMConnection_close(m_conn);
}

void OpenResponseHandler(CManager cm, CMConnection conn, void *vevent, void *client_data,
attr_list attrs)
{
Expand Down Expand Up @@ -86,9 +92,10 @@ void Remote::Open(const std::string hostname, const int32_t port, const std::str
atom_t CM_IP_HOSTNAME = -1;
CM_IP_HOSTNAME = attr_atom_from_string("IP_HOST");
CM_IP_PORT = attr_atom_from_string("IP_PORT");
add_attr(contact_list, CM_IP_HOSTNAME, Attr_String, (attr_value)hostname.c_str());
add_attr(contact_list, CM_IP_HOSTNAME, Attr_String, (attr_value)strdup(hostname.c_str()));
add_attr(contact_list, CM_IP_PORT, Attr_Int4, (attr_value)port);
m_conn = CMinitiate_conn(ev_state.cm, contact_list);
free_attr_list(contact_list);
if (!m_conn)
return;

Expand Down Expand Up @@ -124,9 +131,10 @@ void Remote::OpenSimpleFile(const std::string hostname, const int32_t port,
atom_t CM_IP_HOSTNAME = -1;
CM_IP_HOSTNAME = attr_atom_from_string("IP_HOST");
CM_IP_PORT = attr_atom_from_string("IP_PORT");
add_attr(contact_list, CM_IP_HOSTNAME, Attr_String, (attr_value)hostname.c_str());
add_attr(contact_list, CM_IP_HOSTNAME, Attr_String, (attr_value)strdup(hostname.c_str()));
add_attr(contact_list, CM_IP_PORT, Attr_Int4, (attr_value)port);
m_conn = CMinitiate_conn(ev_state.cm, contact_list);
free_attr_list(contact_list);
if (!m_conn)
return;

Expand Down Expand Up @@ -193,5 +201,6 @@ Remote::GetHandle Remote::Read(size_t Start, size_t Size, void *Dest)
{
return static_cast<GetHandle>(0);
};
Remote::~Remote() {}
#endif
} // end namespace adios2
3 changes: 2 additions & 1 deletion source/adios2/toolkit/remote/Remote.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Remote
* @param comm passed to m_Comm
*/
Remote();
~Remote();

explicit operator bool() const { return m_Active; }

Expand All @@ -55,7 +56,7 @@ class Remote
#ifdef ADIOS2_HAVE_SST
void InitCMData();
RemoteCommon::Remote_evpath_state ev_state;
CMConnection m_conn;
CMConnection m_conn = NULL;
std::mutex m_CMInitMutex;
#endif
bool m_Active = false;
Expand Down
1 change: 1 addition & 0 deletions source/adios2/toolkit/remote/remote_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ typedef struct _CloseFileMsg
typedef struct _KillServerMsg
{
int KillResponseCondition;
size_t unused; // small messages call stack addressing issues?
} *KillServerMsg;

typedef struct _KillResponseMsg
Expand Down
1 change: 1 addition & 0 deletions source/adios2/toolkit/sst/cp/cp_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,7 @@ static void waitForMetadataWithTimeout(SstStream Stream, float timeout_secs)
if (timercmp(&now, &end, >))
{
CP_verbose(Stream, PerRankVerbose, "Returning from wait after timing out\n");
free(TimeoutTask);
return;
}
/* wait until we get the timestep metadata or something else changes */
Expand Down

0 comments on commit dd9bfdb

Please sign in to comment.