mongodb-erlang icon indicating copy to clipboard operation
mongodb-erlang copied to clipboard

high CPU usage when replica set node down

Open arthur-xie opened this issue 7 years ago • 3 comments

When we shutdown one node of a replica set, the beam process consumes about 120%(multiple cores) CPU. After some debugging, we found when any node down, the mc_monitor:check will crash on line {ok, Conn} = mc_worker_api:connect(ConnectArgs) because of unmatch between {error, econnrefused} and {ok, Conn}. This will make mc_monitor step into dead loop(no sleep because the Type is unknown).

arthur-xie avatar Aug 08 '17 08:08 arthur-xie

Hi. Yes, this is a known problem. Can you mention all the steps to reproduce the problem? I would like to write a test on this as i don't have any replica set right now.

comtihon avatar Aug 29 '17 08:08 comtihon

Any update on this?

wandermyz avatar Jan 24 '19 20:01 wandermyz

I am having the same issue - Steps to reproduce.

  1. Have a mongodb replica server with 3 replicas.
  2. Turn off one of the secondary replica, which doesnt affect overall cluster, there is still one primary and one secondary.
  3. check with top on the machine with erlang mqtt driver running. You'll see beam.smp on top consuming high CPU.

arihantdaga avatar May 01 '19 18:05 arihantdaga