Re: [go-nuts] Invalid memory address of string object

2022-09-26 Thread Kurtis Rader
On Mon, Sep 26, 2022 at 12:03 AM Bernd Fix wrote: > panic: runtime error: invalid memory address or nil pointer dereference > [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x49388d] > Notice the "addr=0x0"? That's a nil pointer dereference. > > Can you show the definition of pee

Re: [go-nuts] Invalid memory address of string object

2022-09-26 Thread 'Axel Wagner' via golang-nuts
Also, this is consistent with your observation that calling peer.Key again returns a valid string. After the first call (returning the invalid string) the concurrent modification of p.str64 has finished and subsequent calls return the full value. Which is to say: Run your code under the race detec

Re: [go-nuts] Invalid memory address of string object

2022-09-26 Thread 'Axel Wagner' via golang-nuts
On Mon, Sep 26, 2022 at 9:03 AM Bernd Fix wrote: > Sure: > > // Key returns a string used for map operations > func (p *PeerID) Key() string { > if p == nil { > return "(nil)" > } > if len(p.str64) == 0 { > p.str64 = base64.StdEncoding.EncodeToString(p.Data) >

Re: [go-nuts] Invalid memory address of string object

2022-09-26 Thread Bernd Fix
No, p.Data is not nil - and the panic does not happen in the Key() method, but in the code from my first email.>Y< On 9/26/22 07:08, Andrew Harris wrote: could p.Data could be nil here? On Monday, September 26, 2022 at 12:03:20 AM UTC-7 Bernd Fix wrote: On 9/25/22 19:05, Kurtis Rader wro

Re: [go-nuts] Invalid memory address of string object

2022-09-26 Thread Andrew Harris
could p.Data could be nil here? On Monday, September 26, 2022 at 12:03:20 AM UTC-7 Bernd Fix wrote: > On 9/25/22 19:05, Kurtis Rader wrote: > > Insufficient information. Show us the panic > panic: runtime error: invalid memory address or nil pointer dereference > [signal SIGSEGV: segmentation vio

Re: [go-nuts] Invalid memory address of string object

2022-09-26 Thread Bernd Fix
On 9/25/22 19:05, Kurtis Rader wrote: Insufficient information. Show us the panic panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x49388d] goroutine 100037 [running]: leatea/core.(*ForwardTable).Learn(0xcb

Re: [go-nuts] Invalid memory address of string object

2022-09-25 Thread Kurtis Rader
Insufficient information. Show us the panic. Are you using CGO? Can you show the definition of peer.Key()? Is it (or any function it calls) using "unsafe"? On Sun, Sep 25, 2022 at 11:16 AM Bernd Fix wrote: > Hi folks, > > I am using go1.19.1 for development and see a strange panic ("invalid > me

[go-nuts] Invalid memory address of string object

2022-09-25 Thread Bernd Fix
Hi folks, I am using go1.19.1 for development and see a strange panic ("invalid memory address") in an application; the panic is definitely not triggered by a nil dereference (the object in question is a string): key = peer.Key() entry, ok := tbl.recs[key] The panic happens in the seco