Very high memory usage when running under sudo in Linux
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 32/100
- Tipo de issue
- Bug
- Clareza
- Precisa de esclarecimento
- Status de atividade
- Estagnada
- Stack de tecnologia
- linux, python
- Domínio
- backend, operating-systems
Direção de pesquisa
Comece com o reprodutor mínimo em Python e compare as leituras de memória antes e depois de softioc.iocInit quando executado normalmente e sob sudo. Investigue o caminho de inicialização alcançado por softioc.iocInit; considera-se concluído quando a execução com sudo não mostrar mais o aumento de aproximadamente 950 MB, preservando a inicialização normal do IOC.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Python
- Estrelas
- 47
- Forks
- 15
- Merge médio
- 1d 18h
- PRs com merge (30d)
- 1
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de DiamondLightSource/pythonSoftIOC
-
Intermittently failing testAbertabug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 30/100
-
Add CI support and wheels for aarch64?Talvez livre de novo @AlexanderWells-diamond assumiu há 1307 dias e não há nenhum pull request aberto. Abertaenhancement
DiamondLightSource/pythonSoftIOC#121 · 2 comentários · 1 responsável ·
-
enhancement
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
-
enhancement
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
-
Replace devIocStats dependency with python device support implementing the same record interfaceAbertaenhancement
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 20/100
Todas as issues de DiamondLightSource/pythonSoftIOC
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
Mantenedores costumam responder em até 3 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
modelcontextprotocol/python-sdk#3648 ·
Mantenedores costumam responder em até 1 dia
-
docs good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
VenetoStato/giorgio#6 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
Mantenedores costumam responder em até 1 dia
-
Claiming namespace ddalusAberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 70/100
EclipseFdn/open-vsx.org#13831 ·
Mantenedores costumam responder em até 1 dia