[Lxc-users] lxc_cgroup start error

Christoph Mitasch cmitasch at thomas-krenn.com
Fri Aug 24 13:19:16 UTC 2012


Thanks for clarification. I currently have two containers and so a race condition is very probable.

Can I help with testing something or is it already ready to be fixed?

Christoph

----- Original Message -----
From: "Serge Hallyn" <serge.hallyn at canonical.com>
To: "Christoph Mitasch" <cmitasch at thomas-krenn.com>
Cc: lxc-users at lists.sourceforge.net
Sent: Friday, August 24, 2012 2:50:50 PM
Subject: Re: [Lxc-users] lxc_cgroup start error

Quoting Christoph Mitasch (cmitasch at thomas-krenn.com):
> Hello,
> 
> I've built a LXC HA Cluster with Pacemaker and DRBD with Ubuntu 12.04.
> 
> >From time to time I get the following error when a container is startet.
>       lxc-start 1345755927.759 ERROR    lxc_cgroup - File exists - failed to create '/sys/fs/cgroup/perf_event//lxc' directory
>       lxc-start 1345755927.759 ERROR    lxc_start - failed to spawn 'test2'
>       lxc-start 1345755928.023 ERROR    lxc_cgroup - No such file or directory - failed to remove cgroup '/sys/fs/cgroup/perf_event//lxc/test2'
> 
> Any ideas what the problem could be here?

Sounds like a race in src/lxc/cgroup.c.  I'm guessing that:

        /* if cgparent does not exist, create it */
        if (access(cgparent, F_OK) && mkdir(cgparent, 0755)) {
                SYSERROR("failed to create '%s' directory", cgparent);
                return -1;
        }

the first two containers created after boot are racing here, and this
should be changed to

        /* if cgparent does not exist, create it */
        if (access(cgparent, F_OK) && mkdir(cgparent, 0755)) {
		if (errno != EEXIST) {
			SYSERROR("failed to create '%s' directory", cgparent);
			return -1;
		}
        }




More information about the lxc-users mailing list