Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Very high memory usage when running under sudo in Linux

Đang mở
#180 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
32/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
linux, python
Lĩnh vực
backend, operating-systems

Hướng nghiên cứu

Bắt đầu với trình tái hiện tối giản bằng Python và so sánh các mức sử dụng bộ nhớ trước và sau softioc.iocInit khi chạy bình thường và dưới sudo. Điều tra đường dẫn khởi tạo được softioc.iocInit đi tới; hoàn thành khi lần chạy với sudo không còn cho thấy mức tăng khoảng 950 MB, đồng thời vẫn duy trì việc khởi động IOC bình thường.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

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.

Ngôn ngữ chính
Python
Star
47
Fork
15
Merge trung bình
1 ngày 18 giờ
Pull request đã merge (30 ngày)
1

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của DiamondLightSource/pythonSoftIOC

Tất cả issue của DiamondLightSource/pythonSoftIOC

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.