NebuTech / NBMiner

GPU Miner for ETH, RVN, BEAM, CFX, ZIL, AE, ERGO
https://nbminer.com
3.19k stars 521 forks source link

NBMiner does not support method client.reconnect() #995

Open PSLLSP opened 1 year ago

PSLLSP commented 1 year ago

NBMiner 42.3 for Linux

It looks like NBMiner doesn't support client.reconnect. I demonstrate it with MiningRigRental pool.

That pool is different from other pools. Client connects to TCP port 3333 and pool dynamically configures new TCP port and asks miner to reconnect, it uses stratum method client.reconnect.

DEMO, mine kawpow; NBMiner fails to connect to TCP port 3333, the issue:

$ cat test-nbminer-mrr7.sh
#!/bin/sh

POOL="eu-01.miningrigrentals.com:3333"
USER="droidMiner.294955"
PASS="TEST7"

OPTS=""

./nbminer -a "kawpow" -o "stratum+tcp://$POOL" -u "$USER" -p "$PASS" $OPTS $@
$ sh test-nbminer-mrr7.sh
[12:07:05] INFO - ----------------------------------------------
[12:07:05] INFO - |                                            |
[12:07:05] INFO - |         NBMiner - Crypto GPU Miner         |
[12:07:05] INFO - |                    42.3                    |
[12:07:05] INFO - |                                            |
[12:07:05] INFO - ----------------------------------------------
[12:07:05] INFO - ------------------- System -------------------
[12:07:05] INFO - OS:     Ubuntu 18.04.6 LTS, 5.10.0-hiveos
[12:07:05] INFO - CPU:    AMD Athlon(tm) II X4 610e Processor
[12:07:05] INFO - RAM:    6232 MB / 7918 MB
[12:07:05] INFO - CU_DRV: 11.2, 460.91.03
[12:07:05] INFO - ------------------- Config -------------------
[12:07:05] INFO - ALGO:   kawpow
[12:07:05] INFO - URL:    stratum+tcp://eu-01.miningrigrentals.com:3333
[12:07:05] INFO - USER:   droidMiner.294955
[12:07:05] INFO - TEMP:   limit 90C, start 85C
[12:07:05] WARN - NVAPI init failed.
[12:07:05] WARN - Failed to initialize Nvidia health libraries.
[12:07:05] INFO - ------------------- Device -------------------
[12:07:05] INFO -  |ID|PCI|  CC| Memory| CU| RamType| RamVendor|
[12:07:05] INFO - *| 0|  2|  61|  8119M| 15| UNKNOWN|   Unknown| GeForce GTX 1070
[12:07:05] INFO - ----------------------------------------------
[12:07:05] INFO - kawpow - Logging in to eu-01.miningrigrentals.com(188.166.37.58):3333 ...
[12:07:05] INFO - Set extranonce: f800002e
[12:07:05] INFO - kawpow - Login succeeded.
[12:07:05] INFO - API:  0.0.0.0:22333
[12:07:05] INFO - API server started.
[12:07:05] WARN - Socket error: The remote host closed the connection
[12:07:05] INFO - Logout.
[12:07:05] INFO - Device 0 started, Free mem = 1787 MB.
[12:07:07] INFO - kawpow - Logging in to eu-01.miningrigrentals.com(188.166.37.58):3333 ...
[12:07:07] INFO - Set extranonce: f800002e
[12:07:07] INFO - kawpow - Login succeeded.
[12:07:07] WARN - Socket error: The remote host closed the connection
[12:07:07] INFO - Logout.
[12:07:09] INFO - kawpow - Logging in to eu-01.miningrigrentals.com(188.166.37.58):3333 ...
[12:07:09] INFO - Set extranonce: f800002e
[12:07:09] INFO - kawpow - Login succeeded.
[12:07:09] WARN - Socket error: The remote host closed the connection

When I use a workaround and configure redirection manually, NBMiner can connect to MRR pool and mine but this is not ideal as this port was dynamically generated and can be changed and after that NBMiner configuration has to be adjusted, again and again and again... :-(

Workarround:

$ cat test-nbminer-mrr8.sh
#!/bin/sh

#POOL="eu-01.miningrigrentals.com:3333"
POOL="eu-01.miningrigrentals.com:50814"
USER="droidMiner.294955"
PASS="TEST8"

OPTS=""

./nbminer -a "kawpow" -o "stratum+tcp://$POOL" -u "$USER" -p "$PASS" $OPTS $@
$ sh test-nbminer-mrr8.sh
[12:09:55] INFO - ----------------------------------------------
[12:09:55] INFO - |                                            |
[12:09:55] INFO - |         NBMiner - Crypto GPU Miner         |
[12:09:55] INFO - |                    42.3                    |
[12:09:55] INFO - |                                            |
[12:09:55] INFO - ----------------------------------------------
[12:09:55] INFO - ------------------- System -------------------
[12:09:55] INFO - OS:     Ubuntu 18.04.6 LTS, 5.10.0-hiveos
[12:09:55] INFO - CPU:    AMD Athlon(tm) II X4 610e Processor
[12:09:55] INFO - RAM:    6231 MB / 7918 MB
[12:09:55] INFO - CU_DRV: 11.2, 460.91.03
[12:09:55] INFO - ------------------- Config -------------------
[12:09:55] INFO - ALGO:   kawpow
[12:09:55] INFO - URL:    stratum+tcp://eu-01.miningrigrentals.com:50814
[12:09:55] INFO - USER:   droidMiner.294955
[12:09:55] INFO - TEMP:   limit 90C, start 85C
[12:09:55] WARN - NVAPI init failed.
[12:09:55] WARN - Failed to initialize Nvidia health libraries.
[12:09:55] INFO - ------------------- Device -------------------
[12:09:55] INFO -  |ID|PCI|  CC| Memory| CU| RamType| RamVendor|
[12:09:55] INFO - *| 0|  2|  61|  8119M| 15| UNKNOWN|   Unknown| GeForce GTX 1070
[12:09:55] INFO - ----------------------------------------------
[12:09:55] INFO - kawpow - Logging in to eu-01.miningrigrentals.com(188.166.37.58):50814 ...
[12:09:56] INFO - Set extranonce: d0
[12:09:56] INFO - kawpow - Login succeeded.
[12:09:56] INFO - API:  0.0.0.0:22333
[12:09:56] INFO - API server started.
[12:09:56] INFO - kawpow - New job: eu-01.miningrigrentals.com:50814, ID: 616a, HEIGHT: 213250, DIFF: 4.295G
[12:09:56] INFO - mining.extranonce.subscribe succeeded.
[12:09:56] INFO - Device 0 started, Free mem = 1787 MB.
[12:09:58] INFO - Light cache built, 1.52 s.
[12:09:58] INFO - Building DAG for EPOCH 28 on Device 0 ...

One more DEMO, try to connect to port 3333, this time in verbose mode. It is visible that pool asks miner to reconnect but that request is ignored, the issue:

$ cat test-nbminer-mrr7.sh --verbose
...
[15:16:33] INFO - ------------------- Device -------------------
[15:16:33] INFO -  |ID|PCI|  CC| Memory| CU| RamType| RamVendor|
[15:16:33] INFO - *| 0|  2|  61|  8119M| 15| UNKNOWN|   Unknown| GeForce GTX 1070
[15:16:33] INFO - ----------------------------------------------
[15:16:33] INFO - kawpow - Logging in to eu-01.miningrigrentals.com(188.166.37.58):3333 ...
[15:16:33] INFO - ---- {"id":1,"method":"mining.subscribe","params":["NBMiner/42.3",null]}
[15:16:33] INFO - ++++ {"error":null,"id":1,"result":[["mining.notify","ae6812eb4cd7735a302a8a9dd95cf71f"],"f800002e",4]}
[15:16:33] INFO - Set extranonce: f800002e
[15:16:33] INFO - kawpow - Login succeeded.
[15:16:33] INFO - ---- {"id":2,"method":"mining.authorize","params":["droidMiner.294955","TEST7"]}
[15:16:33] INFO - ---- {"id":3,"method":"mining.extranonce.subscribe","params":[]}
[15:16:33] INFO - API:  0.0.0.0:22333
[15:16:33] INFO - API server started.
[15:16:34] INFO - ++++ {"error":null,"id":2,"result":true}
[15:16:34] INFO - ++++ {"error":null,"id":0,"method":"client.reconnect","params":["eu-01.miningrigrentals.com","50814"]}
[15:16:34] WARN - Socket error: The remote host closed the connection
[15:16:34] INFO - Logout.
[15:16:34] INFO - Device 0 started, Free mem = 1769 MB.
[15:16:36] INFO - kawpow - Logging in to eu-01.miningrigrentals.com(188.166.37.58):3333 ...
[15:16:36] INFO - ---- {"id":1,"method":"mining.subscribe","params":["NBMiner/42.3",null]}
[15:16:36] INFO - ++++ {"error":null,"id":1,"result":[["mining.notify","ae6812eb4cd7735a302a8a9dd95cf71f"],"f800002e",4]}
[15:16:36] INFO - Set extranonce: f800002e
[15:16:36] INFO - kawpow - Login succeeded.
[15:16:36] INFO - ---- {"id":2,"method":"mining.authorize","params":["droidMiner.294955","TEST7"]}
[15:16:36] INFO - ---- {"id":3,"method":"mining.extranonce.subscribe","params":[]}
[15:16:36] INFO - ++++ {"error":null,"id":2,"result":true}
[15:16:36] INFO - ++++ {"error":null,"id":0,"method":"client.reconnect","params":["eu-01.miningrigrentals.com","50814"]}
[15:16:36] WARN - Socket error: The remote host closed the connection
[15:16:36] INFO - Logout.

Most of other miners can handle client.reconnect(). An example, gminer already fixed similar issue and can connect directly to TCP port 3333:

$ cat test-gminer-mrr9.sh
#!/bin/sh

POOL="eu-01.miningrigrentals.com:3333"
USER="droidMiner.294955"
PASS="TEST9"

OPTS=""

./gminer -a "kawpow" --server "stratum+tcp://$POOL" --user "$USER" --pass "$PASS" $OPTS $@

Notice, how reconnection from TCP port 3333 to port 50814 is smoothly done. It is cool, isn't it? ;-)

$ sh test-gminer-mrr9.sh
+----------------------------------------------------------------+
|                          GMiner v3.41                          |
+----------------------------------------------------------------+
Algorithm:          KAWPOW
DevFee:             2 %
Server:             
  host:             eu-01.miningrigrentals.com:3333
  user:             droidMiner.294955
  password:         TEST9
Power calculator:   on
Color output:       on
Watchdog:           on
API:                off
Log to file:        off
Selected devices:   GPU0  
Intensity:          100   
Temperature limits: 90/120
------------------------------------------------------------------
12:04:11 Nvidia Driver: 460.91.03
12:04:12 Connected to eu-01.miningrigrentals.com:3333 [188.166.37.58]
12:04:12 Subscribed to Stratum Server
12:04:12 Set Extra Nonce: f800002e
12:04:12 Authorized on Stratum Server
12:04:12 Reconnect to eu-01.miningrigrentals.com:50814
12:04:12 Connected to eu-01.miningrigrentals.com:50814 [188.166.37.58]
12:04:13 Subscribed to Stratum Server
12:04:13 Set Extra Nonce: 03
12:04:13 Authorized on Stratum Server
12:04:13 New Job: 6161 Epoch: #28 Block: #213242 ProgSeed: #71080 Diff: 1.000