Skip to content

rgw/notification: Kafka persistent notifications not retried and removed even when the broker is down - #54215

Merged
yuvalif merged 1 commit into
ceph:mainfrom
kchheda3:wip-fix-kafka-break
Dec 6, 2023
Merged

yuvalif merged 1 commit into
ceph:mainfrom
kchheda3:wip-fix-kafka-break

Conversation

@kchheda3

@kchheda3 kchheda3 commented Oct 26, 2023 •

Copy link
Copy Markdown
Contributor

Currently the way, Kafka processing works is when the ACK level is set to broker, the notification is sent to kafka using the rd_kafka_produce(), which currently DOES not return -1 if the BROKER is down.
But when the broker is down, the CALLBACK from kafka acknowledgement is NEVER returned and hence this ack is propagated back to notification system which then does a retry and does not delete the persistent notification from queue.

But after the #51864, the connection was destroyed after idle_timeout and callbacks were invoked with SUCCESS coz default status was SUCCESS, so even tho the notification were not delivered, they were removed from the queue because the callback was invoked with success.

Fixes https://tracker.ceph.com/issues/63335

Contribution Guidelines

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@kchheda3
kchheda3 force-pushed the wip-fix-kafka-break branch from f3a5dfa to 9de3855 Compare October 26, 2023 19:39
@kchheda3
kchheda3 force-pushed the wip-fix-kafka-break branch from 9de3855 to c055ae1 Compare October 26, 2023 19:58
@kchheda3 kchheda3 changed the title Wip-fix-kafka-break rgw/notification: Persistent messages not tried and removed even when the broker is down Oct 26, 2023
@kchheda3
kchheda3 marked this pull request as ready for review October 26, 2023 20:00
@kchheda3
kchheda3 requested a review from a team as a code owner October 26, 2023 20:00
@kchheda3 kchheda3 changed the title rgw/notification: Persistent messages not tried and removed even when the broker is down rgw/notification: Kafka persistent notifications not retried and removed even when the broker is down Oct 26, 2023
@yuvalif

yuvalif commented Oct 29, 2023

Copy link
Copy Markdown
Contributor

@kchheda3 thanks for the fix.
probably better to add the following line:

conn_it->second->status = STATUS_CONNECTION_IDLE;

before line 466. to make sure that if dtor is invoked with some other reason we don't override it (though, currently there is no difference between the fixes).


on a different note (and probably in a different PR), the librdkafka library should have its own retry mechanism. which is controlled by both global and topic level parameters:
https://docs.confluent.io/platform/current/clients/librdkafka/html/md_CONFIGURATION.html
ideally, when the broker is down, we just let the library fail the request according to these parameters, so we don't have to wait for the idle timeout to kick in in order for the message to fail.
this would requires some tuning, deriving the retry parameters from the idle timeout (maybe 50% of idle timeout?), and probably allow setting the idle timeout as a conf paramter

@yuvalif

yuvalif commented Oct 29, 2023

Copy link
Copy Markdown
Contributor

another small fix (unrelated to this one): the queue length logged in line 424 is off by 1. since the length is taken before emplace the new callback in the queue. could you please log q_len + 1 ?

@kchheda3

Copy link
Copy Markdown
Contributor Author

@kchheda3 thanks for the fix.
probably better to add the following line:

conn_it->second->status = STATUS_CONNECTION_IDLE;

before line 466. to make sure that if dtor is invoked with some other reason we don't override it (though, currently there is no difference between the fixes).


on a different note (and probably in a different PR), the librdkafka library should have its own retry mechanism. which is controlled by both global and topic level parameters:
https://docs.confluent.io/platform/current/clients/librdkafka/html/md_CONFIGURATION.html
ideally, when the broker is down, we just let the library fail the request according to these parameters, so we don't have to wait for the idle timeout to kick in in order for the message to fail.
this would requires some tuning, deriving the retry parameters from the idle timeout (maybe 50% of idle timeout?), and probably allow setting the idle timeout as a conf paramter

Yep that would definitely make sense.. instead of waiting for the callback to reflect the actual status we should have the retries param of kafka configured.
However that will still not solve the issue where if the broker is down, the kafka_produce should return error.

@kchheda3
kchheda3 force-pushed the wip-fix-kafka-break branch from c055ae1 to b2fadb6 Compare October 30, 2023 14:05
@kchheda3

Copy link
Copy Markdown
Contributor Author

another small fix (unrelated to this one): the queue length logged in line 424 is off by 1. since the length is taken before emplace the new callback in the queue. could you please log q_len + 1 ?

done

@yuvalif

yuvalif commented Oct 31, 2023

Copy link
Copy Markdown
Contributor

teuthology is failing due to a crash: http://pulpito.front.sepia.ceph.com/yuvalif-2023-10-31_07:50:02-rgw:notifications-wip-yuval-kafka-break-distro-default-smithi/

could not find an actual crash, but seen this in the test log:

2023-10-31T08:22:43.503 INFO:tasks.rgw.client.0.smithi125.stdout:Fatal glibc error: tpp.c:87 (__pthread_tpp_change_priority): assertion failed: previous_prio == -1 || (previous_prio >= fifo_min_prio && previous_prio <= fifo_max_prio)
2023-10-31T08:22:43.504 INFO:tasks.rgw.client.0.smithi125.stdout:*** Caught signal (Segmentation fault) **
2023-10-31T08:22:43.504 INFO:tasks.rgw.client.0.smithi125.stdout: in thread 7f5379e2b640 thread_name:radosgw
2023-10-31T08:22:43.683 INFO:tasks.rgw.client.0.smithi125.stderr:daemon-helper: command crashed with signal 6

this is similar to the crash tracked here: https://tracker.ceph.com/issues/63314
found this issue in the librdkafka repo: confluentinc/librdkafka#3688 that seems related.

@kchheda3

Copy link
Copy Markdown
Contributor Author

teuthology is failing due to a crash: http://pulpito.front.sepia.ceph.com/yuvalif-2023-10-31_07:50:02-rgw:notifications-wip-yuval-kafka-break-distro-default-smithi/

could not find an actual crash, but seen this in the test log:

2023-10-31T08:22:43.503 INFO:tasks.rgw.client.0.smithi125.stdout:Fatal glibc error: tpp.c:87 (__pthread_tpp_change_priority): assertion failed: previous_prio == -1 || (previous_prio >= fifo_min_prio && previous_prio <= fifo_max_prio)
2023-10-31T08:22:43.504 INFO:tasks.rgw.client.0.smithi125.stdout:*** Caught signal (Segmentation fault) **
2023-10-31T08:22:43.504 INFO:tasks.rgw.client.0.smithi125.stdout: in thread 7f5379e2b640 thread_name:radosgw
2023-10-31T08:22:43.683 INFO:tasks.rgw.client.0.smithi125.stderr:daemon-helper: command crashed with signal 6

this is similar to the crash tracked here: https://tracker.ceph.com/issues/63314 found this issue in the librdkafka repo: confluentinc/librdkafka#3688 that seems related.

hmm.. so this crash is unrelated to the fix then

@yuvalif

yuvalif commented Oct 31, 2023

Copy link
Copy Markdown
Contributor

teuthology is failing due to a crash: http://pulpito.front.sepia.ceph.com/yuvalif-2023-10-31_07:50:02-rgw:notifications-wip-yuval-kafka-break-distro-default-smithi/
could not find an actual crash, but seen this in the test log:

2023-10-31T08:22:43.503 INFO:tasks.rgw.client.0.smithi125.stdout:Fatal glibc error: tpp.c:87 (__pthread_tpp_change_priority): assertion failed: previous_prio == -1 || (previous_prio >= fifo_min_prio && previous_prio <= fifo_max_prio)
2023-10-31T08:22:43.504 INFO:tasks.rgw.client.0.smithi125.stdout:*** Caught signal (Segmentation fault) **
2023-10-31T08:22:43.504 INFO:tasks.rgw.client.0.smithi125.stdout: in thread 7f5379e2b640 thread_name:radosgw
2023-10-31T08:22:43.683 INFO:tasks.rgw.client.0.smithi125.stderr:daemon-helper: command crashed with signal 6

this is similar to the crash tracked here: https://tracker.ceph.com/issues/63314 found this issue in the librdkafka repo: confluentinc/librdkafka#3688 that seems related.

hmm.. so this crash is unrelated to the fix then

yes. but the test are not running due to the crash

@kchheda3

kchheda3 commented Nov 1, 2023

Copy link
Copy Markdown
Contributor Author

2023-10-31T08:22:43.504 INFO:tasks.rgw.client.0.smithi125.stdout:*** Caught signal (Segmentation fault) **

not able to open the pulpito/sepia link, for which test case is the crash happening while running the bn_test.py ?
i am guessing if the crash is consistent for one of the tests, then we cannot merge the PR?

@cbodley

cbodley commented Nov 9, 2023

Copy link
Copy Markdown
Contributor

2023-10-31T08:22:43.504 INFO:tasks.rgw.client.0.smithi125.stdout:*** Caught signal (Segmentation fault) **

not able to open the pulpito/sepia link, for which test case is the crash happening while running the bn_test.py ? i am guessing if the crash is consistent for one of the tests, then we cannot merge the PR?

the public link is http://pulpito.ceph.com/yuvalif-2023-10-31_07:50:02-rgw:notifications-wip-yuval-kafka-break-distro-default-smithi/

@kchheda3

kchheda3 commented Dec 5, 2023

Copy link
Copy Markdown
Contributor Author

@yuvalif can we merge this pull request ?

@yuvalif

yuvalif commented Dec 5, 2023

Copy link
Copy Markdown
Contributor

@yuvalif can we merge this pull request ?

i will rerun teuthology (the cras hthat prevented the run is now fixed)

@yuvalif

yuvalif commented Dec 6, 2023

Copy link
Copy Markdown
Contributor

teuthology run: https://pulpito.ceph.com/yuvalif-2023-12-06_05:25:59-rgw:notifications-wip-yuval-test-63335-distro-default-smithi/
has one failure with unrelated test - as its test persistent notification stats with HTTP and not kafka

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants