When i use the vite (bottom layer is node-http-proxy) to start a http-server and proxy the request to target server, ETIMEDOUT problem occurs frequently.

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

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
25/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, node.js
Lĩnh vực
backend, networking

Hướng nghiên cứu

Bắt đầu với cấu hình proxy Vite được báo cáo và các request tới /stomp và /api, sau đó theo dõi cách node-http-proxy mở kết nối tới đích và xử lý ETIMEDOUT trên macOS và Windows. Tái hiện hành vi trong các điều kiện HDD và mạng chậm hơn đã được báo cáo; công việc được xem là hoàn tất khi xác định được nguyên nhân đáng tin cậy và ghi lại hoặc kiểm thử hành vi kết quả.

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

Mô tả

In vite, I was trying to start a http server with following code

server: {
    open: true,
    proxy: setupProxy()
  }

const setupProxy = () => {
  const backendAddr = 'http://192.168.50.213:8180/'

  const wsOptions = {
    target: backendAddr,
    ws: true
  }
  const httpOptions = {
    target: backendAddr,
    changeOrigin: true
  }
  return {
    '/stomp': wsOptions,
    '/api': httpOptions,
    '/pub': httpOptions,
    '/docs': httpOptions
  }
}

According to the vite document, Its bottom layer uses node-http-proxy.
My problem is that my target server is sure to be accessible, but it will encounter proxy timeout problems from time to time.

Error: connect ETIMEDOUT 192.168.50.213:8180
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1300:16)
3:23:48 PM [vite] http proxy error at /stomp/info?t=1670657002883:
Error: connect ETIMEDOUT 192.168.50.213:8180
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1300:16)
3:23:48 PM [vite] http proxy error at /stomp/info?t=1670657002882:
Error: connect ETIMEDOUT 192.168.50.213:8180
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1300:16)
3:23:48 PM [vite] http proxy error at /api/settings/hiddenMenuPaths:
Error: connect ETIMEDOUT 192.168.50.213:8180

What I can offer is that this problem will not occur when my target server deploys on a ssd, which is, the access speed is very fast.
When I deploy the server on a hdd or when the network environment is more complicated, which is, the access speed is not so fast, but definitely not slow, problem returns.
All my colleagues who use Mac have this problem, but all my colleagues who use Windows don't.
Based on the above phenomenon, I doubt whether there are some special configurations for the mac version of nodejs, such as the default timeout time, fault tolerance or automatic retry mechanism, which causes frequent timeout problems when the target server apis are slightly slower.

Ngôn ngữ chính
JavaScript
Star
14.1k
Fork
2k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 http-party/node-http-proxy

Tất cả issue của http-party/node-http-proxy

Issue tương tự

Thêm issue về JavaScript

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.