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

Commit 509ad07

Browse files
authored
Merge pull request #820 from IBM/dev-dlherms2
bb:Fix race condition when creating/obtaining a handle for the very s…
2 parents cb960a3 + cf84c46 commit 509ad07

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

bb/src/bbserver.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,7 @@ void msgin_gettransferhandle(txp::Id id, const std::string& pConnectionName, txp
700700
verifyInitLockState();
701701

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

746747
switchIds(msg);
747748

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

847+
if (l_LocalMetadataLocked)
848+
{
849+
l_LocalMetadataLocked = 0;
850+
unlockLocalMetadata((LVKey*)0, "msgin_gettransferhandle");
851+
}
852+
844853
// Build the response message
845854
txp::Msg* response;
846855
msg->buildResponseMsg(response);

0 commit comments

Comments
 (0)