Error UNCERTAIN_STATE with origin ETIMEDOUT and Retry Strategy

Đang mở
#1,546 1 bình luận 2 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
32/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, nodejs, redis
Lĩnh vực
backend, databases, networking

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện lỗi timeout của VPN với retry_strategy được nêu, sau đó kiểm tra cơ chế xử lý retry của node-redis đối với UNCERTAIN_STATE và ETIMEDOUT. Hoàn thành khi client không bị treo vô thời hạn và, sau khi VPN được khôi phục, sẽ kết nối lại hoặc báo cáo lỗi cuối cùng theo retry strategy đã cấu hình.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Issue

Supposed to have a vpn timeout errors, I get this error on the redis client:

{
                                    "code": "UNCERTAIN_STATE",
                                    "command": "GET",
                                    "args": [
                                        "c9903ac70a7b58e1bef3ff0fe2c9dcd0"
                                    ],
                                    "origin": {
                                        "errno": "ETIMEDOUT",
                                        "code": "ETIMEDOUT",
                                        "syscall": "read"
                                    }
                                    }

I would like to address it through the retry strategy, but current approach does not seem to work:

retry_strategy: function (options) {

                    self.logger.warn("RedisStore.retryStragegy %@", options);

                    if (options && options.error && options.error.code === 'ECONNREFUSED') {
                        // End reconnecting on a specific error and flush all commands with a individual error
                        return new Error('The server refused the connection');
                    }
                    if (options && options.total_retry_time > 1000 * 60 * 60) {
                        // End reconnecting after a specific timeout and flush all commands with a individual error
                        return new Error('Retry time exhausted');
                    }
                    if (options && options.times_connected > 10) {
                        // End reconnecting with built in error
                        return undefined;
                    }
                    // the reconnect retry will happen exactly after this time in milliseconds
                    return Math.max(options.attempt * 100, 3000);
                }

So at this time, as soon as I get the error, the connection fails, and if the VPN turns on, node-redis will hang for ever.


Environment
  • v12.16.1
  • Redis 5.0.3
  • macOS 10.14.5
Ngôn ngữ chính
TypeScript
Star
17.6k
Fork
2k
Merge trung bình
1 ngày 22 giờ
Pull request đã merge (30 ngày)
62

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của redis/node-redis

Tất cả issue của redis/node-redis

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.