GithubHelp home page GithubHelp logo

Comments (11)

zond avatar zond commented on July 26, 2024

This was really odd.

The line of code breaking is

atomic.StoreInt64(&result.lastReroute, time.Now().UnixNano())

which doesn't even use Mutexes.

Your Go version seems broken? What version are you running?

from god.

shivakumargn avatar shivakumargn commented on July 26, 2024

I am on tip (currently go1.1rc2).

Problem is consistent with 32-bit build of Go on Win7.
With 64-bit build of Go there is no issue.

I rebuilt Go and tried with same result. Am sure there is no issue with Go version.

Stack trace showing Mutex is something I do not have an answer to right now. Does the sync/atomic achieve atomicity without "mutex" ?

from god.

zond avatar zond commented on July 26, 2024

Have you tried it with 1.0.x?

Really strange that it happens in 32 but not 64 bits.

sync/atomic ought to work without mutexes, it should do its stuff using http://en.wikipedia.org/wiki/Compare-and-swap

from god.

shivakumargn avatar shivakumargn commented on July 26, 2024

Tried with go1.0.3 (32bit), there is no crash. Seems to be a go1.1 issue. I will post on go-nuts list.

from god.

shivakumargn avatar shivakumargn commented on July 26, 2024

With latest go1.1rc3 the panic stack is as below:

D:\sources\gopath\bin>god_server.exe
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x4a924b]

goroutine 1 [running]:
sync/atomic.StoreUint64()
D:/sources/golang/src/pkg/sync/atomic/asm_386.s:147 +0xb
github.com/zond/god/common.(_TimeLock).Lock(0x12b83900)
D:/sources/gopath/src/github.com/zond/god/common/time_lock.go:28 +0xba
github.com/zond/god/radix.(_Tree).Put(0x12b6ddb0, 0x12b6be20, 0xa, 0xa, 0x12b6be30, ...)
D:/sources/gopath/src/github.com/zond/god/radix/tree.go:591 +0x53
github.com/zond/god/radix.func-+006(0x12b6be20, 0xa, 0xa, 0x0, 0x0, ...)
D:/sources/gopath/src/github.com/zond/god/radix/tree.go:240 +0xd2
github.com/zond/god/persistence.(_logfile).play(0x12c2c3c0, 0x2716d4)
D:/sources/gopath/src/github.com/zond/god/persistence/persistence.go:90 +0x10b
github.com/zond/god/persistence.(_Logger).Play(0x12c1f030, 0x2716d4)
D:/sources/gopath/src/github.com/zond/god/persistence/persistence.go:237 +0xe6
github.com/zond/god/radix.(*Tree).Restore(0x12b6ddb0, 0x12b6b200)
D:/sources/gopath/src/github.com/zond/god/radix/tree.go:259 +0x59
github.com/zond/god/dhash.NewNodeDir(0x12b6b210, 0xe, 0x12b6b230, 0xe, 0x12b6b200, ...)
D:/sources/gopath/src/github.com/zond/god/dhash/dhash.go:110 +0x26b
main.main()
D:/sources/gopath/src/github.com/zond/god/god_server/god_server.go:29 +0x29d

from god.

zond avatar zond commented on July 26, 2024

Great!

On Fri, May 10, 2013 at 5:13 AM, sgn [email protected] wrote:

Tried with go1.0.3 (32bit), there is no crash. Seems to be a go1.1 issue.
I will post on go-nuts list.


Reply to this email directly or view it on GitHubhttps://github.com//issues/15#issuecomment-17702273
.

from god.

zond avatar zond commented on July 26, 2024

This was very odd as well.

The line in question

28 atomic.StoreInt64(&self.locktimes[self.index], time.Now().UnixNano())

is referencing the locktimes of self, which is an array (not a slice, so it
can't be un-initialized). Therefore, how can it ever be nil?

The fact that this does not panic at all in 1.0.3 also indicates a bug in
Go 1.1. Would you post that bug as well to the go-nuts list?

On Fri, May 10, 2013 at 5:23 AM, sgn [email protected] wrote:

With latest go1.1rc3 the panic stack is as below:

D:\sources\gopath\bin>god_server.exe

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

goroutine 1 [running]:

sync/atomic.StoreUint64()
D:/sources/golang/src/pkg/sync/atomic/asm_386.s:147 +0xb
github.com/zond/god/common.(_TimeLock).Lock(0x12b83900)
D:/sources/gopath/src/github.com/zond/god/common/time_lock.go:28 +0xba
github.com/zond/god/radix.(_Tree).Put(0x12b6ddb0, 0x12b6be20, 0xa, 0xa,
0x12b6be30, ...)
D:/sources/gopath/src/github.com/zond/god/radix/tree.go:591 +0x53
github.com/zond/god/radix.func-+006(0x12b6be20, 0xa, 0xa, 0x0, 0x0, ...)
D:/sources/gopath/src/github.com/zond/god/radix/tree.go:240 +0xd2
github.com/zond/god/persistence.(_logfile).play(0x12c2c3c0, 0x2716d4)
D:/sources/gopath/src/github.com/zond/god/persistence/persistence.go:90+0x10b
github.com/zond/god/persistence.(_Logger).Play(0x12c1f030, 0x2716d4)
D:/sources/gopath/src/github.com/zond/god/persistence/persistence.go:237+0xe6
github.com/zond/god/radix.(*Tree).Restore(0x12b6ddb0, 0x12b6b200)
D:/sources/gopath/src/github.com/zond/god/radix/tree.go:259 +0x59
github.com/zond/god/dhash.NewNodeDir(0x12b6b210, 0xe, 0x12b6b230, 0xe,
0x12b6b200, ...)
D:/sources/gopath/src/github.com/zond/god/dhash/dhash.go:110 +0x26b
main.main()
D:/sources/gopath/src/github.com/zond/god/god_server/god_server.go:29+0x29d


Reply to this email directly or view it on GitHubhttps://github.com//issues/15#issuecomment-17702483
.

from god.

zond avatar zond commented on July 26, 2024

Ah, I just read the lastest digest from go-nuts.

I will see if I can create a patch that solves the alignment issue.

On Fri, May 10, 2013 at 8:26 AM, Martin Bruse [email protected] wrote:

This was very odd as well.

The line in question

28 atomic.StoreInt64(&self.locktimes[self.index], time.Now().UnixNano())

is referencing the locktimes of self, which is an array (not a slice, so
it can't be un-initialized). Therefore, how can it ever be nil?

The fact that this does not panic at all in 1.0.3 also indicates a bug in
Go 1.1. Would you post that bug as well to the go-nuts list?

On Fri, May 10, 2013 at 5:23 AM, sgn [email protected] wrote:

With latest go1.1rc3 the panic stack is as below:

D:\sources\gopath\bin>god_server.exe

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

goroutine 1 [running]:

sync/atomic.StoreUint64()
D:/sources/golang/src/pkg/sync/atomic/asm_386.s:147 +0xb
github.com/zond/god/common.(_TimeLock).Lock(0x12b83900)
D:/sources/gopath/src/github.com/zond/god/common/time_lock.go:28 +0xba
github.com/zond/god/radix.(_Tree).Put(0x12b6ddb0, 0x12b6be20, 0xa, 0xa,
0x12b6be30, ...)
D:/sources/gopath/src/github.com/zond/god/radix/tree.go:591 +0x53
github.com/zond/god/radix.func-+006(0x12b6be20, 0xa, 0xa, 0x0, 0x0, ...)
D:/sources/gopath/src/github.com/zond/god/radix/tree.go:240 +0xd2
github.com/zond/god/persistence.(_logfile).play(0x12c2c3c0, 0x2716d4)
D:/sources/gopath/src/github.com/zond/god/persistence/persistence.go:90+0x10b
github.com/zond/god/persistence.(_Logger).Play(0x12c1f030, 0x2716d4)
D:/sources/gopath/src/github.com/zond/god/persistence/persistence.go:237+0xe6
github.com/zond/god/radix.(*Tree).Restore(0x12b6ddb0, 0x12b6b200)
D:/sources/gopath/src/github.com/zond/god/radix/tree.go:259 +0x59
github.com/zond/god/dhash.NewNodeDir(0x12b6b210, 0xe, 0x12b6b230, 0xe,
0x12b6b200, ...)
D:/sources/gopath/src/github.com/zond/god/dhash/dhash.go:110 +0x26b
main.main()
D:/sources/gopath/src/github.com/zond/god/god_server/god_server.go:29+0x29d


Reply to this email directly or view it on GitHubhttps://github.com//issues/15#issuecomment-17702483
.

from god.

zond avatar zond commented on July 26, 2024

So, see if that helps. I just moved the arrays and ints in question to be at the very top of the struct they are part of.

from god.

shivakumargn avatar shivakumargn commented on July 26, 2024

Yes, works with this change.

from god.

zond avatar zond commented on July 26, 2024

Perfect :)

from god.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.