Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 44 additions & 6 deletions .github/workflows/ci-pr-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,25 @@ jobs:
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }}
restore-keys: vcpkg-${{ runner.os }}-

- name: Restore vcpkg downloads cache
uses: actions/cache@v4
with:
path: vcpkg/downloads
key: vcpkg-downloads-${{ runner.os }}-${{ hashFiles('vcpkg.json') }}
restore-keys: vcpkg-downloads-${{ runner.os }}-

- name: Build the project
run: |
cmake -B build -DINTEGRATE_VCPKG=ON -DBUILD_TESTS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake --build build -j8
for attempt in 1 2 3; do
echo "Build attempt $attempt/3"
if cmake -B build -DINTEGRATE_VCPKG=ON -DBUILD_TESTS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON && cmake --build build -j8; then
exit 0
fi
echo "Attempt $attempt failed (e.g. vcpkg download 502), retrying in 90s..."
sleep 90
done
echo "All build attempts failed"
exit 1

- name: Tidy check
run: |
Expand Down Expand Up @@ -137,10 +152,25 @@ jobs:
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }}
restore-keys: vcpkg-${{ runner.os }}-

- name: Restore vcpkg downloads cache
uses: actions/cache@v4
with:
path: vcpkg/downloads
key: vcpkg-downloads-${{ runner.os }}-${{ hashFiles('vcpkg.json') }}
restore-keys: vcpkg-downloads-${{ runner.os }}-

- name: Build core libraries
run: |
cmake -B build -DINTEGRATE_VCPKG=ON -DBUILD_TESTS=OFF
cmake --build build -j8
for attempt in 1 2 3; do
echo "Build attempt $attempt/3"
if cmake -B build -DINTEGRATE_VCPKG=ON -DBUILD_TESTS=OFF && cmake --build build -j8; then
exit 0
fi
echo "Attempt $attempt failed (e.g. vcpkg download 502), retrying in 90s..."
sleep 90
done
echo "All build attempts failed"
exit 1

- name: Check formatting
run: |
Expand All @@ -164,8 +194,16 @@ jobs:

- name: Build with Boost.Asio
run: |
cmake -B build-boost-asio -DINTEGRATE_VCPKG=ON -DBUILD_TESTS=ON
cmake --build build-boost-asio -j8
for attempt in 1 2 3; do
echo "Build Boost.Asio attempt $attempt/3"
if cmake -B build-boost-asio -DINTEGRATE_VCPKG=ON -DBUILD_TESTS=ON && cmake --build build-boost-asio -j8; then
exit 0
fi
echo "Attempt $attempt failed (e.g. vcpkg download 502), retrying in 90s..."
sleep 90
done
echo "All build attempts failed"
exit 1

- name: Build perf tools
run: |
Expand Down
8 changes: 5 additions & 3 deletions lib/ConsumerImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,11 @@ Result ConsumerImpl::handleCreateConsumer(const ClientConnectionPtr& cnx, Result
return ResultAlreadyClosed;
}

mutexLock.unlock();
LOG_INFO(getName() << "Created consumer on broker " << cnx->cnxString());
incomingMessages_.clear();
possibleSendToDeadLetterTopicMessages_.clear();
backoff_.reset();
mutexLock.unlock();
LOG_INFO(getName() << "Created consumer on broker " << cnx->cnxString());
Comment on lines +340 to +341
Copy link
Contributor

Choose a reason for hiding this comment

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

This change still does not make sense. incomingMessages_.clear() is called in handleCreateConsumer, which happens before completing the seek callback in

Result handleResult = handleCreateConsumer(cnx, result);
if (handleResult != ResultOk) {
promise.setFailed(handleResult);
return;
}
promise.setSuccess();
// Complete the seek callback after completing `promise`, otherwise `reconnectionPending_` will
// still be true when the seek operation is done.
LockGuard lock{mutex_};
if (seekStatus_ == SeekStatus::COMPLETED) {
executor_->postWork([seekCallback{std::exchange(seekCallback_, std::nullopt).value()}]() {
seekCallback(ResultOk);

if (!messageListener_ && config_.getReceiverQueueSize() == 0) {
// Complicated logic since we don't have a isLocked() function for mutex
if (waitingForZeroQueueSizeMessage) {
Expand Down Expand Up @@ -1819,7 +1819,9 @@ void ConsumerImpl::seekAsyncInternal(long requestId, const SharedBuffer& seek, c
if (result == ResultOk) {
LockGuard lock(mutex_);
if (getCnx().expired() || reconnectionPending_) {
// It's during reconnection, complete the seek future after connection is established
// Reconnection path: delay the seek callback until connectionOpened. clearReceiveQueue()
// and handleCreateConsumer() (which clears incomingMessages_ under the lock) run before
// the seek callback is invoked, so hasMessageAvailable() after seek sees cleared state.
seekStatus_ = SeekStatus::COMPLETED;
LOG_INFO(getName() << "Delay the seek future until the reconnection is done");
} else {
Expand Down
Loading