albrow / jobs

A persistent and flexible background jobs library for go.
MIT License
500 stars 47 forks source link

Panic in xen container #24

Open fzerorubigd opened 9 years ago

fzerorubigd commented 9 years ago

I have a zen container and this is the output of ip addr show :

ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN 
    link/void 
    inet 127.0.0.2/32 scope host venet0
    inet V.W.X.Y/32 brd V.W.X.Y scope global venet0:0

This is a default container created using proxmox, and I get a panic on the getHardwareAddr.

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

Depending on such thing is not a good idea, why not setting the hardware id by a method? developer should take care of uniqueness in the pool .

albrow commented 9 years ago

@fzerorubigd thanks for bringing this to my attention. Did you mean a xen container? As in http://www.xenproject.org/.

fzerorubigd commented 9 years ago

@albrow Sorry :)))) yes. it is xen.

albrow commented 9 years ago

@fzerorubigd I'm surprised that xen containers don't expose a mac address, and I'm sorry that I made an incorrect assumption here. What if I add a field to PoolConfig which lets you set your own id for the pool? If not provided, jobs will still default to the mac address-based id.

Something like:

type PoolConfig struct {
    // Id is a unique identifier for the pool. If not provided, jobs will attempt
    // to generate an id based on the machine's mac address
    Id string
    // (additional fields omitted here)
}

I also will try and fix the code so it doesn't panic when the mac address isn't found. Instead it will return an error message asking you to provide your own pool id.

Could you share the full stack trace so I can track down what went wrong?

fzerorubigd commented 9 years ago

Thank you. yes, its enough :)

On Sun, Jun 21, 2015 at 4:32 AM, Alex Browne notifications@github.com wrote:

@fzerorubigd https://github.com/fzerorubigd I'm surprised that xen containers don't expose a mac address, and I'm sorry that I made an incorrect assumption here. What if I add a field to PoolConfig which lets you set your own id for the pool? If not provided, jobs will still default to the mac address-based id.

Something like:

type PoolConfig struct { // Id is a unique identifier for the pool. If not provided, jobs will attempt // to generate an id based on the machine's mac address Id string // (additional fields omitted here) }

I also will try and fix the code so it doesn't panic when the mac address isn't found. Instead it will return an error message asking you to provide your own pool id.

Could you share the full stack trace so I can track down what went wrong?

— Reply to this email directly or view it on GitHub https://github.com/albrow/jobs/issues/24#issuecomment-113843336.


http://fzero.rubi.gd