Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

Panic when using example on ARM #12

Closed
Hades32 opened this issue Feb 21, 2015 · 1 comment
Closed

Panic when using example on ARM #12

Hades32 opened this issue Feb 21, 2015 · 1 comment

Comments

@Hades32
Copy link
Contributor

Hades32 commented Feb 21, 2015

I built the "surgemq" example on a Raspberry Pi 2 with Debian Jessie and get this

E0221 22:25:38.464626    3586 service.go:193/func·008] (1/mosqpub/3594-jessie-rpi) Recovering from panic: runtime error: invalid memory address or nil pointer dereference
E0221 22:25:38.468213    3586 sendrecv.go:33/func·003] (1/mosqpub/3594-jessie-rpi) Recovering from panic: runtime error: invalid memory address or nil pointer dereference
E0221 22:25:38.468502    3586 sendrecv.go:74/func·004] (1/mosqpub/3594-jessie-rpi) Recovering from panic: runtime error: invalid memory address or nil pointer dereference
^CE0221 22:25:45.004451    3586 surgemq.go:77/func·001] Existing due to trapped signal; interrupt

when I execute mosquitto_pub -r -m "test by mr" -t 'test/topic'.

I had to change the example although as otherwise I got more errors. My imports look now like this:

        "github.com/surgemq/surgemq/service"
        "github.com/surge/glog"
@Hades32
Copy link
Contributor Author

Hades32 commented Feb 22, 2015

sorry, looks like a bug in Go on ARM.

For the curious, this is the repro:

package main

import (
    "sync"
    "sync/atomic"
    "fmt"
)

type buffer struct {
        id int32

        mask int64

        done int64

        pcond *sync.Cond
        ccond *sync.Cond

        cwait int64
        pwait int64
}

func test(buf *buffer) bool {
        if atomic.LoadInt64(&buf.done) == 1 {
                return true
        }

        return false
}
func main() {
        var buf buffer
                buf.done = 1
        fmt.Println("pre-fail")
        res := test(&buf)
        fmt.Println("post-fail", res)
}

@Hades32 Hades32 closed this as completed Feb 22, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant