Loosing connection on stop_task action

I am loosing my connection to the GVMD when using stop_task on a task, that is not in state “Running”. From what I can tell, it looks like the GVMD is dropping the connection.

DEBUG:gvm.connections:Sending 59 characters. Data 
File "./clear_tasks_in_scanner.py", line 60, in remove_all_tasks_and_targets
    targets=gmp.get_targets()                                       # über alle verbliebenen / unzugeordneten Targets
  File "/opt/cyberscan/python/lib/python3.7/site-packages/gvm/protocols/gmpv7/gmpv7.py", line 4163, in get_targets
    return self._send_xml_command(cmd)
  File "/opt/cyberscan/python/lib/python3.7/site-packages/gvm/protocols/base.py", line 86, in _send_xml_command
    return self.send_command(xmlcmd.to_string())
  File "/opt/cyberscan/python/lib/python3.7/site-packages/gvm/protocols/base.py", line 140, in send_command
    raise e
  File "/opt/cyberscan/python/lib/python3.7/site-packages/gvm/protocols/base.py", line 137, in send_command
    response = self._read()
  File "/opt/cyberscan/python/lib/python3.7/site-packages/gvm/protocols/base.py", line 63, in _read
    return self._connection.read()
  File "/opt/cyberscan/python/lib/python3.7/site-packages/gvm/connections.py", line 401, in read
    data = self._connection.read()
  File "/opt/cyberscan/python/lib/python3.7/site-packages/gvm/connections.py", line 139, in read
    raise GvmError("Remote closed the connection")
gvm.errors.GvmError: Remote closed the connection

Is that the expected behavior?
I am using:
python 3.7
python-gvm 20.9.1
gvmd 20.08.0

1 Like

Could you check if gvmd returns an error for <stop_task/>? if yes this behavior is expected. The connection is always closed after an error.

1 Like

The GVMD log doesn’t show any errors:

event task:MESSAGE:2020-10-20 10h46.26 UTC:6197: Status of task Immediate scan of IP ******* (1d22db1c-7614-4e7c-8721-6ecf51afd029) has changed to Stopped

Python only raises:

gvm.errors.GvmError: Remote closed the connection

I tested this for the states Stopped, Requested and Queued.
During my tests another problem appeared. When stopping a task that is requested, the task appears to be stopped but the ospd-openvas scanner is starting the nvt tests.

Any news on this? I’m facing the same problem.