Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
389c4675
Unverified
Commit
389c4675
authored
Dec 14, 2017
by
Serge Hallyn
Committed by
GitHub
Dec 14, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2039 from brauner/2017-12-14/fix_command_socket_race
commands: fix race when open()/close() cmd socket
parents
ec09a5a2
f893d898
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
start.c
src/lxc/start.c
+12
-2
No files found.
src/lxc/start.c
View file @
389c4675
...
@@ -784,12 +784,22 @@ void lxc_fini(const char *name, struct lxc_handler *handler)
...
@@ -784,12 +784,22 @@ void lxc_fini(const char *name, struct lxc_handler *handler)
cgroup_destroy
(
handler
);
cgroup_destroy
(
handler
);
lxc_set_state
(
name
,
handler
,
STOPPED
);
/* This function will try to connect to the legacy lxc-monitord state
* server and only exists for backwards compatibility.
*/
lxc_monitor_send_state
(
name
,
STOPPED
,
handler
->
lxcpath
);
if
(
handler
->
conf
->
reboot
==
0
)
{
if
(
handler
->
conf
->
reboot
==
0
)
{
/* close command socket */
/* For all new state clients simply close the command socket.
* This will inform all state clients that the container is
* STOPPED and also prevents a race between a open()/close() on
* the command socket causing a new process to get ECONNREFUSED
* because we haven't yet closed the command socket.
*/
close
(
handler
->
conf
->
maincmd_fd
);
close
(
handler
->
conf
->
maincmd_fd
);
handler
->
conf
->
maincmd_fd
=
-
1
;
handler
->
conf
->
maincmd_fd
=
-
1
;
}
else
{
lxc_set_state
(
name
,
handler
,
STOPPED
);
}
}
if
(
run_lxc_hooks
(
name
,
"post-stop"
,
handler
->
conf
,
NULL
))
{
if
(
run_lxc_hooks
(
name
,
"post-stop"
,
handler
->
conf
,
NULL
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment