Page MenuHomeSoftware Heritage

Fix race condition in multiplexer_objstorage add() return value
ClosedPublic

Authored by olasd on Jun 5 2020, 6:41 PM.

Details

Summary

If an objstorage is read-only, the add() method will return None. The
multiplexer should return one of the non-None values if it finds one, instead of
the (inconsistent) first value returned by any of the threads.

Test Plan

tox is happy, even by making add() slow (e.g. by adding a sleep(1) to
it)

Diff Detail

Repository
rDOBJS Object storage
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 12685
Build 19284: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 19283: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D3237 (id=11480)

Rebasing onto 15358e9c2a...

Current branch diff-target is up to date.
Changes applied before test
commit dc1e38b6dc50bc715b2fd4c035edfaa51135f417
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Fri Jun 5 18:40:02 2020 +0200

    Fix race condition in multiplexer_objstorage add() return value
    
    If an objstorage is read-only, the add() method will return None. The
    multiplexer should return one of the non-None values if it finds one, instead of
    the (inconsistent) first value returned by any of the threads.

See https://jenkins.softwareheritage.org/job/DOBJS/job/tests-on-diff/13/ for more details.

This revision is now accepted and ready to land.Jun 5 2020, 6:44 PM