cms icon indicating copy to clipboard operation
cms copied to clipboard

Backdoor is not working due to changes in gevent

Open mraron opened this issue 2 years ago • 0 comments

Description: When trying to netcat to the backdoor socket nothing happens. In the output of the service I see something like this:

Traceback (most recent call last):
  File "src/gevent/greenlet.py", line 854, in gevent._greenlet.Greenlet.run
  File "/usr/local/lib/python3.8/dist-packages/gevent/baseserver.py", line 34, in _handle_and_close_when_done
    return handle(*args_tuple)
  File "/usr/local/lib/python3.8/dist-packages/cms-1.5.dev0-py3.8.egg/cms/io/service.py", line 269, in handle
    BackdoorServer.handle(self, conn, _address)
  File "/usr/local/lib/python3.8/dist-packages/gevent/backdoor.py", line 168, in handle
    conn.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, True) # pylint:disable=no-member
OSError: [Errno 95] Operation not supported

Steps to reproduce:

  1. Enable backdoor
  2. Try to access it according to the documentation.

Expected: A python console is available.

Actual: Nothing happens, the netcat exits because it receives EOF.

CMS version: ioi2023's master version (https://github.com/ioi-2023/cms), but for this issue it's essentially this repo's master. Was CMS installed: yes, using docker-compose (modified from #1228)

If we comment out the line conn.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, True) in gevent's backdoor.py, which was introduced in its gevent/gevent@9d27d269ed01a7e752966caa7a6f85d773780a1a commit, the issue is fixed. As far as I see it's a bug in gevent, but something should be done about it in cms as well.

mraron avatar May 31 '23 14:05 mraron