Skip to content

Linux64/plux.so version 1.9 crashes on unstable connection with muscleBAN devices #19

@Inzarcon

Description

@Inzarcon

Issue and Steps to Reproduce

  • Connect to a muscleBAN device using PLUX-API-Python3/Linux64/plux.so and example code of this repository.
  • Once connection is established and stable, obstruct the Bluetooth connection (with your hands around the physical muscleBAN or by moving it out of range) for a short time Y depending on sample rate/frequency (see graph below).
  • Immediately unblock the muscleBAN to reestablish Bluetooth connection.
  • Depending on the length Y of the timeout, now one of three things will happen:
    • (OK) If the timeout Y was shorter than the time in the graph below, the streaming of samples continues without any issues or errors.
    • (OK) If the timeout Y was much larger, it will more likely raise a RuntimeError: The communication with the device was lost.
    • (Not OK) If the timeout Y was only slightly larger than in the graph, one of various C/C++ memory errors occur, and Python crashes completely:
      • munmap_chunk(): invalid pointer
      • malloc(): unaligned fastbin chunk detected
      • malloc(): unaligned tcache chunk detected
      • malloc_consolidate(): invalid chunk size
      • corrupted size vs. prev_size in fastbins
      • Quiet crash with no message at all

Further details

  • Crash occurs in both Python 3.9 and 3.13.
  • Crash occurs in both Ubuntu 20.04 LTS and CachyOS (Arch Linux-based).
  • Crash occurs independent of which muscleBAN device is used.
  • Behavior get worse with higher sample rates/frequencies set for the muscleBAN. I tested this with different sample rates:

Workaround

  • Downgrading the plux.so file from version 1.9 to 1.7 found in the file history of this repository fixes the issue and consistently raises expected RuntimeError: The communication with the device was lost. instead of crashing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions