Skip to content

Instantly share code, notes, and snippets.

View dqminh's full-sized avatar

Daniel, Dao Quang Minh dqminh

View GitHub Profile
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/prctl.h>
pid_t pid1;
void mhandler(int signum) {
fprintf(stderr, "parent got signal %d\n", signum);
---> Making bundle: tgz (in bundles/1.4.0-dev/tgz)
Created tgz: /go/src/github.com/docker/docker/bundles/1.4.0-dev/tgz/darwin/386/docker-1.4.0-dev.tgz
Created tgz: /go/src/github.com/docker/docker/bundles/1.4.0-dev/tgz/darwin/amd64/docker-1.4.0-dev.tgz
Created tgz: /go/src/github.com/docker/docker/bundles/1.4.0-dev/tgz/freebsd/386/docker-1.4.0-dev.tgz
Created tgz: /go/src/github.com/docker/docker/bundles/1.4.0-dev/tgz/freebsd/amd64/docker-1.4.0-dev.tgz
Created tgz: /go/src/github.com/docker/docker/bundles/1.4.0-dev/tgz/freebsd/arm/docker-1.4.0-dev.tgz
Created tgz: /go/src/github.com/docker/docker/bundles/1.4.0-dev/tgz/linux/386/docker-1.4.0-dev.tgz
Created tgz: /go/src/github.com/docker/docker/bundles/1.4.0-dev/tgz/linux/amd64/docker-1.4.0-dev.tgz
Created tgz: /go/src/github.com/docker/docker/bundles/1.4.0-dev/tgz/linux/arm/docker-1.4.0-dev.tgz
cp: cannot stat '/go/src/github.com/docker/docker/bundles/1.4.0-dev/tgz/../cross/windows/386/docker-1.4.0-dev': No such file or directory
From e924b34feae782228a7b43286a1cc6f2614f0ae1 Mon Sep 17 00:00:00 2001
From: "Daniel, Dao Quang Minh" <dqminh89@gmail.com>
Date: Sun, 11 Jan 2015 04:07:57 -0500
Subject: [PATCH] the process is sigkilled, return correct exit code
Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com> (github: dqminh)
---
daemon/execdriver/native/driver.go | 3 ---
vendor/src/github.com/docker/libcontainer/namespaces/exec.go | 9 ++++++++-
2 files changed, 8 insertions(+), 4 deletions(-)
@dqminh
dqminh / README.md
Last active August 29, 2015 14:15
test-zsh-subreaper

zsh with subreaper

  • compile the test program with gcc -o test-zsh main.c
  • run it as test-zsh no-subreaper|subreaper|subreaper-reap

There are 3 modes:

  • no-subreaper: do not invoke the program with PR_SET_CHILD_SUBREAPER, so the child process of zsh will be reaped by something else ( either zsh? or PID 1)
  • subreaper: set PR_SET_CHILD_SUBREAPER, but doesnt reap child processes when receiving SIGCHLD
3643 ESC[34mINFOESC[0m[84580] GET /containers/e4dfd70059369247043ce49a70d93ea33c28f3a6fa9c613276114145ac9d1d6c/json
3644 ESC[34mINFOESC[0m[84580] +job container_inspect(e4dfd70059369247043ce49a70d93ea33c28f3a6fa9c613276114145ac9d1d6c)
3645 ESC[34mINFOESC[0m[84580] -job container_inspect(e4dfd70059369247043ce49a70d93ea33c28f3a6fa9c613276114145ac9d1d6c) = OK (0)
3646 ESC[31mERROESC[0m[84584] [warning]: couldn't run auplink before unmount: exec: "auplink": executable file not found in $PATH
3647 Untar exit status 1 write /var/lib/docker/devicemapper/devicemapper/data: no space left on device
3648 ESC[34mINFOESC[0m[84584] -job commit(e4dfd70059369247043ce49a70d93ea33c28f3a6fa9c613276114145ac9d1d6c) = ERR (1)
3649 ESC[31mERROESC[0m[84584] Handler for POST /commit returned error: Untar exit status 1 write /var/lib/docker/devicemapper/devicemapper/data: no space left on device
3650 ESC[31mERROESC[0m[84584] HTTP Error: statusCode=500 Untar exit status 1 write /var/lib/docker/devicemapper/devicema
Start(process *Process, hooks map[Event][]string)
-> Start(p, map[Event][]string{
"premount": {"/usr/local/bin/backup-tmp"}, // executed in mnt namespace, before setting any mount points
"postmount": {"/usr/local/bin/restore-tmp"}, // executed in mnt namespace, after setting any mount points, before pivot root
})
--- FAIL: TestExecAfterDaemonRestart (11.59s)
docker_utils.go:148: waiting for daemon to start
docker_utils.go:190: daemon started
docker_utils.go:136: exiting daemon
docker_utils.go:148: waiting for daemon to start
docker_utils.go:190: daemon started
docker_cli_exec_test.go:184: Could not start top after daemon restart: err=exit status 1
Error response from daemon: Cannot start container top: [0] Id already in use: Container with id exists: 68b45ea6f54b940a6be6320002b67fc155c92ee92a9627e2d01f09b506600790
time="2015-03-16T18:47:21Z" level=fatal msg="Error: failed to start one or more containers"
docker_utils.go:136: exiting daemon
docker git:master ❯ sudo service docker restart
docker stop/waiting
docker start/running, process 19816
docker git:master ❯ cat /proc/sys/net/ipv4/ip_local_port_range
32768 61000
docker git:master ❯ docker run -P -p 80 -p 32768:8080 -d busybox top
6315c5cb8192e6d414065c73967605eccf48c1976c4c541a9e8afb6af0fd8aad
FATA[0000] Error response from daemon: Cannot start container 6315c5cb8192e6d414065c73967605eccf48c1976c4c541a9e8afb6af0fd8aad: Bind for 0.0.0.0:32768 failed: port is already allocated
+
+func TestExecinPassExtraFiles(t *testing.T) {
+ if testing.Short() {
+ return
+ }
+ rootfs, err := newRootfs()
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer remove(rootfs)
diff --git a/vendor/src/github.com/docker/libcontainer/process_linux.go b/vendor/src/github.com/docker/libcontainer/process_linux.go
index 1c74b65..fc9a733 100644
--- a/vendor/src/github.com/docker/libcontainer/process_linux.go
+++ b/vendor/src/github.com/docker/libcontainer/process_linux.go
@@ -127,12 +127,13 @@ func (p *setnsProcess) terminate() error {
}
func (p *setnsProcess) wait() (*os.ProcessState, error) {
- err := p.cmd.Wait()
- if err != nil {