Project

Profile

Help

Issue #2874

closed

Race condition during applicability regeneration for consumers with same profile

Added by ttereshc over 6 years ago. Updated almost 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
High
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
2.14.0
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
Yes
Tags:
Pulp 2
Sprint:
Sprint 23
Quarter:

Description

Occasionally, the applicability regeneration task raises the following:

    Traceback (most recent call last):
      File "/usr/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task
        R = retval = fun(*args, **kwargs)
      File "/usr/lib/python2.7/site-packages/pulp/server/async/tasks.py", line 473, in __call__
        return super(Task, self).__call__(*args, **kwargs)
      File "/usr/lib/python2.7/site-packages/pulp/server/async/tasks.py", line 103, in __call__
        return super(PulpTask, self).__call__(*args, **kwargs)
      File "/usr/lib/python2.7/site-packages/celery/app/trace.py", line 437, in __protected_call__
        return self.run(*args, **kwargs)
      File "/usr/lib/python2.7/site-packages/pulp/server/managers/consumer/applicability.py", line 107, in regenerate_applicability_for_consumers
        manager.regenerate_applicability(profile_hash, content_type, profile_id, repo_id)
      File "/usr/lib/python2.7/site-packages/pulp/server/managers/consumer/applicability.py", line 272, in regenerate_applicability
        applicability)
      File "/usr/lib/python2.7/site-packages/pulp/server/managers/consumer/applicability.py", line 384, in create
        applicability.save()
      File "/usr/lib/python2.7/site-packages/pulp/server/db/model/consumer.py", line 234, in save
        self._id = self.get_collection().insert(new_document)
      File "/usr/lib64/python2.7/site-packages/pymongo/collection.py", line 2200, in insert
        check_keys, manipulate, write_concern)
      File "/usr/lib64/python2.7/site-packages/pymongo/collection.py", line 530, in _insert
        check_keys, manipulate, write_concern, op_id, bypass_doc_val)
      File "/usr/lib64/python2.7/site-packages/pymongo/collection.py", line 513, in _insert_one
        _check_write_command_response([(0, result)])
      File "/usr/lib64/python2.7/site-packages/pymongo/helpers.py", line 300, in _check_write_command_response
        raise DuplicateKeyError(error.get("errmsg"), 11000, error)
    DuplicateKeyError: insertDocument :: caused by :: 11000 E11000 duplicate key error index: pulp_database.repo_profile_applicability.$profile_hash_-1_repo_id_-1  dup key: { : "29989a2ea7c148716ba750976ca1229628d4f76b45edd3d8378934a6ebc9a135", : "some repo id" }

It's possible when multiple tasks for single consumers are requested and running in parallel. If consumers have same profile, race condition can happen here.

Actions #1

Updated by ttereshc over 6 years ago

  • Priority changed from Normal to High
  • Triaged changed from No to Yes
Actions #2

Updated by ttereshc over 6 years ago

  • Sprint Candidate changed from No to Yes
Actions #4

Updated by ttereshc over 6 years ago

  • Sprint/Milestone set to 42
Actions #5

Updated by ttereshc over 6 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to ttereshc
Actions #6

Updated by ttereshc over 6 years ago

  • Status changed from ASSIGNED to POST

Added by ttereshc over 6 years ago

Revision 7a90d861 | View on GitHub

Resolve race condition during applicability generation

Race condition was possible when applicability generation was running in parallel for the same consumer profiles.

closes #2874 https://pulp.plan.io/issues/2874

Actions #7

Updated by ttereshc over 6 years ago

  • Status changed from POST to MODIFIED
Actions #8

Updated by pcreech over 6 years ago

  • Platform Release set to 2.14.0
Actions #9

Updated by pcreech over 6 years ago

  • Status changed from MODIFIED to 5
Actions #10

Updated by pcreech over 6 years ago

  • Status changed from 5 to CLOSED - CURRENTRELEASE
Actions #13

Updated by bmbouter about 6 years ago

  • Sprint set to Sprint 23
Actions #14

Updated by bmbouter about 6 years ago

  • Sprint/Milestone deleted (42)
Actions #15

Updated by bmbouter almost 5 years ago

  • Tags Pulp 2 added

Also available in: Atom PDF