#3721 use table lock while adding new external rpms
Closed by tkopecek. Opened by tkopecek.
tkopecek/koji issue3637  into  master

Download 3721.patch

PR #794 introduced savepoint-based solution for parallel addition of
external rpms. In some usecases there could be a lot of external rpms
being added, so potential for deadlock is much higher than before.
Locking the table seems to be a bit expensive but SHARE ROW EXCLUSIVE
should be a working compromise (anyone not writing to the table has
still read access).

Related: https://pagure.io/koji/issue/3637

rebased onto 9fca1283994c948b28f14884056e802b58a58048

A table lock seems like a very big hammer here. We don't actually do that anywhere else.

Do you have a reproducer? Some example hub traces?

I wonder if this would be helped by sorting rpm lists before passing them to add_external_rpm.

I wasn't able to reproduce it reliably. Total reproducer is your script, but don't have any real-world examples. @ignatenkobrain anything in your logs?

You're right that kiwi is doing the rpm retrieval in different way than the other task (getImagePackagesFromCache). I can add sorting there, but don't have reliable way to test that it really helped.

We previously had very similar deadlocks when updating buildroots. These were solved by sorting the inputs. I'd prefer to try the same here before we add locking.

If we do add locking, I'd rather not have the full table lock. A better option might be the upcoming lock functionality in #3786, but again, lets try the sorting first.

Absent a reproducer, we can't verify that any fix will work except by getting the reporter to test it out.

I've also added some questions in the original issue. It would be nice to have precise details about before we go making complex changes.

rebased onto 544b968f4caf74f03ac67a218a59b96ddaa57099

3 new commits added

  • Sort kiwi package output before import
  • Revert "use table lock while adding new external rpms"
  • use table lock while adding new external rpms

I've replaced it with sorting on input for now.

The current solution is so different that it might deserve a separate PR. Or at least fix the title of this one and squash out the reverted commit.

Sorting these inputs in the builder plugin seems at least harmless, but it would probably be simpler to just add

rpm_ids.sort()

in importImageInternal before the bulk inserts into archive_rpm_components. This would be directly analogous to the measure we have in BuildRoot._setList.

filed #3882

Pull-Request has been closed by tkopecek

closed in favour of #3882

Metadata