Safe mode and high cpu

Hello

Today for the first time the ssh session was very laggy
After some troubleshoot I found that it was linked to safe mode.
When the router takes the safe mode, 1 cpu thread goes 100% (even without any change)

I try on 2 differents rtr chateau 5g-ax and r16 both 7.16.1.
In the past I didn’t notice that om rb2001/rb3001…

Any of you have ever notice it?
Thanks
Rabbitkiller

Observing the same problem. When you enable safe mode the session becomes extremely unresponsive and the CPU usage goes to 100%. Here is a comparison of the output of /tool/profile with safe mode on/off on a CRS326-24S+2Q+ with RouterOS v7.16.2. The same behavior is observed in a RB5009UPr+S+ with RouterOS v7.16

Safe Mode ON
safe-mode-off.png
Safe Mode OFF
safe-mode-on.png

It seems appear only when we had some change no commit.
it very strange because I didn’t notice it before.
I try the different 7.16.x.

I have a RB5009UPr+S+ and am currently on 7.19.1 and are having the same issue with high CPU load when entering safe mode.

Screenshots by @carragom show high CPU usage of ssh, encrypting, console and management categories. Which all contribute to CLI over SSH. It's hard to understand why all of this would happen when enabling safe mode as it only really affects management (ROS needs to keep command history to potentially roll-back those commands). IMO it shouldn't affect neither ssh, encrypting nor console processes.

Just to check I did the following experiment on RB951G, audience, wAP ax and hAP ac2, all running ROS 7.18.2:

  1. connect as non-administrative user via SSH
  2. enable safe mode by pressing ctrl-X
  3. run /tools/profile for a while (e.g. for a minute)
  4. stop profiler, disable safe mode and quit CLI

The results were unanimous: I did not see CPU usage increase on any of those devices.

Could it be that SSH client used contributes to the CPU load? In my case I was using plain OpenSSH client version 8.4 on debian linux. In this case I'd expect to see increase in CPU usage also without enabling safe mode ... it might take a while before ssh (with supporting services) spins into the usage spiral though.