Project

General

Profile

Actions

Bug #1521

closed

Foreman open a new libvirt connection each time the hypervisor page is loaded

Added by David Douard about 12 years ago. Updated about 12 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
VM management
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Foreman opens a new connection each time the page of a libvirt hypervisor is loaded, (may consume all possible libvirtd connections).

I am using a qemu+tls connection to libvirt.

I am using Foreman on a Debian squeeze installed from foreman deb repository (0.4.2-1).

netstat shows that tcp connections stay ESTABLISHED until libvirtd or foreman is restarted.

Actions #1

Updated by Ohad Levy about 12 years ago

thats strange, as we ensure we close down the connection after each request

see https://github.com/theforeman/foreman/blob/0.4-stable/app/controllers/hypervisors/guests_controller.rb#L6

maybe there is a bug in the disconnect method.

Actions #2

Updated by David Douard about 12 years ago

Yes, I gave a quick look at the code, which looks fine at first sigh (but I am no Rubyist).

How can I activate logging to try to find what is going on? Maybe adding some print statements somewhere?

Actions #3

Updated by David Douard about 12 years ago

Humm I've digged a bit, and the disconnect method of Virt.Connection is properly called. Thus the problem may reside in the ruby wrapper for libvirt (I use the Debian package, aka libvirt-ruby1.8 0.0.7-1), unless a reference to the libvirt connection instance is kept somewhere preventing it from being garbage collected, or some similar stuff (not sure this is relevant here).

Actions #4

Updated by David Douard about 12 years ago

I have compiled libvirt-ruby 0.4.0 and the behavior seems much better. TCP connections go in state TIME_WAIT after a short amount of time, then are closed completely.

I'll make more tests tomorrow, but I think I have the culprit...

Actions #5

Updated by Ohad Levy about 12 years ago

  • Status changed from New to Feedback

hmm.. so can we mark this as resolved?

Actions #6

Updated by Corey Osman about 12 years ago

Ohad, my virt ESX code tried to fix this issue. I think we should be caching the libvirt object anyways instead of open/closing the connection so many times. Every time virt opens a connection it has to make so many calls to libvirt.

Actions #7

Updated by David Douard about 12 years ago

Ohad Levy wrote:

hmm.. so can we mark this as resolved?

I did not have time to make extensive tests (as I wanted to do), but it looks that this can be marked as solved.

Actions #8

Updated by Ohad Levy about 12 years ago

  • Status changed from Feedback to Resolved
Actions #9

Updated by Ohad Levy about 12 years ago

Corey Osman wrote:

Ohad, my virt ESX code tried to fix this issue. I think we should be caching the libvirt object anyways instead of open/closing the connection so many times. Every time virt opens a connection it has to make so many calls to libvirt.

Corey I agree, however, as we are planning to swap to using fog for libvirt (and probably use virt within fog) this might be a different context for discussion <-- Thanks!

Actions

Also available in: Atom PDF