aioble: Unhandled exception in IRC callback - memory allocation failed

Abierto
#982 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
python
Área
embedded-iot

Línea de trabajo

Comienza con core.py línea 71 y central.py línea 61, la ruta de callback de IRQ que se muestra en el traceback. Ejecuta la carga de trabajo de larga duración aioble.scan junto con las demás tareas y observa cómo MemoryError afecta a la tarea de escaneo. Se considera completado cuando el comportamiento deseado ante un fallo de asignación esté definido y verificado sin detener silenciosamente el escaneo en segundo plano.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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....

Lenguaje dominante
Python
Estrellas
2.9k
Forks
1.1k
Merge medio
7 d 6 h
PR fusionados (30 d)
3

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de micropython/micropython-lib

Todos los issues de micropython/micropython-lib

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.