cazala / coin-hive-stratum

use CoinHive's JavaScript miner on any stratum pool
http://npmjs.com/package/coin-hive-stratum
417 stars 463 forks source link

Hashing stops on all clients when an invalid account is provided #105

Open JRoosh opened 6 years ago

JRoosh commented 6 years ago

So, I have this problem with a couple pools-- seems to only effect ones that require an actual username (mining pool hub, minergate, etc). The basic situation is this: everything is working fine, with a bunch of clients connected and hashing. Then a new client joins with an invalid account, and everyone dies until the stratum is restarted. The logs show the following:

miner connected (b5016b21-2a3f-44af-99e5-f8e762db105d) miner started (b5016b21-2a3f-44af-99e5-f8e762db105d) pool connection error (b5016b21-2a3f-44af-99e5-f8e762db105d): invalid_site_key proxy error: undefined miner disconnected (b5016b21-2a3f-44af-99e5-f8e762db105d) socket closed (:) connection closed (:)

Again, this doesn't happen with anonymous type pools (like supportxmr.com).

Am I doing something wrong, or is this a bug?

Thanks!

cazala commented 6 years ago

thank you for this valuable information. it seems that this is an issue when using CoinHive.User and not CoinHive.Anonymous I look into this and report back.

cazala commented 6 years ago

could you shares your /stats ? i'm worried about the amount of miners against the amount of connections that your proxy has, there should be 1 connection every 100 miners but it has been reported that this is not working sometimes.

cazala commented 6 years ago

@cpufanboy please try v2.6.6

JRoosh commented 6 years ago

Thanks so much for the help, I will update as soon as I can and let you know how it goes.

Thanks again for the brilliant work!

JRoosh commented 6 years ago

Well, after upgrading and testing for a bit, it doesn't appear to fixed. It would seem that the behavior is similar:

A user signs up with an invalid user account, the stratum-side sees this in the log:

coin-hive-stratum v2.6.6 listening on port miners per connection: 100 host: port: pass: x miner connected (9376b224-ffb6-4168-aafb-cc33dfd85ea2) miner started (9376b224-ffb6-4168-aafb-cc33dfd85ea2) pool connection error (9376b224-ffb6-4168-aafb-cc33dfd85ea2): invalid_site_key proxy error: undefined miner disconnected (9376b224-ffb6-4168-aafb-cc33dfd85ea2) socket closed (:) connection closed (:) miner connected (43456d9a-455e-455b-bc76-a8e5fe9d54ee) miner started (43456d9a-455e-455b-bc76-a8e5fe9d54ee)

The difference between the earlier build and this is appears to be that the JS miner no longer gets the on('error') event. The stratum side stops accepting anymore connections still, as before.

Mind you this is under zero load, with a single miner as a test. The JS side is using the CoinHive.Anonymous method, as before.

Anything else I can do to help?

cazala commented 6 years ago

try v2.6.7 please

JRoosh commented 6 years ago

Progress, for sure. The miners now (properly) receive the "invalid_site_key" error, but the socket is still closing to the pool, requiring a restart of the stratum to begin working for any clients again.