spcl / faaskeeper

A fully serverless implementation of the ZooKeeper coordination protocol.
BSD 3-Clause "New" or "Revised" License
17 stars 13 forks source link

Support multiple TCP connections #18

Closed mcopik closed 2 months ago

mcopik commented 1 year ago

Replies from the writer can arrive from many TCP connections since different functions might process them. We have added an initial implementation with epoll - this should be cleaned and adequately tested.

Furthermore, we observed a bug when the socket was closed by the write function, but we failed on the client due to reading zero bytes.

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/home/ubuntu/faaskeeper/faaskeeper/python-venv/lib/python3.8/site-packages/faaskeeper/queue.py", line 256, in run
    data = json.loads(conn.recv(1024).decode())
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
mcopik commented 2 months ago

The new epoll implementation should no longer have this issue.