Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Connecting to Prime Hub while program runs crashes hub on exit #849

Closed
laurensvalk opened this issue Dec 9, 2022 · 2 comments
Closed
Assignees
Labels
bug Something isn't working software: pybricks-code Issues with https://code.pybricks.com application software: pybricks-micropython Issues with Pybricks MicroPython firmware (or EV3 runtime) topic: bluetooth Issues involving bluetooth

Comments

@laurensvalk
Copy link
Member

Describe the bug

Connecting to Prime Hub while program runs crashes hub on exiting that program.

To reproduce

from pybricks.tools import wait

while True:
    wait(50)
    print("Hello, world!")
  • Run it on a Prime Hub
  • Disconnect
  • Run it on a Technic Hub
  • Disconnect
  • Connect to Prime Hub again (shouldn't be possible, but you can).
  • Pybricks Code gets in bad state (BT connected, but not stop button)
  • Cancel Prime Hub program with button
  • Hub freezes (animation freeze) then turns off.

Expected behavior
Perhaps fail to connect or something like it, but not crash on exit.

Screenshots
Reproducing it:

untitled.mp4
@laurensvalk laurensvalk added topic: bluetooth Issues involving bluetooth software: pybricks-code Issues with https://code.pybricks.com application software: pybricks-micropython Issues with Pybricks MicroPython firmware (or EV3 runtime) labels Dec 9, 2022
@laurensvalk
Copy link
Member Author

The above procedure always crashes, but here's a way you can sometimes do it on one Prime Hub:

@dlech
Copy link
Member

dlech commented Dec 12, 2022

This is fixed by not allowing Pybricks Code to reconnect to the hub while a user program is running (which is the intended behavior). There is a "feature" in BTStack that automatically started advertising again after disconnect, which was unexpected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working software: pybricks-code Issues with https://code.pybricks.com application software: pybricks-micropython Issues with Pybricks MicroPython firmware (or EV3 runtime) topic: bluetooth Issues involving bluetooth
Projects
None yet
Development

No branches or pull requests

2 participants