CoiniumServ icon indicating copy to clipboard operation
CoiniumServ copied to clipboard

DigiByte DGB-Qubit "no new blocks found," not polling properly?

Open fship7 opened this issue 6 years ago • 8 comments

I got everything up and running for DigiByte with Qubit, but CoiniumServ doesn't seem to be polling properly for new blocks. It does not give any error messages, but it doesn't restart the work when a new block shows up. Only after the timeout period (set to 55 seconds in this case) will it update the block and send out new work. Was there some kind of change in the DigiByte RPC?

From server.log:

05/11/2018 16:17:19 +00:00 [Information] [PlatformManager] [global] Running over Mono 5.12.0.226 (tarball Thu May 3 09:48:32 UTC 2018), framework: 4.5 (v4.0.30319.42000). 05/11/2018 16:17:22 +00:00 [Information] [MySqlProvider] [Digibyte] Mysql storage initialized: 127.0.0.1:3306, database: dgbq. 05/11/2018 16:17:22 +00:00 [Information] [RedisProvider] [Digibyte] Redis storage initialized: 127.0.0.1:6379. 05/11/2018 16:17:25 +00:00 [Information] [JobManager] [Digibyte] Broadcasted new job 0x1 to 0 subscribers as no new blocks found for last 55 seconds 05/11/2018 16:17:25 +00:00 [Information] [NetworkInfo] [Digibyte] symbol: DGB algorithm: qubit version: 6160200 protocol: 70016 wallet: 159900 network difficulty: 312550.32611418 block difficulty: 312550.33 network hashrate: 0.00 KH/s network: mainnet peers: 22 blocks: 6584904 errors: none 05/11/2018 16:17:25 +00:00 [Information] [StratumServer] [Digibyte] Stratum server listening on 0.0.0.0:3333 05/11/2018 16:17:28 +00:00 [Information] [WebServer] [global] Web-server listening on: http://localhost:8080/ 05/11/2018 16:18:20 +00:00 [Information] [JobManager] [Digibyte] Broadcasted new job 0x2 to 0 subscribers as no new blocks found for last 55 seconds 05/11/2018 16:19:15 +00:00 [Information] [JobManager] [Digibyte] Broadcasted new job 0x3 to 0 subscribers as no new blocks found for last 55 seconds 05/11/2018 16:20:10 +00:00 [Information] [JobManager] [Digibyte] Broadcasted new job 0x4 to 0 subscribers as no new blocks found for last 55 seconds 05/11/2018 16:21:05 +00:00 [Information] [JobManager] [Digibyte] Broadcasted new job 0x5 to 0 subscribers as no new blocks found for last 55 seconds 05/11/2018 16:22:00 +00:00 [Information] [JobManager] [Digibyte] Broadcasted new job 0x6 to 0 subscribers as no new blocks found for last 55 seconds 05/11/2018 16:22:55 +00:00 [Information] [JobManager] [Digibyte] Broadcasted new job 0x7 to 0 subscribers as no new blocks found for last 55 seconds 05/11/2018 16:23:50 +00:00 [Information] [JobManager] [Digibyte] Broadcasted new job 0x8 to 0 subscribers as no new blocks found for last 55 seconds 05/11/2018 16:24:45 +00:00 [Information] [JobManager] [Digibyte] Broadcasted new job 0x9 to 0 subscribers as no new blocks found for last 55 seconds

From debug.log:

05/11/2018 16:17:19 +00:00 [Information] [PlatformManager] [global] Running over Mono 5.12.0.226 (tarball Thu May 3 09:48:32 UTC 2018), framework: 4.5 (v4.0.30319.42000). 05/11/2018 16:17:21 +00:00 [Debug] [Pool] [Digibyte] Generated cryptographically random instance Id: 2849936586 05/11/2018 16:17:22 +00:00 [Information] [MySqlProvider] [Digibyte] Mysql storage initialized: 127.0.0.1:3306, database: dgbq. 05/11/2018 16:17:22 +00:00 [Information] [RedisProvider] [Digibyte] Redis storage initialized: 127.0.0.1:6379. 05/11/2018 16:17:25 +00:00 [Information] [JobManager] [Digibyte] Broadcasted new job 0x1 to 0 subscribers as no new blocks found for last 55 seconds 05/11/2018 16:17:25 +00:00 [Information] [NetworkInfo] [Digibyte] symbol: DGB algorithm: qubit version: 6160200 protocol: 70016 wallet: 159900 network difficulty: 312550.32611418 block difficulty: 312550.33 network hashrate: 0.00 KH/s network: mainnet peers: 22 blocks: 6584904 errors: none 05/11/2018 16:17:25 +00:00 [Information] [StratumServer] [Digibyte] Stratum server listening on 0.0.0.0:3333 05/11/2018 16:17:26 +00:00 [Debug] [StatisticsManager] [global] Recached statistics - took 0.834 seconds 05/11/2018 16:17:28 +00:00 [Information] [WebServer] [global] Web-server listening on: http://localhost:8080/ 05/11/2018 16:18:20 +00:00 [Verbose] [JobManager] [Digibyte] As idle job timer expired, rebroadcasting new work 05/11/2018 16:18:20 +00:00 [Information] [JobManager] [Digibyte] Broadcasted new job 0x2 to 0 subscribers as no new blocks found for last 55 seconds 05/11/2018 16:18:26 +00:00 [Debug] [StatisticsManager] [global] Recached statistics - took 0.131 seconds 05/11/2018 16:19:15 +00:00 [Verbose] [JobManager] [Digibyte] As idle job timer expired, rebroadcasting new work 05/11/2018 16:19:15 +00:00 [Information] [JobManager] [Digibyte] Broadcasted new job 0x3 to 0 subscribers as no new blocks found for last 55 seconds 05/11/2018 16:19:26 +00:00 [Debug] [StatisticsManager] [global] Recached statistics - took 0.172 seconds 05/11/2018 16:20:10 +00:00 [Verbose] [JobManager] [Digibyte] As idle job timer expired, rebroadcasting new work 05/11/2018 16:20:10 +00:00 [Information] [JobManager] [Digibyte] Broadcasted new job 0x4 to 0 subscribers as no new blocks found for last 55 seconds 05/11/2018 16:20:27 +00:00 [Debug] [StatisticsManager] [global] Recached statistics - took 0.170 seconds 05/11/2018 16:21:05 +00:00 [Verbose] [JobManager] [Digibyte] As idle job timer expired, rebroadcasting new work 05/11/2018 16:21:05 +00:00 [Information] [JobManager] [Digibyte] Broadcasted new job 0x5 to 0 subscribers as no new blocks found for last 55 seconds 05/11/2018 16:21:27 +00:00 [Debug] [StatisticsManager] [global] Recached statistics - took 0.069 seconds 05/11/2018 16:22:00 +00:00 [Verbose] [JobManager] [Digibyte] As idle job timer expired, rebroadcasting new work 05/11/2018 16:22:00 +00:00 [Information] [JobManager] [Digibyte] Broadcasted new job 0x6 to 0 subscribers as no new blocks found for last 55 seconds 05/11/2018 16:22:27 +00:00 [Debug] [StatisticsManager] [global] Recached statistics - took 0.131 seconds 05/11/2018 16:22:53 +00:00 [Debug] [JobTracker] [Digibyte] Cleaned-up 3 expired jobs 05/11/2018 16:22:55 +00:00 [Verbose] [JobManager] [Digibyte] As idle job timer expired, rebroadcasting new work 05/11/2018 16:22:55 +00:00 [Information] [JobManager] [Digibyte] Broadcasted new job 0x7 to 0 subscribers as no new blocks found for last 55 seconds 05/11/2018 16:23:27 +00:00 [Debug] [StatisticsManager] [global] Recached statistics - took 0.179 seconds 05/11/2018 16:23:50 +00:00 [Verbose] [JobManager] [Digibyte] As idle job timer expired, rebroadcasting new work 05/11/2018 16:23:50 +00:00 [Information] [JobManager] [Digibyte] Broadcasted new job 0x8 to 0 subscribers as no new blocks found for last 55 seconds 05/11/2018 16:24:27 +00:00 [Debug] [StatisticsManager] [global] Recached statistics - took 0.201 seconds 05/11/2018 16:24:45 +00:00 [Verbose] [JobManager] [Digibyte] As idle job timer expired, rebroadcasting new work 05/11/2018 16:24:45 +00:00 [Information] [JobManager] [Digibyte] Broadcasted new job 0x9 to 0 subscribers as no new blocks found for last 55 seconds

fship7 avatar May 11 '18 16:05 fship7

Look at CoiniumServ/src/CoiniumServ/Jobs/Manager/JobManager.cs

I am probably wrong, but doesn't the "return" on line 122 cause line 129 to get skipped? Doesn't that cause the timer to elapse and never get reset? But, I must be wrong because this would mean the polling function has been broken for over 1 year and nobody has noticed.

Still, if I put

_blockPollerTimer.Change(_poolConfig.Job.BlockRefreshInterval, Timeout.Infinite); // reset the block-poller timer so we can keep polling.

just before the return then everything works beautiful.

fship7 avatar May 13 '18 01:05 fship7

Can you give a larger code snippet of where you put that and the proper syntax?

arebias avatar May 14 '18 12:05 arebias

The if statement starting on line 121 simply becomes:

if (blockTemplate.Height == _jobTracker.Current.Height) {_blockPollerTimer.Change(_poolConfig.Job.BlockRefreshInterval, Timeout.Infinite); return;}

This way the timer gets reset properly in the case where the block has not changed since the last poll. There is not really a nice way to exit a try in C#, so this was an easy mistake to make. I am surprised though that nobody has run into this issue, it's a very basic part of the program. Probably I don't understand the code properly.

fship7 avatar May 14 '18 13:05 fship7

I just rebuilt and am giving it a try now.

I noticed that same idle timeout occurring quite often in my debug.log as well.

arebias avatar May 14 '18 13:05 arebias

Line 129, _blockPollerTimer.Change(_poolConfig.Job.BlockRefreshInterval, Timeout.Infinite);, does get executed when there's an RPC exception of some sort. The blockPollerTimer also happens when the timer runs out. By making the changes as you did, you will flood yourself with new job broadcasts every second or two.

You can simply achieve the same effect without code change by setting "rebroadcastTimeout" in your pool conf to a lower value, ex. 5. This will broadcast new jobs more frequently as per your code change.

flyx2888 avatar May 14 '18 22:05 flyx2888

No. Line 129 gets executed after the try/catch except in the cases where the return on line 122 causes it to get skipped, which it should never do. The blockPollerTimer does not flood job requests, it polls the RPC for new work. Unless your node has some kind of push ability, you have to keep asking it if the block has changed. Your change to make the rebroadcastTimeout equal to 5 is what would cause a flood. You would force your miners to change jobs every 5 seconds even if the job hasnt actually changed.

fship7 avatar May 14 '18 22:05 fship7

Yeah you're right. I hadn't actually tested your change yet when I commented. I was simply visualizing it. Good find.

flyx2888 avatar May 15 '18 01:05 flyx2888

How can we enable this Block notify in the CoiniumServ Pool. it is very hard to find a block without this feature enabled

Maleksh avatar Aug 13 '18 06:08 Maleksh