I'm testing race conditions again as we speak, however this object is 
created WITHIN the goroutine (the http request), there is no way, afaik, 
that is being used from another routine.

El jueves, 2 de mayo de 2019, 15:19:02 (UTC-3), Marcin Romaszewicz escribió:
>
> If that's the actual problem, you'd just be masking it, and producing an 
> invalid "x". Look here:
>
> func (r *Subid_info) Prepare_subid_logic(){
>     r.Second_subid_8=fmt.Sprintf("1%07v", r.Second_subid) ----> panic 
> happens here.
> }
>
> r.Second_subid is in an invalid state which normal Go code could not 
> create. This means that some other goroutine might be in the middle of 
> changing its value at the same time, and you have a race condition, so Ian 
> Lance Taylor's suggestion to run using the race detector is probably the 
> best bet.
>
> -- Marcin
>
>
> On Thu, May 2, 2019 at 11:13 AM Burak Serdar <bse...@ieee.org 
> <javascript:>> wrote:
>
>> On Thu, May 2, 2019 at 11:31 AM XXX ZZZ <emarti...@gmail.com 
>> <javascript:>> wrote:
>> >
>> > Hello,
>> >
>> > We are having a random panic on our go application that is happening 
>> once every million requests or so, and so far we haven't been able to 
>> reproduce it nor to even grasp what's going on.
>> >
>> > Basically our code goes like:
>> >
>> > type Subid_info struct{
>> >     Affiliate_subid     string
>> >     Second_subid        string
>> >     Second_subid_8        string
>> >     S2                    string
>> >     Internal_subid        string
>> >     Internal_subid_9    string
>> >     Internal_subid_12     string
>> >     Result                 string
>> > }
>> >
>> > func (r *Subid_info) Prepare_subid_logic(){
>> >     r.Second_subid_8=fmt.Sprintf("1%07v", r.Second_subid) ----> panic 
>> happens here.
>> > }
>> >
>> > And the trace we get is:
>> >
>> > panic: runtime error: invalid memory address or nil pointer dereference
>> > [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x466b6e]
>> >
>> > goroutine 17091 [running]:
>> > unicode/utf8.RuneCountInString(0x0, 0x5, 0xc048c275a8)
>> >     /usr/local/go/src/unicode/utf8/utf8.go:411 +0x2e
>> > fmt.(*fmt).padString(0xc023c17780, 0x0, 0x5)
>> >     /usr/local/go/src/fmt/format.go:113 +0x134
>> > fmt.(*fmt).fmtS(0xc023c17780, 0x0, 0x5)
>> >     /usr/local/go/src/fmt/format.go:347 +0x61
>> > fmt.(*pp).fmtString(0xc023c17740, 0x0, 0x5, 0xc000000076)
>>
>> Right here in fmtString, the function gets a 0x0, 0x5 arg, which is I
>> believe a string of length 5 with a nil slice. So it looks like
>> somehow r.Second_subid has nil buffer here. When a string is used as
>> an interface{}, afaik, the interface keeps the value, not the pointer
>> to the string. So I can't see how this is possible. But I wonder if
>> copying the value before sprintf could fix it:
>>
>> x:=r.Second_subid
>> r.Second_subid_8=fmt.Sprintf("1%07v", x)
>>
>>
>>
>>
>> >     /usr/local/go/src/fmt/print.go:448 +0x132
>> > fmt.(*pp).printArg(0xc023c17740, 0x9978e0, 0xc016a68a30, 0x76)
>> >     /usr/local/go/src/fmt/print.go:684 +0x880
>> > fmt.(*pp).doPrintf(0xc023c17740, 0xa6e22f, 0x5, 0xc048c27818, 0x1, 0x1)
>> >     /usr/local/go/src/fmt/print.go:1112 +0x3ff
>> > fmt.Sprintf(0xa6e22f, 0x5, 0xc048c27818, 0x1, 0x1, 0x80, 0xa36200)
>> >     /usr/local/go/src/fmt/print.go:214 +0x66
>> > 
>> code/sharedobjects/sources.(*Subid_info).Prepare_subid_logic(0xc019292f80, 
>> 0x2)
>> >
>> > Given that we can't reproduce it, what's the logical way to debug this 
>> and find out what's happening?
>> >
>> > Thanks!
>> >
>> > --
>> > You received this message because you are subscribed to the Google 
>> Groups "golang-nuts" group.
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an email to golan...@googlegroups.com <javascript:>.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golan...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to