benjamin-wilson / public-pool

GNU General Public License v3.0
197 stars 57 forks source link

Is it stuck in a loop? #49

Closed tuaris closed 4 months ago

tuaris commented 4 months ago

I pointed my Bitaxe to a locally setup instance of public-pool. The log (pm2 logs) just continuously prints this out:

2|main  | promise loop, block height 850756
2|main  | promise loop, block height 850756
2|main  | promise loop, block height 850756
2|main  | promise loop, block height 850756
2|main  | promise loop, block height 850756
2|main  | promise loop, block height 850756
2|main  | promise loop, block height 850756
2|main  | promise loop, block height 850756
2|main  | promise loop, block height 850756

The Bitaxe wasn't mining or submitting any shares. Yet when I tested with a simple miner (CPU miner) it started working:

[2024-07-04 23:16:13] thread 15: 98370896 hashes, 7519 khash/s
[2024-07-04 23:16:13] accepted: 68/75 (90.67%), 121145 khash/s (yay!!!)
[2024-07-04 23:16:13] thread 16: 134217696 hashes, 7532 khash/s
[2024-07-04 23:16:14] thread 21: 134217696 hashes, 2545 khash/s
[2024-07-04 23:16:14] thread 18: 134217696 hashes, 2547 khash/s
[2024-07-04 23:16:16] thread 13: 134217696 hashes, 7568 khash/s
[2024-07-04 23:16:16] thread 10: 134217696 hashes, 7559 khash/s
[2024-07-04 23:16:18] thread 27: 134217696 hashes, 2541 khash/s
[2024-07-04 23:16:20] thread 12: 134217696 hashes, 7504 khash/s
[2024-07-04 23:16:22] thread 17: 134217696 hashes, 2545 khash/s
[2024-07-04 23:16:23] thread 23: 134217696 hashes, 2544 khash/s
[2024-07-04 23:16:25] thread 19: 134217696 hashes, 2546 khash/s
[2024-07-04 23:16:26] thread 14: 134217696 hashes, 7583 khash/s

image

The public-pool instance is still printing that out in the logs.

benjamin-wilson commented 4 months ago

I will look into this, there have been some recent changes. Public-Pool runs thousands of clients with the postgres branch :)

tuaris commented 4 months ago

I will look into this, there have been some recent changes. Public-Pool runs thousands of clients with the postgres branch :)

Ah, didn't know there was another branch. Also thanks for putting this out there. I got this running on FreeBSD and will probably make a PR to include them in your documentation.

I want to use this codebase as a way to learn some typescript. Years ago I used to work a lot with the old Python based Stratum server. I did manage to extend it a lot, but that code had too much spaghetti and didn't scale well for ASICs. Once I get familiarized with this code base, I wanted to see if I could add a message broker so that each time a share is submitted, it would advertise it in the message queue under a topic and let something else handle the database inserts (all while ensuring it runs well under FreeBSD). That was a major pain point for the Python stratum server.

benjamin-wilson commented 4 months ago

I've updated and tested the latest changes on master branch. Everything seems to be working as intended.

As far as your performance issues, the postgres implementation can handle tens of thousands of clients as-is.

tuaris commented 4 months ago

Awsome. I'm still fairly new to Node and TypeScript. Is the following sufficient after updating the branch?

git pull
npm run build
pm2 restart main
benjamin-wilson commented 4 months ago

Yes

tuaris commented 4 months ago

Can confirm that is seems better now. I was able to point the BitAxe to it and it's didn't explode like before :).

image

I'll checkout the PostgreSQL branch, see if I can get that running, and then start writing up the FreeBSD installation instructions.

It's great that you made this. The world needs more of these kind of tools. It really helps with decentralization.

tuaris commented 4 months ago

Spoke too soon, but this may be a different problem. Either way, I think the original issue here is solved.

lq Process List qqqqqqqqqqqqqqqklqq  main Logs  qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x[ 2] main     Mem: 159 MB     xx main > [Nest] 9876  - 07/05/2024, 10:05:02 PM     LOG [RouterExplorer]   x
x[ 1] ui       Mem:  82 MB     xx main > [Nest] 9876  - 07/05/2024, 10:05:02 PM     LOG [RoutesResolver]   x
x                              xx main > [Nest] 9876  - 07/05/2024, 10:05:02 PM     LOG [RouterExplorer]   x
x                              xx main > [Nest] 9876  - 07/05/2024, 10:05:02 PM     LOG [RouterExplorer]   x
x                              xx main > [Nest] 9876  - 07/05/2024, 10:05:02 PM     LOG [RouterExplorer]   x
x                              xx main > [Nest] 9876  - 07/05/2024, 10:05:02 PM     LOG [RouterExplorer]   x
x                              xx main > [Nest] 9876  - 07/05/2024, 10:05:02 PM     LOG [RoutesResolver]   x
x                              xx main > [Nest] 9876  - 07/05/2024, 10:05:02 PM     LOG [RouterExplorer]   x
x                              xx main > Using ZMQ                                                         x
x                              xx main > ZMQ Connected                                                     x
x                              xx main > Bitcoin RPC connected                                             x
x                              xx main > Stratum server is listening on port 25000                         x
x                              xx main > Error getmininginfo Error: ESOCKETTIMEDOUT                        x
x                              xx main > [Nest] 9876  - 07/05/2024, 10:05:12 PM     LOG [NestApplication]  x
x                              xx main > API listening on http://0.0.0.0:3334                              x
x                              xx main > New client ID: : 8e2fb897, xxxxxxxxxxxxxx:32934                   x
x                              xx main > Killing dead clients                                              x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqjmqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
lq Custom Metrics qqqqqqqqqqqqqklq Metadata qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x Used Heap Size       58.99   xx App Name              main                                               x
x Heap Usage          93.39 %  xx Namespace             default                                            x
x Heap Size         63.16 MiB  xx Version               0.0.1                                              x
x Event Loop Latency p95       xx Restarts              7                                                  x
x Event Loop Latency           xx Uptime                5m                                                 x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqjmqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
 left/right: switch boards | up/down/mouse: scroll | Ctrl-C: exit    To go further check out https://pm2.io/
benjamin-wilson commented 4 months ago

This error is coming from Bitcoin core timing out, not the pool. This may happen on insufficient hardware

tuaris commented 4 months ago

This error is coming from Bitcoin core timing out, not the pool. This may happen on insufficient hardware

Ah yes, that's it. I never was able to figure out why sometimes Bitcoin core would take nearly 30 seconds or more to return RPC calls on some rare occasions, even on some pretty beefy hardware.