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

Frequent Disconnects #114

Open Baaleos opened 6 years ago

Baaleos commented 6 years ago

pool connection error (788e0f9d-a42b-4359-8e34-06f322017a0a): {"code":-1,"message":"Invalid job id"}

Occurs frequently, which then pauses mining. Is there a configuration I am meant to use to fix it?

cazala commented 6 years ago

I noticed something really bad in the code :P any kind of error at the connection level was sending a CoinHive error to all the miners. This makes them stop mining, and they won't rejoin until refreshing the page. I removed this piece of code and instead I just made it reset all the miner connection when there's a pool connection (miners then reconnect gracefully).

Please try version v2.6.6 and let me know if this keeps happening :)

patrickbau commented 6 years ago

npm install -g coin-hive-stratum@latest pm2 restart proxy Is that ok ?

Baaleos commented 6 years ago

It looks like it is working a bit better in that new version. It does still get the errors - but it doesnt grind to a halt for everyone now...

That being said - are these errors / disconnects avoidable or are they just part of coinhive I was not aware of before?

shares accepted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 19
job submitted (f032f45d-ce7b-439d-afbb-c23fadd97dfd): 449596877070143
pool connection error (f032f45d-ce7b-439d-afbb-c23fadd97dfd): {"code":-1,"message":"Invalid job id"}
proxy error: undefined
miner disconnected (f032f45d-ce7b-439d-afbb-c23fadd97dfd)
job submitted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 610989628662355
shares accepted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 20
job submitted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 610989628662355
shares accepted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 21
job submitted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 610989628662355
shares accepted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 22
job submitted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 610989628662355
shares accepted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 23
job submitted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 610989628662355
shares accepted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 24
job submitted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 610989628662355
shares accepted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 25
job submitted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 610989628662355
shares accepted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 26
job submitted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 610989628662355
shares accepted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 27
job submitted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 610989628662355
shares accepted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 28
job submitted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 610989628662355
shares accepted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 29
job submitted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 610989628662355
shares accepted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 30
job submitted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 610989628662355
shares accepted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 31
job submitted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 610989628662355
shares accepted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 32
job submitted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 610989628662355
shares accepted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 33
job submitted (078e2445-fb6d-4620-a483-32fcdc15ccb1): 610989628662355
pool connection error (078e2445-fb6d-4620-a483-32fcdc15ccb1): {"code":-1,"message":"Invalid job id"}
proxy error: undefined
miner disconnected (078e2445-fb6d-4620-a483-32fcdc15ccb1)
cazala commented 6 years ago

are you running the proxy using the CLI or PM2? can I see your proxy.js file or the command line you are using?

cazala commented 6 years ago

of course you should strip off the credential or path to keys if you are using any.

Baaleos commented 6 years ago

PM2? CLI? Er... I am just installing it on a ubuntu aws server via npm install -g coin-hive-stratum@latest Then I run:

coin-hive-stratum 8892 --host=etnpool.minekitten.io --port=3333

That seems to work and I leave it running on a screen instance. I can still see the invalid job ids appearing - but they no longer knock all connected miners off.


 <script src="https://coinhive.com/lib/coinhive.min.js">
    <script>
    CoinHive.CONFIG.WEBSOCKET_SHARDS = [["ws://xxxxxxxxxxxxxxxxxx.com:8892/proxy"]];
    var miner = new CoinHive.Anonymous("etnk6k5YqVxYgsoU1sSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",{
    //threads: 7,
    autoThreads: false,
    throttle: 0.35,
    forceASMJS: false
 });

    miner.start();
cazala commented 6 years ago

okay, yea, you are using the CLI (command line interface). I can see you are mining ETN, I haven't tested those pools that much, so maybe it is an issue related to ETN..

cazala commented 6 years ago

I recommend you ro run the proxy using PM2 (process manager). There's a guide in the readme about installing the proxy on DigitalOcean, it's pretty much the same thing if you are using an ubuntu image on aws, it might be useful for you. just my 2 cents.

patrickbau commented 6 years ago

The problem keeps happening I'm using pm2 mining on supportxmr.com 2017-12-18_21-24-03

Baaleos commented 6 years ago

That error might be different than mine - mine is complaining about invalid job id. Is invalid job id perhaps a symptom of the hash being solved by someone else?

Im not so much bothered about it disconnecting, because it does generally reconnect, however the time is seems to disconnect for seems a little long. That being said - it would be the coinhive js library that controls the reconnection.

Probably out of coinhive-stratums control.

Co2Noss commented 6 years ago

I'm getting the exact same error message on my end. Seems on the front-end the hashes per second stops and the user no longer receives output and the miner disconnects and then reconnects.

We are mining Monero XMR at http://pool.carpecrypto.me with version 2.6.6 with CLI because patrick above is using PM2 and having a similar issue

zacktmt commented 6 years ago

Same issue here mining ETN