storycraft / node-kakao

Loco protocol compatible library
MIT License
405 stars 115 forks source link

CLIENT error: read ECONNABORTED #597

Closed tadashi74 closed 2 years ago

tadashi74 commented 2 years ago

Describe the bug A clear and concise description of what the bug is. Ex) 휴대폰 Termux에서 봇 구동중입니다. 봇 구동 후 몇 시간 후에 클라이어트 에러가 발생합니다.

CLIENT.on('error', (err) => {
console.log(`Client error!! ${err}`);
main().then().catch(e=>console.log(e));
});

이에 위 코드를 통해 클라이언트가 발생하면 재로그인하게 하려 했으나, 이마저도 재로그인 과정에서 오류가 발생합니다.

To Reproduce Steps to reproduce the behavior. 봇을 구동 후 CLIENT.on('error', (err) => { console.log(`Client error!! ${err}`); }) 로 오류 캐치

Expected behavior Clinet 에러가 발생하지 말아야 합니다.

Screenshots If applicable, add screenshots to help explain your problem. 에러로그: (재로그인전)

Client error!! Error: read ECONNABORTED
(node:23274) UnhandledPromiseRejectionWarning: Error: read ECONNABORTED at TCP.onStreamRead (internal/stream_base_commons.js:209:20) 
(Use `node --trace-warnings ...` to show where the warning was created) 
(node:23274) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) 
(node:23274) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

(재로그인후)

Error: connect ECONNABORTED 211.249.219.27:443
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
  errno: -103,
  code: 'ECONNABORTED',
  syscall: 'connect',
  address: '어드레스',
  port: 443,
  config: {
    url: 'https://katalk.kakao.com/win32/account/login.json',
    method: 'post',
    data: 'email=이메일&password=비번&forced=true&device_uuid=유유아이디device_name=이름',
    headers: {
      Accept: '*/*',
      'Content-Type': 'application/x-www-form-urlencoded',
      Host: 'katalk.kakao.com',
      'Accept-Language': 'ko',
      A: 'win32/3.2.3/ko',
      'User-Agent': 'KT/3.2.3 Wd/10.0 ko',
      'X-VC': 'b1468b2a1904712c',
      'Content-Length': 185
    },
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [Function: transformResponse],
    timeout: 0,
    adapter: [Function: httpAdapter],
    responseType: 'arraybuffer',
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: 100000000,
    maxBodyLength: 100000000,
    validateStatus: [Function: validateStatus]
  },
  request: <ref *1> Writable {
    _writableState: WritableState {
      objectMode: false,
      highWaterMark: 16384,
      finalCalled: false,
      needDrain: false,
      ending: false,
      ended: false,
      finished: false,
      destroyed: false,
      decodeStrings: true,
      defaultEncoding: 'utf8',
      length: 0,
      writing: false,
      corked: 0,
      sync: true,
      bufferProcessing: false,
      onwrite: [Function: bound onwrite],
      writecb: null,
      writelen: 0,
      afterWriteTickInfo: null,
      buffered: [],
      bufferedIndex: 0,
      allBuffers: true,
      allNoop: true,
      pendingcb: 0,
      prefinished: false,
      errorEmitted: false,
      emitClose: true,
      autoDestroy: true,
      errored: null,
      closed: false
    },
    _events: [Object: null prototype] {
      response: [Function: handleResponse],
      error: [Function: handleRequestError]
    },
    _eventsCount: 2,
    _maxListeners: undefined,
    _options: {
      maxRedirects: 21,
      maxBodyLength: 100000000,
      protocol: 'https:',
      path: '/win32/account/login.json',
      method: 'POST',
      headers: [Object],
      agent: undefined,
      agents: [Object],
      auth: undefined,
      hostname: 'katalk.kakao.com',
      port: null,
      nativeProtocols: [Object],
      pathname: '/win32/account/login.json'
    },
    _ended: false,
    _ending: true,
    _redirectCount: 0,
    _redirects: [],
    _requestBodyLength: 185,
    _requestBodyBuffers: [ [Object] ],
    _onNativeResponse: [Function (anonymous)],
    _currentRequest: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: false,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: true,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: null,
      _hasBody: true,
      _trailer: '',
      finished: false,
      _headerSent: true,
      socket: [TLSSocket],
      _header: 'POST /win32/account/login.json HTTP/1.1\r\n' +
        'Accept: */*\r\n' +
        'Content-Type: application/x-www-form-urlencoded\r\n' +
        'Host: katalk.kakao.com\r\n' +
        'Accept-Language: ko\r\n' +
        'A: win32/3.2.3/ko\r\n' +
        'User-Agent: KT/3.2.3 Wd/10.0 ko\r\n' +
        'X-VC: b1468b2a1904712c\r\n' +
        'Content-Length: 185\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      method: 'POST',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      path: '/win32/account/login.json',
      _ended: false,
      res: null,
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'katalk.kakao.com',
      protocol: 'https:',
      _redirectable: [Circular *1],
      [Symbol(kCapture)]: false,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype]
    },
    _currentUrl: 'https://katalk.kakao.com/win32/account/login.json',
    [Symbol(kCapture)]: false
  },
  response: undefined,
  isAxiosError: true,
  toJSON: [Function: toJSON]
}
storycraft commented 2 years ago

라이브러리 문제가 아닌 네트워크 문제로 끊기는 것으로 추정됩니다