cherishman2005 / rtc_tools

rtc ffmpeg
3 stars 0 forks source link

[seaweedfs]Connection timed out #1

Closed cherishman2005 closed 2 years ago

cherishman2005 commented 3 years ago

Connection timed out示例

2021/10/08 14:50:02.470 [W]  upload fail: http://upload.filer.yy.com:9889/dataset/zhengkangyuan/face_backup/face_dataset_ori/pack.vggface2_train_tar.filtered_0917/n005124/0179_01.jpg 500 [{"error":"Post http://10.20.170.101:9625/6589,82b3aed1a2a66244: dial tcp 10.20.170.101:9625: connect: connection timed out"}]
cherishman2005 commented 2 years ago
// Listener wraps a net.Listener, and gives a place to store the timeout
// parameters. On Accept, it will wrap the net.Conn with our own Conn for us.
type Listener struct {
    net.Listener
    ReadTimeout  time.Duration
    WriteTimeout time.Duration
}

func (l *Listener) Accept() (net.Conn, error) {
    c, err := l.Listener.Accept()
    if err != nil {
        return nil, err
    }
    stats.ConnectionOpen()
    tc := &Conn{
        Conn:         c,
        ReadTimeout:  l.ReadTimeout,
        WriteTimeout: l.WriteTimeout,
    }
    return tc, nil
}

// Conn wraps a net.Conn, and sets a deadline for every read
// and write operation.
type Conn struct {
    net.Conn
    ReadTimeout  time.Duration
    WriteTimeout time.Duration
    isClosed     bool
}

服务端的timeout配置是多少?

serverTimeout             = cmdServer.Flag.Int("idleTimeout", 30, "connection idle seconds")

可能是default=30s

cherishman2005 commented 2 years ago
        client = &http.Client{
            Transport: &http.Transport{
                Dial: (&net.Dialer{
                    Timeout:   30 * time.Second,
                    KeepAlive: 30 * time.Second,
                }).Dial,
                TLSClientConfig:     &tls.Config{InsecureSkipVerify: true},
                MaxConnsPerHost:     threadNumber * 4,
                MaxIdleConnsPerHost: threadNumber * 2,
                TLSHandshakeTimeout:   10 * time.Second,
                ResponseHeaderTimeout: 10 * time.Second,
                ExpectContinueTimeout: 1 * time.Second,
            },
        }

客户端的timeout配置为30s,问题不大。