-
Notifications
You must be signed in to change notification settings - Fork 49
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
Expose virEventAddHandle #116
Comments
The default implementation is already "evented". You should use it like this: go func() {
for {
if res := libvirt.EventRunDefaultImpl(); res < 0 {
// Report the error somehow or break the loop.
}
}
}()
|
On Tue, Oct 18, 2016 at 3:06 PM, Vincent Bernat
Any idea why it triggers in bursts every five seconds? |
Do you use keepalives? |
Haven't added any yet. Unless they are added automatically when you use something else... |
They are not used automatically. But you don't have any events? Or maybe you are just concerned by the fact that you have bursts? In this case, I wouldn't care much. Maybe an event is translated or trigger several events and |
@vincentbernat Okay, is there any way to cause EventRunDefaultImpl to return ? |
Not from Go. We need to expose I don't think that's useful as you can run the for loop in a separate go routine and never really need to stop it. The loop handles libvirt internal events and as libvirt is thread safe, there is no downside to running it in a separate goroutine/thread. |
@vincentbernat Fully agree with everything you said, except that I think it would be more correct to "clean it up" by guaranteeing an exit (besides when golang just exits). Thanks for confirmation. I'm going to aim to go for the easier patches first, but maybe I'll loop back around to this one. Cheers! |
Without exposing |
@purpleidea in case you want to use the libvirt events for you mgmt project, I collected some of the shortcomings of the libvirt events today and started a discussion on the libvirt mailinglis on how to improve them [1]. [1] https://www.redhat.com/archives/libvir-list/2016-November/msg01318.html |
@rmohr Awesome, thank you for starting the discussion... Couple of questions:
Have you been able to cause this to happen? If so, it should be reported as a serious bug. Is it being tracked somewhere, and can you reproduce it?
Out of curiosity, what is your application for all this? AFAICT, you're not working on
Thanks again! |
It's very important to get events when things happen in libvirt. I've been digging into this code and the libvirt code (in particular
virevent.c
), and have some observations:Calling
EventRunDefaultImpl
in a loop, is useless withoutvirEventAddTimeout
because there is no way to trigger it to return so you can shutdown and break that polling loop if theEventRunDefaultImpl
call is blocked. However, for some reason it seems to return in bursts every 5 seconds... Anyone know why?Secondly, is there a way in libvirt to switch to a select style wait, instead of a polling style loop?
Thanks!
The text was updated successfully, but these errors were encountered: