-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Racy controller from framework.NewInformer? #26082
Comments
@lavalamp, you're author of the potentially racy code, can you please take a look? |
I have reproduced of the observed behavior. Get it at reproduce-informer-race branch of my Kubernetes fork, patch jsafrane@0b5bc1d Compile it:
Run etcd somewhere and then run the test:
(with The test spawns a very simple controller with |
I have sort of a fix, please review very carefully #26167 |
I was pretty sure there was a race in there, but never able to repro, thanks. |
Fixed by #27341 |
When I stress-test PersistentVolume controller I sometimes get (correct) "PersistentVolumeClaim deleted" event followed by (wrong) "PersistentVolumeClaim added". This happens very rarely (<0.01%) when I delete a PersistentVolumeClaim and the controller is under heavy load.
I use
framework.NewInformer
(link ) like everybody else. Reading its code, what happens when the controller is processing 'PVC deleted' event at line 251, i.e just beforeDelete()
is called and at the same time periodic sync starts? The PVC that is being deleted is still in the cache and a 'PVC Sync' will be added intoQueue
and my controller getsOnDelete()
callback followed byOnAdd()
.My PersistentVolume controller then sees an old claim and tries to do stuff with it and sometimes it updates the claim in etcd. So the claim gets 'resurrected' in etcd even though user deleted it.
It is possible that my controller does something terribly wrong - I checked it twice, but it's pretty complicated piece of code. I am 100% sure that
OnAdd()
is called as reaction tocache.Sync
event, I did a debug log inProcess
function of Informer.The text was updated successfully, but these errors were encountered: