Very high memory usage when running under sudo in Linux
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 32/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- linux, python
調査の方向性
最小限の Python 再現プログラムから始め、通常実行時と sudo 下での実行時について、softioc.iocInit の前後のメモリ値を比較します。softioc.iocInit によって到達する初期化パスを調査します。sudo での実行時に約 950 MB の増加が表示されなくなり、通常の IOC 起動が維持されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Hi all,
It seems that creating and initializing an IOC takes up a crazy high amount of memory when ran under sudo. This is not the case when ran as user. Here is a minimal example to demonstrate:
import psutil
from softioc import softioc, builder, asyncio_dispatcher
def print_memory_usage(loc: str):
print(f"{loc:32s}: {psutil.Process().memory_info().rss:,}")
print_memory_usage("Before PV")
pv = builder.longOut("myVariable")
print_memory_usage("Before loadDatabase")
builder.LoadDatabase()
print_memory_usage("Before dispatcher")
dispatcher = asyncio_dispatcher.AsyncioDispatcher()
print_memory_usage("Before iocInit")
softioc.iocInit(dispatcher)
print_memory_usage("Before start")
softioc.interactive_ioc()
Output when ran as user:
INFO: PVXS QSRV2 is loaded, permitted, and ENABLED.
2025-01-16T13:55:56.327190606 WARN pvxs.tcp.setup Server unable to bind port 5075, falling back to [::]:37275
Before PV : 85,139,456
Before loadDatabase : 85,139,456
Before dispatcher : 85,139,456
Before iocInit : 87,236,608
Starting iocInit
############################################################################
## EPICS 7.0.7.1-DEV
## Rev. 7.0.7.99.1.1
## Rev. Date 7.0.7.99.1.1
############################################################################
cas WARNING: Configured TCP port was unavailable.
cas WARNING: Using dynamically assigned TCP port 43649,
cas WARNING: but now two or more servers share the same UDP port.
cas WARNING: Depending on your IP kernel this server may not be
cas WARNING: reachable with UDP unicast (a host's IP in EPICS_CA_ADDR_LIST)
iocRun: All initialization complete
Before start : 89,600,000
Python 3.12.3 (main, Nov 6 2024, 18:32:19) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>>
Output when ran as sudo:
INFO: PVXS QSRV2 is loaded, permitted, and ENABLED.
2025-01-16T13:56:32.146488207 WARN pvxs.tcp.setup Server unable to bind port 5075, falling back to [::]:39775
Before PV : 85,114,880
Before loadDatabase : 85,114,880
Before dispatcher : 85,114,880
Before iocInit : 87,212,032
Starting iocInit
############################################################################
## EPICS 7.0.7.1-DEV
## Rev. 7.0.7.99.1.1
## Rev. Date 7.0.7.99.1.1
############################################################################
cas WARNING: Configured TCP port was unavailable.
cas WARNING: Using dynamically assigned TCP port 37929,
cas WARNING: but now two or more servers share the same UDP port.
cas WARNING: Depending on your IP kernel this server may not be
cas WARNING: reachable with UDP unicast (a host's IP in EPICS_CA_ADDR_LIST)
iocRun: All initialization complete
Before start : 950,546,432
Python 3.12.3 (main, Nov 6 2024, 18:32:19) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>>
As you can see, the issue seems to happen in softioc.iocInit. Packages used to test (on Ubuntu):
softioc 4.5.0
psutil 6.1.1
This issue occurs both on Ubuntu and NixOS.
- 主要言語
- Python
- スター
- 47
- フォーク
- 15
- 平均マージ
- 1日 18時間
- マージ済み PR(30日)
- 1
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DiamondLightSource/pythonSoftIOC のほかの issue
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
-
enhancement
DiamondLightSource/pythonSoftIOC#121 · コメント 2 件 · 担当者 1 名 ·
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
Replace devIocStats dependency with python device support implementing the same record interface オープンenhancement
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
DiamondLightSource/pythonSoftIOC の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
canonical/paas-charm#368 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
tech debt
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
StevenBlack/hosts#3256 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
qualcomm/qai-appbuilder#275 ·