-
Notifications
You must be signed in to change notification settings - Fork 18k
os/exec: panic after execute Start #19918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@ayanamist would you mind posting a full/complete program, say in a playground snippet that can |
@odeke-em I have modified the description to add pointed line number in the line comment. |
Have you built and run a version of this program using the race detector?
…On Tue, 11 Apr 2017, 11:21 ayanamist ***@***.***> wrote:
@odeke-em <https://github.com/odeke-em> I have modified the description
to add pointed line number in the line comment.
The full program is very complicated, but above provided code has been
running for months without panic and i don't use any unsafe package
methods and any third party package.
The original program restarts after panic and running well now, and at the
same time it runs the same code provided above every 5 minutes on other
thousands machines.
I think it maybe related with some race conditions?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#19918 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAAcA5a3ABkCGO-QCZY_Hxl1mAv05ew1ks5rutWrgaJpZM4M5fxm>
.
|
@davecheney I add |
Can you please provide the output from the race detector that shows the error occurs in the runtime. Thank you.
… On 11 Apr 2017, at 11:42, ayanamist ***@***.***> wrote:
@davecheney I add -race after found this issue, but runs for hour but got nothing.
I think the race condition occurs in runtime but not my program, because the code provided shows that, after constructing a os.Command object, i call Start immediately within the same method.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@davecheney I mentioned above that i got nothing after enabled |
If there is a data race in the runtime package, the race detector will spot
it.
…On Tue, Apr 11, 2017 at 12:31 PM, ayanamist ***@***.***> wrote:
@davecheney <https://github.com/davecheney> I mentioned above that i got
nothing after enabled -race. I suspect race occurs in runtime because i
don't use unsafe to manipulate anything and i don't use any third party
library, and the object does not escape out of the same method.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19918 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAAcAxiAB5m9FUNHmlL0GdAWf3635aRKks5ruuYCgaJpZM4M5fxm>
.
|
@davecheney So i have no idea why it panics on |
Is your source code available? Can you please provide a runnable code sample that will let others try to reproduce and debug the issue. |
@davecheney Sorry but source code is not available, and even i attach it, i think it won't reproduce. The same code has been running for months on thousands machines, and even it panics this morning, after restart it runs well until now. |
For questions about Go, see https://golang.org/wiki/Questions. |
@bradfitz Why this issue closed? I'm reporting a panic happening in |
@ayanamist unfortunately your report as is isn't self contained/reproducible. Perhaps to help move up its status, here are some points that might be useful:
package main
import (
"fmt"
"io/ioutil"
"os/exec"
)
func execIt() error {
cmd := exec.Command("echo")
cmd.Stderr = ioutil.Discard
if _, err := cmd.StdoutPipe(); err != nil {
return err
}
if err := cmd.Start(); err != nil {
if cmd.Process != nil {
cmd.Process.Kill()
}
return err
}
return cmd.Wait()
}
func main() {
fmt.Printf("err: %v\n", execIt())
} hope that looks similar to what you are doing |
func func3() (boolean, error) {
foundSomething := false
cmd := exec.Command("echo", "foobar")
cmd.Stderr = ioutil.Discard
stdout, err := cmd.StdoutPipe()
if err != nil {
return foundSomething, err
}
if err := cmd.Start(); err != nil { // main.go:186
if cmd.Process != nil {
cmd.Process.Kill()
}
return foundSomething, err
}
go func() {
time.Sleep(5 * time.Second)
cmd.Process.Kill()
}()
scanner := bufio.NewScanner(stdout)
for scanner.Scan() {
line := scanner.Text()
i := strings.Index(line, ":")
if i < 0 {
continue
}
if strings.Contains(line, "foo") {
foundSomething = true
}
}
err = cmd.Wait()
return foundSomething, err
}
|
I'm sorry, I don't entirely understand what you are saying. Did this crash happen more than once? The crash reported in the original comment is during the call to clear the finalizer when closing a file descriptor. It's not a race condition. The only thing I can think of that could cause this crash is some sort of memory corruption. |
@ianlancetaylor So far, it only happens once. Do you mean other program cause my program memory corruption? |
I don't think a different program could cause memory corruption, but it is possible that there was a hardware failure on your machine. |
I'll investigate whether there is a hardware problem, thank you. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.7.5 linux/amd64
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build059832473=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
What did you do?
What did you expect to see?
Code execute without panic, maybe some errors
What did you see instead?
The text was updated successfully, but these errors were encountered: