dvandal / cryptonote-nodejs-pool

Mining pool for all CryptoNote based coins using Cryptonight, Cryptonight Light and Cryptonight Heavy algorithms
GNU General Public License v2.0
364 stars 610 forks source link

EveryTime, API is crushed #655

Open username1565 opened 3 years ago

username1565 commented 3 years ago

Everytime, by some timeout, API is crushed, and restarted then. In console of server-backend, I see this:

2021-02-15 01:22:39 [api] Stat collection broadcastLiveStats: 8 ms 

ReplyError: EXECABORT Transaction discarded because of previous errors. 
at parseError (/cryptonote-nodejs-pool/node_modules/redis-parser/lib/parser.js:179:12) 
at parseType (/cryptonote-nodejs-pool/node_modules/redis-parser/lib/parser.js:302:14) 

ReplyError: EXECABORT Transaction discarded because of previous errors. 
at parseError (/cryptonote-nodejs-pool/node_modules/redis-parser/lib/parser.js:179:12) 
at parseType (/cryptonote-nodejs-pool/node_modules/redis-parser/lib/parser.js:302:14) 

ReplyError: EXECABORT Transaction discarded because of previous errors. 
at parseError (/cryptonote-nodejs-pool/node_modules/redis-parser/lib/parser.js:179:12) 
at parseType (/cryptonote-nodejs-pool/node_modules/redis-parser/lib/parser.js:302:14) 

ReplyError: EXECABORT Transaction discarded because of previous errors. 
at parseError (/cryptonote-nodejs-pool/node_modules/redis-parser/lib/parser.js:179:12) 
at parseType (/cryptonote-nodejs-pool/node_modules/redis-parser/lib/parser.js:302:14) 

ReplyError: EXECABORT Transaction discarded because of previous errors. 
at parseError (/cryptonote-nodejs-pool/node_modules/redis-parser/lib/parser.js:179:12) 
at parseType (/cryptonote-nodejs-pool/node_modules/redis-parser/lib/parser.js:302:14) 

ReplyError: EXECABORT Transaction discarded because of previous errors. 
at parseError (/cryptonote-nodejs-pool/node_modules/redis-parser/lib/parser.js:179:12) 
at parseType (/cryptonote-nodejs-pool/node_modules/redis-parser/lib/parser.js:302:14) 

2021-02-15 01:22:44 [master] API died, spawning replacement... 
(node:23359) ExperimentalWarning: queueMicrotask() is experimental.

What does this mean?

username1565 commented 3 years ago

This something with redis, because after google this: ReplyError: EXECABORT Transaction discarded because of previous errors. And according this: https://stackoverflow.com/a/54063543

This can also happen due to empty multi command. running redis-cli monitor I saw

1546789398.881549 [0 the-ip] "multi"
1546789398.881575 [0 the-ip] "exec"

Before executing multi, make sure that you have at least 1 command to execute on the transaction.

Somewhere, after try to get status, from redis, redis-monitor show twice:

1546789398.881549 [0 the-ip] "multi"
1546789398.881575 [0 the-ip] "exec"
1546789398.881549 [0 the-ip] "multi"
1546789398.881575 [0 the-ip] "exec"

and then, api crushed, and restarting again.

Anyone know, how to fix this? I see some functions by keyword multi, here: https://github.com/dvandal/cryptonote-nodejs-pool/search?p=2&q=multi&type=

username1565 commented 3 years ago

I found an error, related with this issue, and found this, at this line: https://github.com/dvandal/cryptonote-nodejs-pool/blob/f5f82d19bdd2a3d37d91a902cede68278b7ba3c0/lib/api.js#L2101 Some bullshit there, and this value is undefined. I just changed this to:

lastResponse: JSON.stringify(error ? error : response) || 'ok' //it's "undefined"!

After this, changes, API have no crushes every time, after some timeout.

This do tryes to write undefined, into redis-server, and API got crushes every time, because of this, and restarting again and again, and again, and again...

P.S.: Why this value is undefined, I do not know, but by adding the line:

console.warn(redisCommands, error, response); //before next line
redisClient.multi(redisCommands).exec();

I see, this undefined, after try to getStatus from wallet, while the daemon have some response, there, and this is not undefined. Maybe, need to use some another, different API-calls, for different wallet-API.

username1565 commented 3 years ago

I did try to get status, of wallet, by using wallet-API, and did try to get this, using url http://wallet_API_IP:PORT/status, and I see in console of wallet API, some message, about X-API-KEY does not exists.

So, maybe, because of this, undefined-value was been returned there, from wallet-api.