节点中"EIO: i/o error, write"什么.js以及如何消除它?



我有一个节点.js应用程序,使用 elasticsearch 收集错误数据并通知相关的堆栈持有者。它最近开始给我错误(没有对代码进行任何更改(:

write EIO
Error: write EIO
at afterWriteDispatched (internal/stream_base_commons.js:154:25)
at writeGeneric (internal/stream_base_commons.js:145:3)
at WriteStream.Socket._writeGeneric (net.js:783:11)
at WriteStream.Socket._write (net.js:795:8)
at doWrite (_stream_writable.js:385:12)
at writeOrBuffer (_stream_writable.js:367:5)
at WriteStream.Writable.write (_stream_writable.js:307:12)
at Stdio.write (/project/node_modules/elasticsearch/src/lib/loggers/stdio.js:58:6)
at Stdio.onError (/project/node_modules/elasticsearch/src/lib/loggers/stdio.js:70:8)
at Log.wrapper (/project/node_modules/lodash/lodash.js:4929:19)
at Log.emit (events.js:315:20)
at Log.error (/project/node_modules/elasticsearch/src/lib/log.js:239:17)
at checkRespForFailure (/project/node_modules/elasticsearch/src/lib/transport.js:298:18)
at HttpConnector.<anonymous> (/project/node_modules/elasticsearch/src/lib/connectors/http.js:171:7)
at ClientRequest.wrapper (/project/node_modules/lodash/lodash.js:4929:19)
at ClientRequest.emit (events.js:315:20)

我怀疑这与磁盘上的某种类型的I/O错误有关。我该怎么做才能消除错误?我正在使用 Node.js v14.0.0 和 elasticsearch(npm 包(16.7.1。

这可能是由多种原因引起的:

  • 如果您使用的是 Windows 很可能是一个 unicode 问题,您可以通过执行这样的 chp 命令来解决chcp 850但如果您需要 Unicode 字符,那么 iconv-lite 模块应该会有所帮助
  • 尝试写入关闭的终端时
  • 与磁盘相关的问题,例如磁盘已满或操作系统问题...尝试写入输出时
  • 尝试从头开始将模块重新安装到最新版本,因为您可能使用的是有缺陷的模块或未正确安装

事实证明,这是ElasticSearch日志功能中的一个错误,因为它是同步写入stdio的。我们要么必须关闭日志,要么使用第三方记录器。

最新更新