django-DefectDojo icon indicating copy to clipboard operation
django-DefectDojo copied to clipboard

Deduplication stopped working after upgrading to 2.14.3

Open enidevops opened this issue 4 years ago • 2 comments

Bug description After upgrading from 2.14.0 to 2.14.3 the deduplication process seems to not work anymore. I have tested importing Qualys, AWS Securityhub and the Generic Findings Importer and in none of these the deduplication is working.

These are my current settings for deduplication:

image

After looking through the log files, it seems to be related to celery not working anymore. Below are the logs from the celery-worker pod and rabbitmq pod:

[23/Sep/2022 11:20:49] INFO [celery.worker.consumer.connection:22] Connected to amqp://user:**@defectdojo-shared-rabbitmq:5672//
[23/Sep/2022 11:20:49] INFO [celery.worker.consumer.mingle:40] mingle: searching for neighbors
[23/Sep/2022 11:20:50] INFO [celery.worker.consumer.mingle:49] mingle: all alone
[23/Sep/2022 11:20:50] INFO [celery.apps.worker:176] celery@defectdojo-shared-celery-worker-5b7f569698-p82t6 ready.
[23/Sep/2022 11:20:50] INFO [celery.worker.strategy:161] Task dojo.tasks.async_dupe_delete[bb37b4eb-243d-4706-bc9f-509b414008d1] received
[23/Sep/2022 11:20:50] INFO [dojo.tasks:104] delete excess duplicates (max_dupes per finding: 0, max deletes per run: 200)
[23/Sep/2022 11:20:50] INFO [dojo.specific-loggers.deduplication:105] delete excess duplicates (max_dupes per finding: 0, max deletes per run: 200)
[23/Sep/2022 11:20:50] INFO [dojo.tasks:141] total number of excess duplicates deleted: 0
[23/Sep/2022 11:20:50] INFO [celery.app.trace:131] Task dojo.tasks.async_dupe_delete[bb37b4eb-243d-4706-bc9f-509b414008d1] succeeded in 0.01837002206593752s: None
[23/Sep/2022 11:20:50] INFO [celery.worker.strategy:161] Task dojo.tools.tool_issue_updater.update_findings_from_source_issues[5fa1c581-ab91-4325-8bc7-26f636cec762] received
[23/Sep/2022 11:25:33] INFO [celery.app.trace:131] Task dojo.tools.tool_issue_updater.update_findings_from_source_issues[5fa1c581-ab91-4325-8bc7-26f636cec762] succeeded in 282.81199922412634s: None
[23/Sep/2022 11:25:33] INFO [celery.worker.strategy:161] Task dojo.tasks.add_alerts[293c691a-a8b8-4320-a07a-cbc34dd1102d] received
[23/Sep/2022 11:25:33] INFO [celery.app.trace:131] Task dojo.tasks.add_alerts[293c691a-a8b8-4320-a07a-cbc34dd1102d] succeeded in 0.01564187929034233s: None
[23/Sep/2022 11:25:33] INFO [celery.worker.strategy:161] Task dojo.tasks.async_dupe_delete[48357551-c60b-4848-8e87-53b01b355a16] received
[23/Sep/2022 11:25:33] INFO [dojo.tasks:104] delete excess duplicates (max_dupes per finding: 0, max deletes per run: 200)
[23/Sep/2022 11:25:33] INFO [dojo.specific-loggers.deduplication:105] delete excess duplicates (max_dupes per finding: 0, max deletes per run: 200)
[23/Sep/2022 11:25:33] INFO [dojo.tasks:141] total number of excess duplicates deleted: 0
[23/Sep/2022 11:25:33] INFO [celery.app.trace:131] Task dojo.tasks.async_dupe_delete[48357551-c60b-4848-8e87-53b01b355a16] succeeded in 0.014052736107259989s: None
[23/Sep/2022 11:25:33] WARNING [celery.worker.consumer.consumer:354] consumer: Connection to broker lost. Trying to re-establish the connection...
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/celery/worker/consumer/consumer.py", line 332, in start
    blueprint.start(self)
  File "/usr/local/lib/python3.8/site-packages/celery/bootsteps.py", line 116, in start
    step.start(parent)
  File "/usr/local/lib/python3.8/site-packages/celery/worker/consumer/consumer.py", line 628, in start
    c.loop(*c.loop_args())
  File "/usr/local/lib/python3.8/site-packages/celery/worker/loops.py", line 97, in asynloop
    next(loop)
  File "/usr/local/lib/python3.8/site-packages/kombu/asynchronous/hub.py", line 299, in create_loop
    item()
  File "/usr/local/lib/python3.8/site-packages/vine/promises.py", line 160, in __call__
    return self.throw()
  File "/usr/local/lib/python3.8/site-packages/vine/promises.py", line 157, in __call__
    retval = fun(*final_args, **final_kwargs)
  File "/usr/local/lib/python3.8/site-packages/celery/worker/loops.py", line 21, in _quick_drain
    connection.drain_events(timeout=timeout)
  File "/usr/local/lib/python3.8/site-packages/kombu/connection.py", line 316, in drain_events
    return self.transport.drain_events(self.connection, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/kombu/transport/pyamqp.py", line 169, in drain_events
    return connection.drain_events(**kwargs)
  File "/usr/local/lib/python3.8/site-packages/amqp/connection.py", line 525, in drain_events
    while not self.blocking_read(timeout):
  File "/usr/local/lib/python3.8/site-packages/amqp/connection.py", line 530, in blocking_read
    frame = self.transport.read_frame()
  File "/usr/local/lib/python3.8/site-packages/amqp/transport.py", line 294, in read_frame
    frame_header = read(7, True)
  File "/usr/local/lib/python3.8/site-packages/amqp/transport.py", line 627, in _read
    s = recv(n - len(rbuf))
ConnectionResetError: [Errno 104] Connection reset by peer
WARNING:py.warnings:/usr/local/lib/python3.8/site-packages/celery/worker/consumer/consumer.py:367: CPendingDeprecationWarning: 
In Celery 5.1 we introduced an optional breaking change which
on connection loss cancels all currently executed tasks with late acknowledgement enabled.
These tasks cannot be acknowledged as the connection is gone, and the tasks are automatically redelivered back to the queue.
You can enable this behavior using the worker_cancel_long_running_tasks_on_connection_loss setting.
In Celery 5.1 it is set to False by default. The setting will be set to True by default in Celery 6.0.

  warnings.warn(CANCEL_TASKS_BY_DEFAULT, CPendingDeprecationWarning)

[23/Sep/2022 11:25:33] INFO [celery.worker.consumer.connection:22] Connected to amqp://user:**@defectdojo-shared-rabbitmq:5672//
[23/Sep/2022 11:25:33] INFO [celery.worker.consumer.mingle:40] mingle: searching for neighbors


 rabbitmq pod:

2022-09-23 11:39:26.506534+00:00 [warning] <0.2296.0> client unexpectedly closed TCP connection
2022-09-23 11:39:26.509614+00:00 [info] <0.2306.0> accepting AMQP connection <0.2306.0> (172.30.20.76:37694 -> 172.30.20.15:5672)
2022-09-23 11:39:26.511240+00:00 [info] <0.2306.0> connection <0.2306.0> (172.30.20.76:37694 -> 172.30.20.15:5672): user 'user' authenticated and granted access to vhost '/'
2022-09-23 11:39:26.512227+00:00 [info] <0.1909.0> closing AMQP connection <0.1909.0> (172.30.20.76:54572 -> 172.30.20.15:5672, vhost: '/', user: 'user')
2022-09-23 11:39:26.514058+00:00 [info] <0.2318.0> accepting AMQP connection <0.2318.0> (172.30.20.76:37700 -> 172.30.20.15:5672)
2022-09-23 11:39:26.515627+00:00 [info] <0.2318.0> connection <0.2318.0> (172.30.20.76:37700 -> 172.30.20.15:5672): user 'user' authenticated and granted access to vhost '/'
2022-09-23 11:42:26.513907+00:00 [error] <0.2306.0> closing AMQP connection <0.2306.0> (172.30.20.76:37694 -> 172.30.20.15:5672):
2022-09-23 11:42:26.513907+00:00 [error] <0.2306.0> missed heartbeats from client, timeout: 60s
2022-09-23 11:44:04.417187+00:00 [info] <0.2687.0> accepting AMQP connection <0.2687.0> (172.30.20.76:52080 -> 172.30.20.15:5672)
2022-09-23 11:44:04.418899+00:00 [info] <0.2687.0> connection <0.2687.0> (172.30.20.76:52080 -> 172.30.20.15:5672): user 'user' authenticated and granted access to vhost '/'
2022-09-23 11:44:04.419815+00:00 [info] <0.2318.0> closing AMQP connection <0.2318.0> (172.30.20.76:37700 -> 172.30.20.15:5672, vhost: '/', user: 'user')
2022-09-23 11:44:04.421669+00:00 [info] <0.2699.0> accepting AMQP connection <0.2699.0> (172.30.20.76:52092 -> 172.30.20.15:5672)
2022-09-23 11:44:04.423077+00:00 [info] <0.2699.0> connection <0.2699.0> (172.30.20.76:52092 -> 172.30.20.15:5672): user 'user' authenticated and granted access to vhost '/'
2022-09-23 11:47:04.422900+00:00 [error] <0.2687.0> closing AMQP connection <0.2687.0> (172.30.20.76:52080 -> 172.30.20.15:5672):
2022-09-23 11:47:04.422900+00:00 [error] <0.2687.0> missed heartbeats from client, timeout: 60s

Additionally, the ui constantly shows that celery is not running:

image

Deployment method

  • [ ] Docker Compose
  • [X ] Kubernetes (AWS EKS)
  • [ ] GoDojo

Environment information

  • DefectDojo: 2.14.3
  • Helm Chart: defectdojo-1.6.41

enidevops avatar Sep 23 '22 12:09 enidevops

I used the "replace" option in ArgoCD which destroys all the resources and deploys them again and somehow this fixed it. Therefore this ticket can be closed

enidevops avatar Sep 26 '22 12:09 enidevops

Thanks for the update @enidevops Closing....

mtesauro avatar Sep 26 '22 16:09 mtesauro