Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

Panic and Crash when load nonfunctional docker-compose file #468

Open
yogihardi opened this issue May 16, 2017 · 2 comments
Open

Panic and Crash when load nonfunctional docker-compose file #468

yogihardi opened this issue May 16, 2017 · 2 comments
Labels

Comments

@yogihardi
Copy link

yogihardi commented May 16, 2017

When I tried to run nonfunctional docker-compose file, I got panic and my apps crashed, I can't catch the nil pointer, even with code below:

	if err := c.Project.Up(context.Background(), options.Up{}); err != nil {
		log.Fatal(err)
	}

error log

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x4da545]

goroutine 18 [running]:
panic(0x979a00, 0xc82000a1a0)
	/usr/local/go/src/runtime/panic.go:464 +0x3e6
github.com/docker/libcompose/docker/service.Convert(0xc820131c00, 0xc820301340, 0x1, 0x1, 0xc820277d20, 0x1, 0x1, 0xc820301430, 0x9, 0x1, ...)
	/home/yogi/work/src/github.com/docker/libcompose/docker/service/convert.go:232 +0x2a15
github.com/docker/libcompose/docker/service.ConvertToAPI(0xc820131c00, 0xc820301340, 0x1, 0x1, 0xc820277d20, 0x1, 0x1, 0xc820301430, 0x9, 0x1, ...)
	/home/yogi/work/src/github.com/docker/libcompose/docker/service/convert.go:59 +0x79
github.com/docker/libcompose/docker/service.(*Service).createContainer(0xc82001d130, 0x7f71bc93ca78, 0xc82000a338, 0x7f71bc93ea38, 0xc820110150, 0x0, 0x0, 0x0, 0xc8201f7d00, 0xc82031e860, ...)
	/home/yogi/work/src/github.com/docker/libcompose/docker/service/service_create.go:28 +0x12b
github.com/docker/libcompose/docker/service.(*Service).up(0xc82001d130, 0x7f71bc93ca78, 0xc82000a338, 0xc82031e860, 0x13, 0x1, 0x0, 0x0)
	/home/yogi/work/src/github.com/docker/libcompose/docker/service/service.go:321 +0x315
github.com/docker/libcompose/docker/service.(*Service).Up(0xc82001d130, 0x7f71bc93ca78, 0xc82000a338, 0x0, 0x0, 0x0)
	/home/yogi/work/src/github.com/docker/libcompose/docker/service/service.go:242 +0x15a
github.com/docker/libcompose/project.(*Project).Up.func1.1(0x7f71bc93cab8, 0xc82001d130, 0x0, 0x0)
	/home/yogi/work/src/github.com/docker/libcompose/project/project_up.go:17 +0x99
github.com/docker/libcompose/project.(*serviceWrapper).Do(0xc82030d730, 0xc82020d3b0, 0x4, 0x6, 0xc820207f58)
	/home/yogi/work/src/github.com/docker/libcompose/project/service-wrapper.go:101 +0x202
github.com/docker/libcompose/project.(*Project).Up.func1(0xc82030d730, 0xc82020d3b0)
	/home/yogi/work/src/github.com/docker/libcompose/project/project_up.go:18 +0xb4
created by github.com/docker/libcompose/project.(*Project).startService
	/home/yogi/work/src/github.com/docker/libcompose/project/project.go:441 +0xbb0
exit status 2

expecting
I think it would be better not panicking and give the error to proper error variable.

docker compose file

{
  "elasticsearch-masters": {
    "image": "rancher/elasticsearch-conf:v0.4.0",
    "labels": {
      "io.rancher.container.hostname_override": "container_name",
      "io.rancher.sidekicks": "elasticsearch-base-master,elasticsearch-datavolume-masters"
    }
  },
  "elasticsearch-datavolume-masters": {
    "labels": {
      "elasticsearch.datanode.config.version": "0",
      "io.rancher.container.hostname_override": "container_name",
      "io.rancher.container.start_once": "true"
    },
    "volumes": [
      "/usr/share/elasticsearch/data",
      "/usr/share/elasticsearch/config"
    ],
    "entrypoint": "/bin/true",
    "image": "elasticsearch:2.2.1"
  },
  "elasticsearch-base-master": {
    "labels": {
      "elasticsearch.master.config.version": "0",
      "io.rancher.container.hostname_override": "container_name"
    },
    "image": "elasticsearch:2.2.1",
    "net": "container:elasticsearch-masters",
    "volumes_from": [
      "elasticsearch-masters",
      "elasticsearch-datavolume-masters"
    ],
    "entrypoint": [
      "/opt/rancher/bin/run.sh"
    ]
  },
  "elasticsearch-datanodes": {
    "image": "rancher/elasticsearch-conf:v0.4.0",
    "labels": {
      "io.rancher.container.hostname_override": "container_name",
      "io.rancher.sidekicks": "elasticsearch-base-datanode,elasticsearch-datavolume-datanode",
      "io.rancher.scheduler.affinity:container_label_ne": "io.rancher.stack_service.name=es2-stack/es2"
    },
    "links": [
      "elasticsearch-masters:es-masters"
    ]
  },
  "elasticsearch-datavolume-datanode": {
    "labels": {
      "elasticsearch.datanode.config.version": "0",
      "io.rancher.container.hostname_override": "container_name",
      "io.rancher.container.start_once": "true"
    },
    "volumes": [
      "/usr/share/elasticsearch/data",
      "/usr/share/elasticsearch/config"
    ],
    "entrypoint": "/bin/true",
    "image": "elasticsearch:2.2.1"
  },
  "elasticsearch-base-datanode": {
    "labels": {
      "elasticsearch.datanode.config.version": "0",
      "io.rancher.container.hostname_override": "container_name"
    },
    "image": "elasticsearch:2.2.1",
    "links": [
      "elasticsearch-masters:es-masters"
    ],
    "entrypoint": [
      "/opt/rancher/bin/run.sh"
    ],
    "volumes_from": [
      "elasticsearch-datanodes",
      "elasticsearch-datavolume-datanode"
    ],
    "net": "container:elasticsearch-datanodes"
  },
  "elasticsearch-clients": {
    "image": "rancher/elasticsearch-conf:v0.4.0",
    "labels": {
      "io.rancher.container.hostname_override": "container_name",
      "io.rancher.sidekicks": "elasticsearch-base-clients,elasticsearch-datavolume-clients"
    },
    "links": [
      "elasticsearch-masters:es-masters"
    ]
  },
  "elasticsearch-datavolume-clients": {
    "labels": {
      "elasticsearch.datanode.config.version": "0",
      "io.rancher.container.hostname_override": "container_name",
      "io.rancher.container.start_once": "true"
    },
    "volumes": [
      "/usr/share/elasticsearch/data",
      "/usr/share/elasticsearch/config"
    ],
    "entrypoint": "/bin/true",
    "image": "elasticsearch:2.2.1"
  },
  "elasticsearch-base-clients": {
    "labels": {
      "elasticsearch.client.config.version": "0",
      "io.rancher.container.hostname_override": "container_name"
    },
    "image": "elasticsearch:2.2.1",
    "volumes_from": [
      "elasticsearch-clients",
      "elasticsearch-datavolume-clients"
    ],
    "net": "container:elasticsearch-clients",
    "entrypoint": [
      "/opt/rancher/bin/run.sh"
    ]
  },
  "kopf": {
    "image": "rancher/kopf:v0.4.0",
    "ports": [
      "83:83"
    ],
    "environment": {
      "KOPF_SERVER_NAME": "es.dev",
      "KOPF_ES_SERVERS": "es-clients:9200"
    },
    "labels": {
      "io.rancher.container.hostname_override": "container_name"
    },
    "links": [
      "elasticsearch-clients:es-clients"
    ]
  }
}

here's details of my machine:

docker version

Client:
 Version:      17.03.1-ce
 API version:  1.27
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Mon Mar 27 17:14:09 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.03.1-ce
 API version:  1.27 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Mon Mar 27 17:14:09 2017
 OS/Arch:      linux/amd64
 Experimental: false

docker info

Client:
 Version:      17.03.1-ce
 API version:  1.27
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Mon Mar 27 17:14:09 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.03.1-ce
 API version:  1.27 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Mon Mar 27 17:14:09 2017
 OS/Arch:      linux/amd64
 Experimental: false
@yogihardi
Copy link
Author

Hi @vdemeester ,

Is there any updates for this bug, maybe patch will available on the next release?
thank you

@markrey
Copy link

markrey commented Jul 31, 2017

@vdemeester any solution for this?

@vdemeester vdemeester self-assigned this Aug 1, 2017
@vdemeester vdemeester removed their assignment Feb 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants