Skip to content
New issue

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

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

Already on GitHub? # to your account

Daemon doesn't handle windows WM_CLOSE #1897

Closed
MichaelMure opened this issue Oct 25, 2015 · 6 comments
Closed

Daemon doesn't handle windows WM_CLOSE #1897

MichaelMure opened this issue Oct 25, 2015 · 6 comments
Labels
help wanted Seeking public contribution on this issue topic/windows Windows specific

Comments

@MichaelMure
Copy link
Contributor

I want to embed a daemon instance in a Qt GUI and I've some trouble to properly terminate the daemon process.

As stated in the QProcess terminate() function:

On Windows, terminate() posts a WM_CLOSE message to all toplevel windows of the process and then to the main thread of the process itself. On Unix and OS X the SIGTERM signal is sent.

What happen is that the daemon doesn't handle this signal and keep running, to be lately abrubtly killed and leaving the repo with a repo.lock file.

I'm not sure about the status of signals on windows and what should be done here. Any idea ?

@whyrusleeping
Copy link
Member

good catch, i think we should be using os.Interrupt instead of os.SIGINT in our interupt handler

@MichaelMure
Copy link
Contributor Author

I tried the pull request branch and it doesn't work for me. The daemon keep running as before.

I also tried to use the windows API from the C++ side without more success:

GenerateConsoleCtrlEvent(CTRL_C_EVENT, daemon_process_->processId());
GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, daemon_process_->processId());

(insert rant about unreadable api docs here)

@whyrusleeping whyrusleeping added help wanted Seeking public contribution on this issue topic/windows Windows specific labels Aug 23, 2016
@djdv djdv self-assigned this May 14, 2019
@djdv djdv removed their assignment Mar 11, 2020
@djdv
Copy link
Contributor

djdv commented Mar 13, 2020

This can be closed when the builds switch to Go 1.14.
See: #6808 (includes a patch for <= 1.13 if needed)

@Stebalien
Copy link
Member

I'm planning on building the next version with go 1.14 anyways. Thanks for tracking this!

@MichaelMure
Copy link
Contributor Author

I'm planning on building the next version with go 1.14 anyways. Thanks for tracking this!

Just a reminder: libp2p/go-libp2p-kad-dht#453 (comment)

@Stebalien
Copy link
Member

The query logic has been rewritten from scratch (in a testing branch for now) so we'll have to re-test that once that stabilizes.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
help wanted Seeking public contribution on this issue topic/windows Windows specific
Projects
None yet
Development

No branches or pull requests

4 participants