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.

オープン
#1,622 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
javascript, node.js

調査の方向性

報告されている Vite のプロキシ設定と /stomp および /api へのリクエストから始め、node-http-proxy が接続先への接続をどのように開き、macOS と Windows で ETIMEDOUT をどのように処理するかを追跡します。報告されている HDD および低速なネットワークの条件で動作を再現します。信頼できる原因を特定し、その結果生じる動作を文書化またはテストできれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
JavaScript
スター
14.1k
フォーク
2k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

http-party/node-http-proxy のほかの issue

http-party/node-http-proxy の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。