OpenSCAP / openscap-daemon

Manages continuous scans of your infrastructure
https://www.open-scap.org/tools/openscap-daemon
GNU Lesser General Public License v2.1
106 stars 32 forks source link

TypeError: '<' not supported between instances of 'AsyncUpdateTaskAction' and 'AsyncUpdateTaskAction' #153

Open punkymaniac opened 3 years ago

punkymaniac commented 3 years ago

With multiple tasks scheduled, I regularly catch this error and the daemon stop to process scheduled scan.

Exception in thread Thread-1:                               
Traceback (most recent call last):           
  File "/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner                           
    self.run()                                        
  File "/usr/lib64/python3.6/threading.py", line 864, in run                                                 
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.6/site-packages/openscap_daemon/dbus_daemon.py", line 45, in <lambda>  
    target=lambda: self.system.schedule_tasks_worker()
  File "/usr/local/lib/python3.6/site-packages/openscap_daemon/system.py", line 575, in schedule_tasks_worker
    self.schedule_tasks(reference_datetime)
  File "/usr/local/lib/python3.6/site-packages/openscap_daemon/system.py", line 545, in schedule_tasks
    TASK_ACTION_PRIORITY              
  File "/usr/local/lib/python3.6/site-packages/openscap_daemon/async_tools.py", line 162, in enqueue
    self.queue.put((priority, action))
  File "/usr/lib64/python3.6/queue.py", line 143, in put                                             
    self._put(item)                           
  File "/usr/lib64/python3.6/queue.py", line 227, in _put              
    heappush(self.queue, item)                
TypeError: '<' not supported between instances of 'AsyncUpdateTaskAction' and 'AsyncUpdateTaskAction'

I need to remove all task (or I can keep only one) and restart the daemon to return in a working state. I continue to investigate to find a state where I can reproduce the error each time. Someone have already get the same error ?

punkymaniac commented 3 years ago

The issue came from a tuple comparison, when a tuple is add on the AsyncManager class queue. The class AsyncUpdateTaskAction doesn't have a lower comparison operator, so they couldn't be compare with each other. I will propose a fix for it.