サーバーが作成された後にcloud-initプロセスが長時間実行されるのはなぜですか?

サーバーが作成された後にcloud-initプロセスが長時間実行されるのはなぜですか?

私は新しいUbuntu 18.04クラウドサーバーを起動し、ドッカーをインストールするcloud-initために使用しています。ファイルを調べてみると、cloud-initプロセスが実行中で正常に完了していることがわかります/var/log/cloud-init-output.log。しかしcloud-init、この後も、いくつかのプロセスが依然として長い間実行され、CPUを捕まえていることがわかりました。

ここに画像の説明を入力してください。

これらのcloud-initプロセスは約30秒ごとにリストに表示さtopれ、消えてから戻ります。この問題をより詳細に診断する方法はありますか?cloud-init明らかに完了した後も実行され続けるのはなぜですか、プロセスが多すぎるのはなぜですか?

また、同じパターンに従うように見える定期的なスパイクを備えたCPUトレースも見ました。

ここに画像の説明を入力してください。

それを見ると/var/log/cloud-init.log30秒ごとに狂っていき、次を出力して何行も繰り返し続けることを発見しました。

2021-11-13 19:21:25,927 - hotplug_hook.py[DEBUG]: hotplug-hook called with the following arguments: {hotplug_action: query, subsystem: net, udevaction: None, devpath: None}
2021-11-13 19:21:25,928 - handlers.py[DEBUG]: start: hotplug-hook: Handle reconfiguration on hotplug events
2021-11-13 19:21:25,928 - hotplug_hook.py[DEBUG]: Fetching datasource
2021-11-13 19:21:25,928 - handlers.py[DEBUG]: start: hotplug-hook/check-cache: attempting to read from cache [trust]
2021-11-13 19:21:25,928 - util.py[DEBUG]: Reading from /var/lib/cloud/instance/obj.pkl (quiet=False)
2021-11-13 19:21:25,928 - util.py[DEBUG]: Read 18131 bytes from /var/lib/cloud/instance/obj.pkl
2021-11-13 19:21:25,931 - util.py[DEBUG]: Reading from /run/cloud-init/.instance-id (quiet=False)
2021-11-13 19:21:25,932 - util.py[DEBUG]: Read 9 bytes from /run/cloud-init/.instance-id
2021-11-13 19:21:25,932 - stages.py[DEBUG]: restored from cache with run check: DataSourceHetzner
2021-11-13 19:21:25,932 - handlers.py[DEBUG]: finish: hotplug-hook/check-cache: SUCCESS: restored from cache with run check: DataSourceHetzner
2021-11-13 19:21:25,932 - hotplug_hook.py[DEBUG]: hotplug not supported for event of type net
2021-11-13 19:21:25,932 - handlers.py[DEBUG]: finish: hotplug-hook: SUCCESS: Handle reconfiguration on hotplug events
2021-11-13 19:21:25,932 - hotplug_hook.py[DEBUG]: Exiting hotplug handler
2021-11-13 19:21:25,932 - util.py[DEBUG]: Reading from /proc/uptime (quiet=False)
2021-11-13 19:21:25,932 - util.py[DEBUG]: Read 17 bytes from /proc/uptime
2021-11-13 19:21:25,932 - util.py[DEBUG]: cloud-init mode 'hotplug-hook' took 0.058 seconds (0.06)
2021-11-13 19:21:26,035 - hotplug_hook.py[DEBUG]: hotplug-hook called with the following arguments: {hotplug_action: query, subsystem: net, udevaction: None, devpath: None}
2021-11-13 19:21:26,035 - handlers.py[DEBUG]: start: hotplug-hook: Handle reconfiguration on hotplug events
2021-11-13 19:21:26,035 - hotplug_hook.py[DEBUG]: Fetching datasource
2021-11-13 19:21:26,035 - handlers.py[DEBUG]: start: hotplug-hook/check-cache: attempting to read from cache [trust]
2021-11-13 19:21:26,036 - util.py[DEBUG]: Reading from /var/lib/cloud/instance/obj.pkl (quiet=False)
2021-11-13 19:21:26,036 - util.py[DEBUG]: Read 18131 bytes from /var/lib/cloud/instance/obj.pkl
2021-11-13 19:21:26,039 - util.py[DEBUG]: Reading from /run/cloud-init/.instance-id (quiet=False)
2021-11-13 19:21:26,039 - util.py[DEBUG]: Read 9 bytes from /run/cloud-init/.instance-id
2021-11-13 19:21:26,039 - stages.py[DEBUG]: restored from cache with run check: DataSourceHetzner
2021-11-13 19:21:26,039 - handlers.py[DEBUG]: finish: hotplug-hook/check-cache: SUCCESS: restored from cache with run check: DataSourceHetzner
2021-11-13 19:21:26,039 - hotplug_hook.py[DEBUG]: hotplug not supported for event of type net
2021-11-13 19:21:26,040 - handlers.py[DEBUG]: finish: hotplug-hook: SUCCESS: Handle reconfiguration on hotplug events
2021-11-13 19:21:26,040 - hotplug_hook.py[DEBUG]: Exiting hotplug handler
2021-11-13 19:21:26,040 - util.py[DEBUG]: Reading from /proc/uptime (quiet=False)
2021-11-13 19:21:26,040 - util.py[DEBUG]: Read 17 bytes from /proc/uptime
2021-11-13 19:21:26,040 - util.py[DEBUG]: cloud-init mode 'hotplug-hook' took 0.054 seconds (0.06)
2021-11-13 19:21:26,054 - hotplug_hook.py[DEBUG]: hotplug-hook called with the following arguments: {hotplug_action: query, subsystem: net, udevaction: None, devpath: None}
2021-11-13 19:21:26,054 - handlers.py[DEBUG]: start: hotplug-hook: Handle reconfiguration on hotplug events
2021-11-13 19:21:26,054 - hotplug_hook.py[DEBUG]: Fetching datasource
2021-11-13 19:21:26,054 - handlers.py[DEBUG]: start: hotplug-hook/check-cache: attempting to read from cache [trust]
2021-11-13 19:21:26,055 - util.py[DEBUG]: Reading from /var/lib/cloud/instance/obj.pkl (quiet=False)
2021-11-13 19:21:26,055 - util.py[DEBUG]: Read 18131 bytes from /var/lib/cloud/instance/obj.pkl
2021-11-13 19:21:26,058 - util.py[DEBUG]: Reading from /run/cloud-init/.instance-id (quiet=False)
2021-11-13 19:21:26,058 - util.py[DEBUG]: Read 9 bytes from /run/cloud-init/.instance-id
2021-11-13 19:21:26,058 - stages.py[DEBUG]: restored from cache with run check: DataSourceHetzner
2021-11-13 19:21:26,058 - handlers.py[DEBUG]: finish: hotplug-hook/check-cache: SUCCESS: restored from cache with run check: DataSourceHetzner
2021-11-13 19:21:26,058 - hotplug_hook.py[DEBUG]: hotplug not supported for event of type net
2021-11-13 19:21:26,058 - handlers.py[DEBUG]: finish: hotplug-hook: SUCCESS: Handle reconfiguration on hotplug events
2021-11-13 19:21:26,059 - hotplug_hook.py[DEBUG]: Exiting hotplug handler
2021-11-13 19:21:26,059 - util.py[DEBUG]: Reading from /proc/uptime (quiet=False)
2021-11-13 19:21:26,059 - util.py[DEBUG]: Read 17 bytes from /proc/uptime
2021-11-13 19:21:26,059 - util.py[DEBUG]: cloud-init mode 'hotplug-hook' took 0.057 seconds (0.05)

ベストアンサー1

#cloud-init IRCチャンネルの有用なチャットによると、これは数日後にリリースされた21.4で修正されたcloud-initバージョン21.3の問題に関連しているようです。

それまでの解決策は次のとおりです。

rm -f /lib/udev/rules.d/10-cloud-init-hook-hotplug.rules
sudo udevadm control --reload-rules

おすすめ記事