Improper use of Raft::metrics()
can block the RaftCore async task and underlying OS thread
#1238
Closed
2 of 6 tasks
What kind of doc do you ask for?
Describe the information you want
Document that:
When your
AsyncRuntime::Watch
usestokio::watch
, you useRaft::metrics()/server_metrics()/data_metrics()
interface and hold the acquiredWatch::Ref
instance in an improper way, this can block the RaftCore async task as well as the underlying OS thread. If you are using a single-threaded runtime, like Monoio, everything is blocked now.Root cause:
tokio::watch
uses synchronousRwLock
,Watch::Ref
contains a read guard, and the first thing that the RaftCore async task does isflush_metrics()
, which needs to acquire the write guard, if there is aWatch::Ref
instance exists,flush_metrics()
will wait, thus it blocks the RaftCore async task and the underlying OS thread.Describe the status of the current doc
Is there any doc yet?:
Currently we don't have any doc on this.
What other information should be added?
I guess no.
I'll open a pull request for it:)
The text was updated successfully, but these errors were encountered: