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

printtoconsole no longer works with daemon=1 #2559

Closed
ddemarco5 opened this issue Aug 2, 2022 · 6 comments · Fixed by #2571
Closed

printtoconsole no longer works with daemon=1 #2559

ddemarco5 opened this issue Aug 2, 2022 · 6 comments · Fixed by #2571

Comments

@ddemarco5
Copy link

Bug Report

Current behavior

When gridcoin is run with the option daemon=1 and printtoconsole=1, no output is seen on the console, as the stdout of the process is closed upon forking.

Expected behavior

Previously, the process would fork and print debug.log output to the stdout of the executing process.

Steps to reproduce:

run gridcoinresearchd with daemon=1 and printtoconsole=1

Screenshots

Gridcoin version

5.4.0.0

Machine specs

  • OS: Debian GNU/Linux 11 (bullseye)
  • CPU: 4 core arm64
  • RAM: 2gb
  • Disk size: big enough
  • Disk Type (HD/SSD): flash storage

Extra information

@ddemarco5 ddemarco5 added the bug label Aug 2, 2022
@iFoggz
Copy link
Member

iFoggz commented Aug 3, 2022

Daemon: I can confirm the replicate this issue.
GUI: print to console works as expected.

I believe it's possible that when the daemon forking was fixed to work correctly it has caused this. The print to console may be just outputting to the void now.

as bitcoin mentioned in : bitcoin/bitcoin#10132

Don't use -daemon with -printconsole as they state they do two different things. -daemon detaches itself from the terminal. It may be an inconvenience but I wouldn't consider it a bug.

@div72 you have any input on this?

you can always tail -f the debug file as an alternative

@jamescowens
Copy link
Member

We are actually following the behavior of Bitcoin Core now. Not sure this is a bug at all. Also not sure we want to revert and leave an attached fd.

@jamescowens
Copy link
Member

tail -f won't work to redirect to the systemd journal I think. Quite frankly, when the executable is being wrapped by a systemd service, there is NO REASON to have it fork as a daemon. The service should be set to simple mode and gridcoinresearchd should not be daemonized. Then the -printtoconsole will work as expected. We should document this, as it is equivalent to what has to be done for Bitcoin Core now.

@ddemarco5
Copy link
Author

I'm fine with a fix in doc (everyone's favorite kind of fix!), I've already made the changes to the systemd service like @jamescowens mentioned.
I primarily wrote up the issue to track an undocumented change in behavior.

@iFoggz
Copy link
Member

iFoggz commented Aug 4, 2022

kudos on the nice bug report formatting

@jamescowens
Copy link
Member

Maybe we should do more than just change the documentation. Perhaps we should exit the application with an error (before forking) with an error to the console if both options are specified at once, as this is now a non-sensical combination that sends the debug output to the void?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants