Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Crash when unable to get the account balance. #2738

Open
carlospaulino opened this issue Jul 12, 2021 · 3 comments
Open

Crash when unable to get the account balance. #2738

carlospaulino opened this issue Jul 12, 2021 · 3 comments
Labels

Comments

@carlospaulino
Copy link

carlospaulino commented Jul 12, 2021

System information

  • Have I written custom code (as opposed to using zenbot vanilla): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): macOS Big Sur 11.4
  • Zenbot version (commit ref, or version): 5df014a
  • Zenbot branch: unstable
  • NodeJS version: v15.2.1
  • Exact command to reproduce (include everything):
    ./zenbot.sh trade kraken.xeth-zusd --deposit 1000 --strategy dema --period 1h

Describe the problem

Sometimes, when the bot tries to get the latest balance from Kraken, the connection times out. When this happens, the bot crashes because the syncBalance function tries to destructure the quote property from an undefined value. So far, I've noticed that this only occurs when connected to Kraken.

Source code / Error logs

getBalance error:
RequestError: Timeout awaiting 'request' for 5000ms
    at ClientRequest.<anonymous> (/path/zenbot/node_modules/got/dist/source/core/index.js:956:65)
    at Object.onceWrapper (node:events:436:26)
    at ClientRequest.emit (node:events:341:22)
    at ClientRequest.origin.emit (/path/zenbot/node_modules/@szmarczak/http-timer/dist/source/index.js:39:20)
    at TLSSocket.socketErrorListener (node:_http_client:478:9)
    at TLSSocket.emit (node:events:329:20)
    at emitErrorNT (node:internal/streams/destroy:188:8)
    at emitErrorCloseNT (node:internal/streams/destroy:153:3)
    at processTicksAndRejections (node:internal/process/task_queues:80:21)
    at Timeout.timeoutHandler [as _onTimeout] (/path/zenbot/node_modules/got/dist/source/core/utils/timed-out.js:36:25)
    at listOnTimeout (node:internal/timers:558:17)
    at processTimers (node:internal/timers:499:7) {
  name: 'TimeoutError',
  code: 'ETIMEDOUT',
  timings: {
    start: 1626104365616,
    socket: 1626104365616,
    lookup: 1626104365617,
    connect: undefined,
    secureConnect: undefined,
    upload: undefined,
    response: undefined,
    end: undefined,
    error: 1626104370617,
    abort: undefined,
    phases: {
      wait: 0,
      dns: 1,
      tcp: undefined,
      tls: undefined,
      request: undefined,
      firstByte: undefined,
      download: undefined,
      total: 5001
    }
  },
  event: 'request'
}
/path/zenbot/lib/engine.js:378
    syncBalance(function (err, { quote }) {
                                 ^

TypeError: Cannot destructure property 'quote' of 'undefined' as it is undefined.
    at /path/zenbot/lib/engine.js:378:34
    at /path/zenbot/lib/engine.js:224:23
    at /path/zenbot/extensions/exchanges/kraken/exchange.js:155:18
    at /path/zenbot/node_modules/kraken-api/kraken.js:176:23
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:93:5)
@carlospaulino
Copy link
Author

I am going to open a PR to address this issue.

@DeviaVir DeviaVir added the bug label Jul 16, 2021
@Ayush-projects
Copy link

Can i work on this issue?

@carlospaulino
Copy link
Author

Can I work on this issue?

Of course, I've been swamped by work and haven't got the chance to address this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants