[issue43264] Nested EventProxy in ListProxy cause FileNotFoundError: [Errno 2] No such file or directory problem

Tobiichi report at bugs.python.org
Fri Feb 19 03:55:42 EST 2021


New submission from Tobiichi <754785103 at qq.com>:

I append EventProxy into ListProxy like this:

```
l = manager.list([mp.Event() for _ in range(2)])
```

It works fine on a single node when I'm trying to get this listproxy. but when I trying to use multiple nodes across ethernet. it cause problem like this:

```
Traceback (most recent call last):
  File "client2.py", line 30, in <module>
    logic(manager)
  File "client2.py", line 18, in logic
    if l[i].is_set():
  File "<string>", line 2, in __getitem__
  File "/home/think/anaconda3/envs/AC/lib/python3.7/multiprocessing/managers.py", line 819, in _callmethod
    kind, result = conn.recv()
  File "/home/think/anaconda3/envs/AC/lib/python3.7/multiprocessing/connection.py", line 251, in recv
    return _ForkingPickler.loads(buf.getbuffer())
  File "/home/think/anaconda3/envs/AC/lib/python3.7/multiprocessing/managers.py", line 943, in RebuildProxy
    return func(token, serializer, incref=incref, **kwds)
  File "/home/think/anaconda3/envs/AC/lib/python3.7/multiprocessing/managers.py", line 793, in __init__
    self._incref()
  File "/home/think/anaconda3/envs/AC/lib/python3.7/multiprocessing/managers.py", line 847, in _incref
    conn = self._Client(self._token.address, authkey=self._authkey)
  File "/home/think/anaconda3/envs/AC/lib/python3.7/multiprocessing/connection.py", line 492, in Client
    c = SocketClient(address)
  File "/home/think/anaconda3/envs/AC/lib/python3.7/multiprocessing/connection.py", line 620, in SocketClient
    s.connect(address)
```

Nest ListProxy will cause same problem. like 

```
l = manager.list([manager.list([1 for _ in range(2)])for _ in range(2)])
```

Client act like this (manager in torch is SyncManager):

```
import torch.multiprocessing as mp

mp.current_process().authkey = b'abc'

def start_client(manager, host, port, key):
    manager.register('get_list')
    manager.__init__(address=(host, port), authkey=key)
    manager.connect()
    return manager

def logic(manager):
    l = manager.get_list()
    for i in range(len(l)):
        if not l[i].is_set():
            l[i].set()
            print('set')

if __name__=='__main__':
    manager = mp.Manager()
    manager = start_client(manager, '127.0.0.1', 5000, b'abc')
    logic(manager)
```

----------
files: server.py
messages: 387295
nosy: show-me-code
priority: normal
severity: normal
status: open
title: Nested EventProxy in ListProxy cause FileNotFoundError: [Errno 2] No such file or directory problem
type: crash
versions: Python 3.6
Added file: https://bugs.python.org/file49819/server.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43264>
_______________________________________


More information about the Python-bugs-list mailing list