-
-
Notifications
You must be signed in to change notification settings - Fork 376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/publish concurrency #1271
Fix/publish concurrency #1271
Conversation
8464cad
to
346e782
Compare
the test t12_api:TaskAPITestParallelTasks failes with this implementation... does it need to be updated?
Create Mirror in parallel seems now to return 202, but 409 was expected. |
fa7b78b
to
37d521f
Compare
Sorry for the tardy response, I'll look over what happened after the rebase :) |
fb753df
to
348ea3e
Compare
2f20f12
to
2eedb67
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1271 +/- ##
==========================================
- Coverage 74.86% 74.63% -0.24%
==========================================
Files 144 144
Lines 16261 16299 +38
==========================================
- Hits 12174 12164 -10
- Misses 3149 3188 +39
- Partials 938 947 +9 ☔ View full report in Codecov by Sentry. |
Hi ! I implemented a queue, async tasks are now executed squentially in order, as soon as the required resources are avaiilable. could you give this a try ? |
471872d
to
629957a
Compare
Aptly is now also using the queue for synchronous tasks. this should fix the concurrency problem completely. Could you test and confirm ? Thanks ! |
dbd357c
to
7e2ce5a
Compare
40906aa
to
b3f76c1
Compare
b3f76c1
to
3794c84
Compare
This commit introduces a test which runs concurrent publishes (which could be parallell with multiproccessing, python is fun). The test purposly fails (at the point in history that this patch is written) in order to make it as easy as possible to verify later patches, which hopefully addresses concurrency problems. The same behaviour can easily be tested outside of the system tests with the following (or similar) shell $ aptly serve -listen=:8080 -no-lock $ aptly repo create create -distributions=testing local-repo $ atply publish repo -architectures=amd64 local-repo $ apt download aptly $ aptly repo add local-repo ./aptly*.deb $ for _ in $(seq 10); do curl -X PUT 127.0.0.1:8080/api/publish//testing In the local testing perfomed (on a dual core vm) the first 1-4 jobs would typically succeed and the rest would error out.
This commit blocks concurrent calls to RunTaskInBackground which is intended to fix the quirky behaviour where concurrent PUT calls to api/publish/<prefix>/<distribution> would immedietly reuturn an error. The solution proposed in this commit is not elegant and probaly has unintended side-effects. The intention of this commit is to highlight the area that actually needs to be addressed. Ideally this patch is amended or dropped entierly in favor of a better fixup.
3794c84
to
fdce655
Compare
Replaces #1261
Fixes #1276, #1125
Description of the Change
PR Updated: synchronous and asynchronous requests are queued until the resoures become available.
This MR addresses a concurrency issue with the
api/publish
endpoint, where concurrent PUTs typically fail. The MR in it self is not pretty, so consider this initial state of the MR a starting point of discussion.The commits are intentionally separated in order to make it as easy as possible to observe the failing test (and test it against other likely better code changes).