Project

General

Profile

Bug #24546

Concurrent creation of subnets can lead to records with duplicate names

Added by Ivan Necas 4 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Network
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1612909

Description of problem:
Concurrent creation of subnets can lead to records with duplicate names

Version-Release number of selected component (if applicable):
Verified in 6.3, as well as in upstream, has been around probably from the beginning

How reproducible:
Under concurrent requets

for x in {1..20}; do
echo "Attempt $x"
for y in {1..4}; do
curl k -u admin:changeme -X POST -d '{"name":"subnet'$x'","network":"192.168.0.1","mask":"255.255.255.0"}' -H 'Content-Type: application/json' http://localhost:300/api/v2/subnets &
done
sleep 1
done

Actual results:

select name, count() from subnets group by name having count() > 1;

returns multiple records

Expected results:

select name, count() from subnets group by name having count() > 1;

returns no record.

Additional info:

Testing notes: when verifying, please first generate multiple subnets with an installation without this fix and try to migrate to the version with it.

Associated revisions

Revision 42466f75 (diff)
Added by Ivan Necas 3 months ago

Fixes #24546 - add uniq constraint on subnet.name

Concurrent requests on subnet create can lead to duplicate records. This
is calling issues in production when bulk importing hosts from the same
subnet via user scripting.

History

#1 Updated by The Foreman Bot 4 months ago

  • Assignee set to Ivan Necas
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/5923 added

#2 Updated by Ivan Necas 3 months ago

  • Status changed from Ready For Testing to Closed

#3 Updated by Marek Hulán 3 months ago

  • Subject changed from Concurrent creation of subnets can lead to records with duplicate names to Concurrent creation of subnets can lead to records with duplicate names
  • Fixed in Releases 1.20.0 added

Also available in: Atom PDF