BLE: close() can self-join the event-loop thread on disconnect

Aberta
#968 1 comentário 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
68/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Pouca atividade
Stack de tecnologia
python
Domínio
mobile-dev

Direção de pesquisa

Start by reading the close() and disconnect() paths in Bleak, especially where _eventThread.join(...) is called and where the disconnect callback runs. Reproduce the unsolicited-disconnect path on Linux with Python 3.14, then add a regression test that exercises cleanup from the event-loop thread. Done means the current thread is never joined, self.client is cleared, and _disconnected() runs.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

On an unsolicited disconnect, bleak calls the disconnect callback (set to self.close()) on its own event-loop thread. close() then calls self._eventThread.join(...), i.e. joining the current thread, which raises RuntimeError: cannot join current thread, so cleanup doesn't finish (self.client is left set and _disconnected() never runs).

Pre-existing and separate from the hang fix in #967. A fix probably needs close()/disconnect() to notice when they're running on the event-loop thread and avoid joining/blocking it.

Seen on Linux, Python 3.14, bleak 2.1.1, RAK4631 (platform-independent).

Linguagem predominante
Python
Estrelas
855
Forks
355
Merge médio
3d 3h
PRs com merge (30d)
12

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de meshtastic/python

Todas as issues de meshtastic/python

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.