monero-project / monero

Monero: the secure, private, untraceable cryptocurrency
https://getmonero.org
Other
9k stars 3.12k forks source link

monerod exit gets stuck/hangs at deinitializing p2p; network connection activity continues in background; command window will not close and cannot force process to close #9482

Open mmortal03 opened 2 months ago

mmortal03 commented 2 months ago

This has been happening for years, but because it's difficult to debug the Windows version of monerod and because the issue itself is hard to reproduce every single time, I haven't gotten around to creating an issue report here.

What generally happens (and it just happened to me again today) is that I will run monerod for a while (maybe 12 hours) until it is fully synced, and then I will run the exit command. The exiting steps get to the point of deinitializing p2p, and there it remains stuck. At this point, I will wait maybe 20 minutes, then try clicking the X to close the command window, which will cause it to display the red text warning message (I forget what it says), but the window doesn't close.

If I go into Task Manager and try to force close monerod.exe, I get a popup window saying, "Unable to terminate process", "The operation could not be completed.", "Access is denied."

And something new to add that I just noticed today is that when I go into Resource Monitor after it gets stuck, monerod.exe continues to show network activity and numerous TCP connections, so, clearly, the deinitializing of p2p doesn't fully complete wherever in the actual code that it gets stuck.

Furthermore, I tried using a 3rd party tool such as CurrPorts to manually close out all of these network connections, but this didn't help in terms of closing the monerod.exe process. I think it might've lowered the remaining memory use of monerod.exe, but it still wouldn't close or be forced to close.

Ultimately, the only way I've found to get the process to actually close is to reboot the computer.

I'll run it again today and see if I can capture a log at level 0 to see if there's anything there that might help. (I usually don't run monerod with logging enabled.)

0xFFFC0000 commented 2 months ago

I believe I have encountered this. Though I haven't debugged it to be 100% sure where and why this happens.

I am suspicious of Miniupnpc, but that is just suspicion.