pytest-dev / pytest-dev/execnet

`remote_exec` hangs forever when remotely using `gevent` model only at python3

Aperta
#123 3 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug help wanted
Lingua principale
Python
Stelle
102
Fork
47
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

The problem only occurs at python3.

Environment:

  • OS: Linux faa410b1f09b 4.19.121-linuxkit #1 SMP Thu Jan 21 15:36:34 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  • Python version: Python 3.7.5

Dependencies:

  • gevent version: 21.1.2
  • execnet version: 1.8.0

Code:

import execnet
# hangs forever when remote is gevent
execnet.set_execmodel('thread', 'gevent')
gw = execnet.makegateway()
print(gw)
print(gw.remote_status())

print('channel.send')
print (gw.remote_exec("channel.send(333)").receive())
print('everything done')

Problem: Above code hangs forever.

Stdout:

<Gateway id='gw0' receive-live, thread model, 0 active channels>
<RInfo 'execmodel=gevent, numchannels=0, numexecuting=0'>
channel.send

Debug log:

[89653] gw0 sent <Message STATUS channel=1 lendata=0>
[89653] gw0 [receiver-thread] RECEIVERTHREAD: starting to run
[89655] creating workergateway on <execnet.gateway_base.Popen2IO object at 0x1106a5820>
[89655] gw0-worker [serve] spawning receiver thread
[89655] gw0-worker [serve] joining receiver thread
[89655] gw0-worker waiting for receiver thread to finish
[89655] gw0-worker [receiver-thread] RECEIVERTHREAD: starting to run
[89655] gw0-worker [receiver-thread] received <Message STATUS channel=1 lendata=0>
[89655] gw0-worker sent <Message CHANNEL_DATA channel=1 lendata=73>
[89653] gw0 [receiver-thread] received <Message CHANNEL_DATA channel=1 lendata=73>
[89653] gw0 [receiver-thread] received <Message CHANNEL_CLOSE channel=1 lendata=0>
[89655] gw0-worker sent <Message CHANNEL_CLOSE channel=1 lendata=0>
[89653] gw0 1 channel.__del__
[89653] gw0 sent <Message CHANNEL_EXEC channel=3 lendata=31>
[89655] gw0-worker [receiver-thread] received <Message CHANNEL_EXEC channel=3 lendata=31>

The code hangs while executing remote_exec. The problem only occurs when remote thread model is gevent.

I guess the problem occurred because while gevent is rapidly syncing with python3, execnet was not maintained :C.

Maybe related to function mapping when making ExecModel:
https://github.com/pytest-dev/execnet/blob/894533a515baf526c35ea0fe525b4866c6824ab8/execnet/gateway_base.py#L112-L125

I know this repo is unmaintained. Hoping for receiving someone's help!

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riproduci il blocco con l'esempio Python 3 usando la configurazione thread-to-gevent di execnet e le versioni elencate nell'issue. Inizia ispezionando la mappatura di ExecModel in execnet/gateway_base.py intorno alle righe 112-125, quindi segui remote_exec attraverso il receiver e i thread worker. Il lavoro è completato quando la chiamata remota restituisce 333 e il programma raggiunge “everything done” senza bloccarsi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
distributed-systems
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.