Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #820 from IBM/dev-dlherms2
Browse files Browse the repository at this point in the history
bb:Fix race condition when creating/obtaining a handle for the very s…
  • Loading branch information
dlherms-ibm authored Nov 14, 2019
2 parents cb960a3 + cf84c46 commit 509ad07
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bb/src/bbserver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@ void msgin_gettransferhandle(txp::Id id, const std::string& pConnectionName, txp
verifyInitLockState();

uint64_t l_Handle = UNDEFINED_HANDLE;
int l_LocalMetadataLocked = 0;
LVKey l_LVKey;
LVKey* l_LVKeyPtr = &l_LVKey;
char lv_uuid_str[LENGTH_UUID_STR] = {'\0'};
Expand Down Expand Up @@ -745,6 +746,8 @@ void msgin_gettransferhandle(txp::Id id, const std::string& pConnectionName, txp

switchIds(msg);

lockLocalMetadata((LVKey*)0, "msgin_gettransferhandle");
l_LocalMetadataLocked = 1;
// NOTE: We set up to wait 2 minutes for the necessary LVKey to appear if we can't find
// it right away and the handle is not in the cross-bbServer metadata.
// This closes the window during activate server between the activation
Expand Down Expand Up @@ -841,6 +844,12 @@ void msgin_gettransferhandle(txp::Id id, const std::string& pConnectionName, txp
LOG_ERROR_RC_WITH_EXCEPTION(__FILE__, __FUNCTION__, __LINE__, e, rc);
}

if (l_LocalMetadataLocked)
{
l_LocalMetadataLocked = 0;
unlockLocalMetadata((LVKey*)0, "msgin_gettransferhandle");
}

// Build the response message
txp::Msg* response;
msg->buildResponseMsg(response);
Expand Down

0 comments on commit 509ad07

Please sign in to comment.