aioble: Unhandled exception in IRC callback - memory allocation failed
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- python
- 领域
- embedded-iot
调研方向
从 core.py 第 71 行和 central.py 第 61 行开始,这是 traceback 中显示的 IRQ callback 路径。与其他任务一起运行长时间执行的 aioble.scan 工作负载,并观察 MemoryError 如何影响扫描任务。完成的标准是:已定义并验证分配失败时所需的行为,且不会悄然停止后台扫描。
由索引模型根据 Issue 内容生成。
描述
Hi,
I have a function that scans for advertising data and decode the information (Ruuvi temperature sensors). However, when this runs for a while together with some other tasks, I'm running into a memory issue.
Unhandled exception in IRQ callback handler
Traceback (most recent call last):
File "core.py", line 71, in ble_irq
File "central.py", line 61, in _central_irq
MemoryError: memory allocation failed, allocating 2048 bytes
This will quit my background BLE scanning task which is updating my temperature data. Of course I can watch the task and restart it, but I hope for a better error handling the the aioble library.
It runs fine for quite some time before it giving the error. It's not reproducible - sometimes it occurs after 5 minutes, sometimes it runs 2h without any issues.
I tried running an exception catcher around the can itself:
try:
async with aioble.scan(duration_ms = duration, interval_us=30000, window_us=30000, active = True) as scanner:
self.scanner = scanner
async for result in scanner:
self._handle_advertisement(result)
except Exception as e:
print('!!!!! Exception in aioble scan')
print(e)
But this doesn't help to prevent the error from happing. Of course I could change the code in central.py myself and see if I can catch the error, but I don't want to mess around with it (yet).
I already have another task that is frequently running a gc.collect() and memory shows up with round 32kB.
Thanks....
- 主要语言
- Python
- 星标
- 2.9k
- 派生
- 1.1k
- 平均合并
- 7 天 6 小时
- 30 天内合并 PR
- 3
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
micropython/micropython-lib 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
micropython/micropython-lib#1074 ·
-
needs-info
难度 1/5 1 小时以内 新手友好度 72/100
micropython/micropython-lib#943 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
micropython/micropython-lib#931 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 62/100
micropython/micropython-lib#795 · 2 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 62/100
micropython/micropython-lib#762 ·
查看 micropython/micropython-lib 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 90/100
-
bug
难度 2/5 1-3 小时 新手友好度 86/100
zostera/django-bootstrap4#894 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
use-agent-os/agent-os#3276 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
难度 2/5 1-3 小时 新手友好度 88/100
NousResearch/hermes-agent#117848 ·