Page MenuHomeSoftware Heritage

Add test triggering the race condition in content_add
ClosedPublic

Authored by olasd on Sep 30 2019, 2:14 PM.

Details

Summary

This minimal example triggers T2019

Test Plan

tox -e py3 -- -k TestStorageRaceConditions

Diff Detail

Repository
rDSTO Storage manager
Branch
allow-racecondition
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 8067
Build 11629: tox-on-jenkinsJenkins
Build 11628: arc lint + arc unit

Event Timeline

anlambert added a subscriber: anlambert.

Looks good to me ! I was also trying to write such a test but you were faster.

This revision is now accepted and ready to land.Sep 30 2019, 2:34 PM
swh/storage/tests/test_storage.py
4049–4050

For your information, the test also fails when not providing the db and cur parameter. Are they really needed ?

swh/storage/tests/test_storage.py
4049–4050

They are not really (in the current state of this code).

Technically, to be sure that the race condition triggers all the time, we need to add a synchronization point between the threads, so that we are sure that both transactions are open at the same time. This means synchronizing before the content_add call, but after db.transaction().

(I'm not landing a purposefully failing test, fwiw)

How about landing it as explicitly skipped by pytest though?

Mark race condition test as xfail

♪┏(・o・)┛♪┗ ( ・o・) ┓♪ do the rebase dance party