Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Job Declarator server fails with EmptyMempool #744

Closed
Sjors opened this issue Feb 6, 2024 · 10 comments · Fixed by #747
Closed

Job Declarator server fails with EmptyMempool #744

Sjors opened this issue Feb 6, 2024 · 10 comments · Fixed by #747
Assignees
Labels
bug Something isn't working job declarator
Milestone

Comments

@Sjors
Copy link
Collaborator

Sjors commented Feb 6, 2024

I run a custom signet, so sometimes the mempool is actually empty.

     Running `/home/sjors/dev/stratum/roles/target/debug/jd_server -c /home/sjors/.stratum/signet-jd-server.toml`
2024-02-06T11:36:50.014818Z  INFO jd_server: Jds INITIALIZING with config: "/home/sjors/.stratum/signet-jd-server.toml"
2024-02-06T11:36:50.014873Z  INFO jd_server::lib::job_declarator: JD INITIALIZED
2024-02-06T11:36:50.015496Z ERROR jd_server: EmptyMempool
2024-02-06T11:36:50.015507Z ERROR jd_server: Unable to connect to Template Provider (possible reasons: not fully synced, down)
2024-02-06T11:36:50.015528Z ERROR jd_server: SHUTDOWN from Upstream: Mempool error: `EmptyMempool`

But when I create a transaction so that there's something in the mempool, I still the same error.

@Sjors
Copy link
Collaborator Author

Sjors commented Feb 6, 2024

As a quick workaround I did:

                // if mempool_ordered.is_empty() {
                //     Err(JdsMempoolError::EmptyMempool)
                // } else {
                    Ok(mempool_ordered)
                // }

@lorbax
Copy link
Collaborator

lorbax commented Feb 6, 2024

It happened the same for me. It should be that much difficult to fix and I can do it in my PR right now

@Sjors
Copy link
Collaborator Author

Sjors commented Feb 6, 2024

It seems unrelated though, so maybe make a separate PR?

@Sjors
Copy link
Collaborator Author

Sjors commented Feb 6, 2024

Oh, I guess you mean #716 with "my PR". I thought you were talking about #737

@GitGab19
Copy link
Collaborator

GitGab19 commented Feb 6, 2024

I run a custom signet, so sometimes the mempool is actually empty.

     Running `/home/sjors/dev/stratum/roles/target/debug/jd_server -c /home/sjors/.stratum/signet-jd-server.toml`
2024-02-06T11:36:50.014818Z  INFO jd_server: Jds INITIALIZING with config: "/home/sjors/.stratum/signet-jd-server.toml"
2024-02-06T11:36:50.014873Z  INFO jd_server::lib::job_declarator: JD INITIALIZED
2024-02-06T11:36:50.015496Z ERROR jd_server: EmptyMempool
2024-02-06T11:36:50.015507Z ERROR jd_server: Unable to connect to Template Provider (possible reasons: not fully synced, down)
2024-02-06T11:36:50.015528Z ERROR jd_server: SHUTDOWN from Upstream: Mempool error: `EmptyMempool`

But when I create a transaction so that there's something in the mempool, I still the same error.

I introduced that error management in my last PR (#733).
Before it, it was simply not managed and it caused a panic on JDS.
The point is that mempool should never be empty on mainnet, so if that error is generated it means that there are some issues with TP and connection to it should be closed.
I also saw this strange behaviour during testing with asic, and I also thought about introducing a counter (which can be set in config) to be used before closing the connection.
But it depends on how we want to manage this specific case..

@Sjors
Copy link
Collaborator Author

Sjors commented Feb 6, 2024

You can always log a warning that the mempool is empty, but it's not a reason to crash. The mainnet mempool can be empty. And it is for a newly installed node, or if someone deleted mempool.dat.

@pavlenex pavlenex added this to the Milestone 4 milestone Feb 6, 2024
@pavlenex pavlenex added bug Something isn't working job declarator labels Feb 6, 2024
@GitGab19
Copy link
Collaborator

You can always log a warning that the mempool is empty, but it's not a reason to crash. The mainnet mempool can be empty. And it is for a newly installed node, or if someone deleted mempool.dat.

I can integrate this suggestion and open open a new PR. But it depends on how @lorbax is working on his PR #716.
Let me know how you prefer to manage it.

@Sjors
Copy link
Collaborator Author

Sjors commented Feb 12, 2024

This bug is quite annoying, so I would prefer a simple quick fix until #716 is ready.

@lorbax
Copy link
Collaborator

lorbax commented Feb 12, 2024

I am rebasing 716 btw

@GitGab19
Copy link
Collaborator

GitGab19 commented Feb 12, 2024

This bug is quite annoying, so I would prefer a simple quick fix until #716 is ready.

Just opened a PR to fix this issue (#747).
I already had a little testing and it seemed to work well, but a double check on this would be nice

GitGab19 added a commit that referenced this issue Feb 13, 2024
EmptyMempool-error better management and bug fix (#744)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working job declarator
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants