chrisleekr / binance-trading-bot

Automated Binance trading bot - Trade multiple cryptocurrencies. Buy low/sell high with Grid Trading. Integrated with TradingView technical analysis
MIT License
5k stars 1.09k forks source link

Unable to fully release the lock on resource "redlock:trailing-trade-closed-trades:USDT". #558

Open TomXiaoYZ opened 1 year ago

TomXiaoYZ commented 1 year ago

Version

Description

To Reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected Behaviours

Screenshots

Additional context

Rayn0r commented 1 year ago

After running the bot for 2 days, I saw similar errors. I'm Running Version: v0.0.96 (209d2e0)

The errors continued for several hours before the bot got restarted using docker-compose -f docker-compose.server.yml [down|up -d|. Here are the errors from the logs.

    "message": "Unable to fully release the lock on resource \"redlock:trailing-trade-configurations:global\".",
    "name": "LockError",
    "stack": "LockError: Unable to fully release the lock on resource \"redlock:trailing-trade-configurations:global\".
    at loop (/srv/node_modules/redlock/redlock.js:282:18)
    at /srv/node_modules/redlock/redlock.js:462:10
    at tryCatcher (/srv/node_modules/standard-as-callback/built/utils.js:12:23)
    at /srv/node_modules/standard-as-callback/built/index.js:22:53
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)"
    "message": "Unable to fully release the lock on resource \"redlock:trailing-trade-common:exchange-symbols\".",
    "name": "LockError",
    "stack": "LockError: Unable to fully release the lock on resource \"redlock:trailing-trade-common:exchange-symbols\".
    at loop (/srv/node_modules/redlock/redlock.js:282:18)
    at /srv/node_modules/redlock/redlock.js:462:10
    at tryCatcher (/srv/node_modules/standard-as-callback/built/utils.js:12:23)
    at /srv/node_modules/standard-as-callback/built/index.js:22:53
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)"
    "message": "Exceeded 4 attempts to lock the resource \"redlock:trailing-trade-configurations:global\".",
    "name": "LockError",
    "stack": "LockError: Exceeded 4 attempts to lock the resource \"redlock:trailing-trade-configurations:global\".
    at /srv/node_modules/redlock/redlock.js:431:20
    at tryCatcher (/srv/node_modules/bluebird/js/release/util.js:16:23)
    at Promise.errorAdapter [as _rejectionHandler0] (/srv/node_modules/bluebird/js/release/nodeify.js:35:34)
    at Promise._settlePromise (/srv/node_modules/bluebird/js/release/promise.js:601:21)
    at Promise._settlePromise0 (/srv/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/srv/node_modules/bluebird/js/release/promise.js:725:18)
    at _drainQueueStep (/srv/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/srv/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/srv/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/srv/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (internal/timers.js:464:21)"
    "message": "Unable to fully release the lock on resource \"redlock:trailing-trade-closed-trades:USDT\".",
    "name": "LockError",
    "stack": "LockError: Unable to fully release the lock on resource \"redlock:trailing-trade-closed-trades:USDT\".
    at loop (/srv/node_modules/redlock/redlock.js:282:18)
    at /srv/node_modules/redlock/redlock.js:462:10
    at tryCatcher (/srv/node_modules/standard-as-callback/built/utils.js:12:23)
    at /srv/node_modules/standard-as-callback/built/index.js:22:53
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)"
Rayn0r commented 1 year ago

I encountered this problem at least twice this week. Running docker restart binance-bot tradingview did not help to resolve the problem. Running docker restart binance-redis however helped. I did run docker logs binance-redis just before the restart, but there was only one warning in the logs. It said:

WARNING: The TCP backlog setting of 65536 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of  1024

This is caused by https://github.com/chrisleekr/binance-trading-bot/blob/master/redis/redis.conf#L20 and https://github.com/chrisleekr/binance-trading-bot/blob/master/docker-compose.server.yml#L43 containing different values.

To get rid of the warning, both values have to be the same. But I am not sure if this will cure the problem. I change my docker-compose.server.yml accordingly and will report back, if it helped.