[go-nuts] Re: blocking profiler

2018-04-04 Thread sothy shan


On Wednesday, April 4, 2018 at 2:59:06 PM UTC+2, Dave Cheney wrote:
>
> You can report issues with Go at this link, golang.org/issue/new. 
>
> However, this looks like a docker weirdness so we cannot help you as the 
> bug isn't in go, it's docker weirdness.
>
> Please try their support forums, sorry I don't have those details, i've 
> never tried to get support for their product.
>

thanks Dave.  

>
> On Wednesday, 4 April 2018 21:52:08 UTC+10, sothy shan wrote:
>>
>>
>>
>> On Tuesday, April 3, 2018 at 4:50:36 PM UTC+2, Dave Cheney wrote:
>>>
>>> I’ve not seen that problem before. I’d hazard a guess that it’s an 
>>> incorrect go installation. Don’t set goroot, basically ever. But it’s just 
>>> a guess. 
>>>
>> It is basically problem when I run in docker container. This is sample 
>> program.
>>
>> ++
>> package main
>>
>> import (
>> "os"
>> "runtime/pprof"  
>> "runtime"
>> "fmt"   
>> ) 
>>
>> func main() {
>> f,_ :=os.Create("./ipcore_blocking.prof")
>> 
>>  runtime.SetBlockProfileRate(1)
>>   
>>   defer func() {
>> if err := pprof.Lookup("block").WriteTo(f,0); err 
>> !=nil {
>> fmt.Printf("blocking profiler statistic 
>> collecition initialization failed: %v", err)
>>  }
>>
>>  f.Close()
>>  runtime.SetBlockProfileRate(0)
>>}()  
>> // create new channel of type int
>> ch := make(chan int)
>>
>> // start new anonymous goroutine
>> go func() {
>> // send 42 to channel
>> ch <- 42
>> }()
>> // read from channel
>> <-ch
>> }
>> +
>> When I run localhost, it workes well. when I tries to run docker 
>> container, it didnt work. I can give my dockerfile here. 
>> FROM golang:1.9-alpine as dev
>>
>> +++
>> RUN apk add --no-cache --repository 
>> http://dl-3.alpinelinux.org/alpine/edge/community upx
>>
>> WORKDIR /go/src/project
>>
>>
>> COPY ./main.go /go/src/project
>> RUN go build -o /bin/project
>>
>> FROM scratch
>> COPY --from=dev /bin/project /bin/project
>> ENTRYPOINT ["/bin/project"]
>>  
>> +
>> I have another problem when I run in Docker with CPU profile. 
>>
>> In this case where to report the issues?
>>
>> Best regards
>> Sothy
>>
>>>
>>> Are you able to create a stand alone program that demonstrates the issue 
>>> with the profile? Please consider raising a bug, golang.org/issue/new
>>
>>

-- 
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.


[go-nuts] Re: blocking profiler

2018-04-04 Thread Dave Cheney
You can report issues with Go at this link, golang.org/issue/new. 

However, this looks like a docker weirdness so we cannot help you as the 
bug isn't in go, it's docker weirdness.

Please try their support forums, sorry I don't have those details, i've 
never tried to get support for their product.

On Wednesday, 4 April 2018 21:52:08 UTC+10, sothy shan wrote:
>
>
>
> On Tuesday, April 3, 2018 at 4:50:36 PM UTC+2, Dave Cheney wrote:
>>
>> I’ve not seen that problem before. I’d hazard a guess that it’s an 
>> incorrect go installation. Don’t set goroot, basically ever. But it’s just 
>> a guess. 
>>
> It is basically problem when I run in docker container. This is sample 
> program.
>
> ++
> package main
>
> import (
> "os"
> "runtime/pprof"  
> "runtime"
> "fmt"   
> ) 
>
> func main() {
> f,_ :=os.Create("./ipcore_blocking.prof")
> 
>  runtime.SetBlockProfileRate(1)
>   
>   defer func() {
> if err := pprof.Lookup("block").WriteTo(f,0); err 
> !=nil {
> fmt.Printf("blocking profiler statistic 
> collecition initialization failed: %v", err)
>  }
>
>  f.Close()
>  runtime.SetBlockProfileRate(0)
>}()  
> // create new channel of type int
> ch := make(chan int)
>
> // start new anonymous goroutine
> go func() {
> // send 42 to channel
> ch <- 42
> }()
> // read from channel
> <-ch
> }
> +
> When I run localhost, it workes well. when I tries to run docker 
> container, it didnt work. I can give my dockerfile here. 
> FROM golang:1.9-alpine as dev
>
> +++
> RUN apk add --no-cache --repository 
> http://dl-3.alpinelinux.org/alpine/edge/community upx
>
> WORKDIR /go/src/project
>
>
> COPY ./main.go /go/src/project
> RUN go build -o /bin/project
>
> FROM scratch
> COPY --from=dev /bin/project /bin/project
> ENTRYPOINT ["/bin/project"]
>  
> +
> I have another problem when I run in Docker with CPU profile. 
>
> In this case where to report the issues?
>
> Best regards
> Sothy
>
>>
>> Are you able to create a stand alone program that demonstrates the issue 
>> with the profile? Please consider raising a bug, golang.org/issue/new
>
>

-- 
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.


[go-nuts] Re: blocking profiler

2018-04-04 Thread sothy shan


On Tuesday, April 3, 2018 at 4:50:36 PM UTC+2, Dave Cheney wrote:
>
> I’ve not seen that problem before. I’d hazard a guess that it’s an 
> incorrect go installation. Don’t set goroot, basically ever. But it’s just 
> a guess. 
>
It is basically problem when I run in docker container. This is sample 
program.

++
package main

import (
"os"
"runtime/pprof"  
"runtime"
"fmt"   
) 

func main() {
f,_ :=os.Create("./ipcore_blocking.prof")

 runtime.SetBlockProfileRate(1)
  
  defer func() {
if err := pprof.Lookup("block").WriteTo(f,0); err !=nil 
{
fmt.Printf("blocking profiler statistic collecition 
initialization failed: %v", err)
 }
   
 f.Close()
 runtime.SetBlockProfileRate(0)
   }()  
// create new channel of type int
ch := make(chan int)

// start new anonymous goroutine
go func() {
// send 42 to channel
ch <- 42
}()
// read from channel
<-ch
}
+
When I run localhost, it workes well. when I tries to run docker container, 
it didnt work. I can give my dockerfile here. 
FROM golang:1.9-alpine as dev

+++
RUN apk add --no-cache --repository 
http://dl-3.alpinelinux.org/alpine/edge/community upx

WORKDIR /go/src/project


COPY ./main.go /go/src/project
RUN go build -o /bin/project

FROM scratch
COPY --from=dev /bin/project /bin/project
ENTRYPOINT ["/bin/project"]
 
+
I have another problem when I run in Docker with CPU profile. 

In this case where to report the issues?

Best regards
Sothy

>
> Are you able to create a stand alone program that demonstrates the issue 
> with the profile? Please consider raising a bug, golang.org/issue/new

-- 
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.


[go-nuts] Re: blocking profiler

2018-04-03 Thread Dave Cheney
I’ve not seen that problem before. I’d hazard a guess that it’s an incorrect go 
installation. Don’t set goroot, basically ever. But it’s just a guess. 

Are you able to create a stand alone program that demonstrates the issue with 
the profile? Please consider raising a bug, golang.org/issue/new

-- 
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.


[go-nuts] Re: blocking profiler

2018-04-03 Thread sothy shan


On Saturday, March 31, 2018 at 12:15:34 AM UTC+2, Dave Cheney wrote:
>
> It looks like you’re stopping the block profile immediately after starting 
> it. 
>
> Try github.com/pkg/profile which will take care of the plumbing for you. 


Thanks Dave for pointing your code.
After viewing your code, I corrected my code.


 f,err :=os.Create("/tmp/test_blocking.prof")
  if err != nil  {
 log.WithError(err).Fatal("creation of blocking 
profiler file is failed" )
  }
  runtime.SetBlockProfileRate(1)
  
  defer func() {
 if err := pprof.Lookup("block").WriteTo(f,0); err 
!=nil {
log.WithError(err).Fatal("blocking profiler 
statistic collecition initialization failed")
 }
   
 f.Close()
 runtime.SetBlockProfileRate(0)
  }()

Now I am getting block profile information. When I run the go tool pprof, I 
got nothing in the result. Why?



go tool pprof test_blocking.prof 
Main binary filename not available.
Type: delay
Entering interactive mode (type "help" for commands, "o" for options)
(pprof) top30
Showing nodes accounting for 13.16mins, 100% of 13.16mins total
  flat  flat%   sum%cum   cum%
 13.16mins   100%   100%  13.16mins   100%  



-- 
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.