sorry my English is not good

I wrote a program there is a strange fault, the whole process stuck.

The first fault code:
for {

    log.Debug ( "log1")

    // Call a dll
    // Some operations

    log.Debug ( "sleep")
    time.Sleep (10 * time.Second)
}
The final output of the console is "sleep", wait for an hour and no output 
"log1".

Blocking occurred again today, this time can be determined two coroutines 
blocking position.
One of the code:
for i := 0; i < 5; i++ {
if i != 0 {
time.Sleep(i * time.Second)
}
c, err := net.DialTimeout("tcp", rAddr, NEW_CONN_TIMEOUT*time.Second)
if err != nil {
log.Debug("dial err :%v", err)
return nil, err
}
log.Debug("dial success")
return c,nil
}


Console final output is "dial err", but there is no fifth "dial err" 
output. That is, the blocked program or net.DialTimeout time.Sleep function.

Another watchdog coroutines, the watchdog after the discovery of blocking 
attempts to restart the process, but the watchdog coroutines also be 
blocked. Related code:


for{
time.Sleep(interval * time.Second)
log.Debug("watchdog ...")
cmd := exec.Command(path, args...)
cmd.Start()

fmt.Println(cmd.Path, " kill")

p, err := syscall.GetCurrentProcess()
if err != nil {
fmt.Println("GetCurrentProcess:", err)
os.Exit(0)
}
err = syscall.TerminateProcess(p, 0)
fmt.Println(err)
if err != nil {
os.Exit(0)
}
}

The final output of the console is "kill", but itself has not been 
completed. And did not continue to output "watchdog ...", that is, the 
program syscall.GetCurrentProcess or syscall.TerminateProcess be blocked.


The program only calls the windows CreateMutex, OpenMutex a dll and have 
used the unsafe.

There has been a running program reproduced a failure, is there any way to 
determine the cause of the fault right?

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