Handle MemoryError in aioble_central.py scanner event
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 30/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- python
- Área
- embedded-iot
Línea de trabajo
Comienza en aioble_central.py, en el controlador _IRQ_SCAN_RESULT, y rastrea cómo se gestionan _active_scanner, queue_scan y el evento del escáner después de un MemoryError. Reproduce la configuración de escaneo proporcionada y verifica si el escaneo puede recuperarse y si se vuelven a crear objetos ScanResult sin dejar incoherente el estado de la cola o del evento.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 2.9k
- Forks
- 1.1k
- Merge medio
- 4 h 17 min
- PR fusionados (30 d)
- 1
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de micropython/micropython-lib
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
micropython/micropython-lib#1074 ·
-
needs-info
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
micropython/micropython-lib#943 · 1 comentario ·
-
"requests" does not handle redirection with relative path correctlyQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
micropython/micropython-lib#931 · 1 comentario ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
micropython/micropython-lib#795 · 2 comentarios ·
-
webrepl: Support LAN as well as WLAN boards.Posiblemente ocupada @Romaric-RILLET la tomó hace 787 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
micropython/micropython-lib#762 ·
Todos los issues de micropython/micropython-lib
Issues similares
-
question
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
conda-forge/vc-feedstock#132 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
limitlessprojects/Go-Hybrid#3342 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
UKGovernmentBEIS/inspect_ai#6268 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
LSSTDESC/rail_sompz#42 ·
-
All tests fail with 'EXITED with status 3' on pytest 9.2.0 (TestReport._id is not marshallable)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
pytest-dev/pytest-forked#113 ·