-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
potential SIGPIPE if configuring tls client wrong #7807
Comments
@hongchaodeng Can't reproduce. Tried the same code and etcd server/client versions, with wrong scheme. I do not get
|
@hongchaodeng This happens only in
client.balancer = newSimpleBalancer(cfg.Endpoints)
conn, err := client.dial(cfg.Endpoints[0], grpc.WithBalancer(client.balancer))
client.balancer = newSimpleBalancer(cfg.Endpoints)
conn, err := client.dial("", grpc.WithBalancer(client.balancer)) c.f. #7733 I don't think we would backport that PR. It was for benchmarking. /cc @heyitsanthony @xiang90 |
Was able to reproduce with @hongchaodeng Client version (v3.1.x, master) does not matter. package main
import (
"context"
"crypto/tls"
"fmt"
"log"
"os"
"os/signal"
"time"
"github.com/coreos/etcd/clientv3"
)
func main() {
c := make(chan os.Signal, 1)
signal.Notify(c)
go func() {
log.Printf("received signal: %v", <-c)
os.Exit(1)
}()
if _, err := CheckHealth("http://localhost:2380", nil); err != nil {
panic(err)
}
fmt.Println("sleeping...")
time.Sleep(5 * time.Second)
}
func CheckHealth(url string, tc *tls.Config) (bool, error) {
cfg := clientv3.Config{
Endpoints: []string{url},
DialTimeout: 5 * time.Second,
TLS: tc,
}
etcdcli, err := clientv3.New(cfg)
if err != nil {
return false, fmt.Errorf("failed to create etcd client for %s: %v", url, err)
}
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
_, err = etcdcli.Get(ctx, "/", clientv3.WithSerializable())
cancel()
etcdcli.Close()
if err != nil {
return false, fmt.Errorf("etcd health probing failed for %s: %v", url, err)
}
return true, nil
} I think this is from Go runtime sending Docker has separate Any thoughts? @xiang90 @heyitsanthony |
@xiang90 @hongchaodeng I checked that grpc-go code does not trigger SIGPIPE. So it's the process getting the signals (c.f. golang/go#12931). What other projects do (ignore SIGPIPEs and do not terminate): |
Closing this for now, since it's more of Go issue, and happens only in |
Scenario
When calling
clientv3.New()
with the wrong scheme -- "http://xxx", "https://xxx", program will receive SIGPIPE. Such user error should not cause program level exit.Environment
etcd version:
OS: linux
Reproduce
Updated with simpler reproduce steps without TLS:
The text was updated successfully, but these errors were encountered: