Handle MemoryError in aioble_central.py scanner event
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
- 30/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- embedded-iot
Hướng nghiên cứu
Bắt đầu trong aioble_central.py tại handler _IRQ_SCAN_RESULT và theo dõi cách _active_scanner, queue_scan và sự kiện của scanner được quản lý sau một MemoryError. Tái hiện cấu hình quét được cung cấp và xác minh xem việc quét có thể phục hồi hay không, cũng như các đối tượng ScanResult có được tạo lại mà không khiến trạng thái của hàng đợi hoặc sự kiện trở nên không nhất quán hay không.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I am using the scanner as follows in my application code
# The 'scanner' is of type 'scan' defined in aioble
async with scan(duration_ms=10000, # The length of the scan cycle in milliseconds.
interval_us=30000, # The time between each scan listen start
window_us=15000, # The length of time during the scan interval one is actually listening
# If interval_us = window_us the scan is non stop (so called fully duty cycle)
# Background scanning usually sets the window_us to be less than interval_us.
active=True) as scanner: # active = True means do scan requests to get scan responses
# For PHD we always want to do active scans.
However, every once and a while in the scan event handler a MemoryError is thrown while trying to load a result into the queue shown below:
if event == _IRQ_SCAN_RESULT:
addr_type, addr, adv_type, rssi, adv_data = data # data here is a tuple[int, bytes, int, int, bytes]
if not _active_scanner:
return
try:
if queue_scan:
_active_scanner._queue.append((addr_type, bytes(addr), adv_type, rssi, bytes(adv_data)))
_active_scanner._event.set()
except MemoryError:
queue_scan = False
logger.error('LNI: AIOBLE: Memory allocation error queuing an advertisement/scan response.') # type: ignore
import gc
gc.collect()
I have added a handler for the exception and would like to be able to recover from the error but am not sure what else I need to do. With the code shown above, the scanner restarts after 10 seconds but ScanResult objects are no longer created. Not sure why. Do I need to set the event? Do I need to add a filter that blocks repeat advertisements in a given scan cycle? Maybe it is simply not possible to recover from such an error?
Any help is greatly appreciated, especially from the code author.
- Ngôn ngữ chính
- Python
- Star
- 2.9k
- Fork
- 1.1k
- Merge trung bình
- 4 giờ 17 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của micropython/micropython-lib
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
micropython/micropython-lib#1074 ·
-
needs-info
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
micropython/micropython-lib#943 · 1 bình luận ·
-
"requests" does not handle redirection with relative path correctlyCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
micropython/micropython-lib#931 · 1 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
micropython/micropython-lib#795 · 2 bình luận ·
-
webrepl: Support LAN as well as WLAN boards.Có thể đã có người làm @Romaric-RILLET đã nhận 788 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
micropython/micropython-lib#762 ·
Tất cả issue của micropython/micropython-lib
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
unionai-oss/pandera#2640 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
JdeRobot/RoboticsInfrastructure#843 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
automated endpoint-dead needs-curation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
almanac-data/climate-almanac#122 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:harness enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
evarness-ai/iris-harness#420 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
suitenumerique/find#206 ·
Maintainer thường phản hồi trong vòng 2 ngày