Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: MockSession example and default allocator [172764384] #154

Merged
merged 2 commits into from
Nov 15, 2023

Conversation

678098
Copy link
Collaborator

@678098 678098 commented Nov 14, 2023

14NOV2023_17:13:53.982763 48988 8674795648 ERROR ~/blazingmq/src/groups/bmq/bmqa/bmqa_mocksession.cpp 113 UNINITIALIZED_LOGGER_MANAGER [ Description: 'Bad value for argument 'flags' in call to 'bmqa::OpenQueueStatus openQueueSync(QueueId *queueId,const bmqt::Uri& uri,bsls::Types::Uint64 flags,const bmqt::QueueOptions& options,const bsls::TimeInterval& timeout)': expected '2', got '10' (~/blazingmq/src/tutorials/subscriptions/consumer.cpp:857)', File: '~/blazingmq/src/tutorials/subscriptions/consumer.cpp:857' ] FATAL ~/blazingmq/src/groups/bmq/bmqa/bmqa_mocksession.cpp:123 Assertion failed: false zsh: abort ./consumer.tsk

@678098 678098 requested a review from a team as a code owner November 14, 2023 17:11
@@ -492,7 +492,7 @@
// // Next we expect a call to 'openQueue' to open the queue.
// bmqa::OpenQueueStatus result = mockSession.openQueueSync(&queueId,
// uri,
// 10);
// flags);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem was caused by this line. We have set expected flags == 2 (READER) here:

// // Initialize the queue flags for a consumer
// bsls::Types::Uint64 flags = 0;
// bmqt::QueueFlagsUtil::setReader(&flags);
//

And now we try to open queue with flags READER | ACK

@pniedzielski pniedzielski self-requested a review November 14, 2023 17:18
implPtr = EventImplSp(new (*allocator)
bmqimp::Event(g_bufferFactory_p, allocator),
allocator);
implPtr = EventImplSp(new (*alloc)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed some places where new was called with allocator pointer not wrapped with bslma::Default::allocator. These places were causing crashes when allocator = 0 passed.

pniedzielski
pniedzielski previously approved these changes Nov 14, 2023
Copy link
Collaborator

@pniedzielski pniedzielski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two independent changes, right? bslma::Default::allocator and avoiding the hardcoded value for flags.

LGTM

@678098
Copy link
Collaborator Author

678098 commented Nov 14, 2023

@pniedzielski re-run clang-format

@pniedzielski pniedzielski self-requested a review November 14, 2023 17:24
@pniedzielski
Copy link
Collaborator

@678098 on src/groups/bmq/bmqa/bmqa_mocksession.cpp as well :)

@678098
Copy link
Collaborator Author

678098 commented Nov 14, 2023

@678098 on src/groups/bmq/bmqa/bmqa_mocksession.cpp as well :)

I formatted it with clang-format 16.0.6 and it makes a different formatting from CI

@678098
Copy link
Collaborator Author

678098 commented Nov 14, 2023

llvm/llvm-project#54703
Looks like a fixed bug

@678098 678098 force-pushed the 231114_mocksession_example branch from 62de9f8 to b04e79c Compare November 14, 2023 17:48
@678098 678098 added the A-Client Area: C++ SDK label Nov 14, 2023
Copy link
Collaborator

@pniedzielski pniedzielski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a failure in the CI that doesn't appear to have to do with this PR (it's failing on main as well, and doesn't appear on local builds). This PR is good to go, but we'll investigate that issue separately.

@678098 678098 merged commit cd34cf5 into bloomberg:main Nov 15, 2023
5 of 6 checks passed
@678098 678098 deleted the 231114_mocksession_example branch November 15, 2023 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Client Area: C++ SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants