Bug 768 - Unbound Service Sometimes Can Not Shutdown Completely, WER Report Shown Up
Unbound Service Sometimes Can Not Shutdown Completely, WER Report Shown Up
Status: RESOLVED FIXED
Product: unbound
Classification: Unclassified
Component: server
1.5.8
x86_64 Windows
: P5 critical
Assigned To: unbound team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-05-22 09:04 CEST by rudyy_id
Modified: 2016-05-27 15:51 CEST (History)
2 users (show)

See Also:


Attachments
No Error (172.90 KB, text/plain)
2016-05-25 10:27 CEST, rudyy_id
Details
Error (845.87 KB, text/plain)
2016-05-25 10:31 CEST, rudyy_id
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rudyy_id 2016-05-22 09:04:41 CEST
I don't know what exactly cause this issue. No Report from unbound, even with verbosity level 5. The WER Report wouldn't shown up since i'm disabling it.

This is not always happen. It just sometime ok, sometime its not.

With Unbound-Control stop command, Unbound Service wouldn't shutdown, instead the service restart itself (i see that in unbound log).

With SC Windows command, the Unbound Service stop with WER Report shown up.

I tried clean Unbound cache / prefetch, then stop with Unbound-Control and then stop with SC Windows command, the unbound service wouldn't shutdown completely (WER Report shown up).

I don't know the issue came because I sign unbound binaries with my own certificate (its weird actually, if that sign thing cause the issue it means I can not tamper unbound binaries, right or?).

One more thing, I run unbound with 4 thread, all slab 4, message and memory default.
Comment 1 rudyy_id 2016-05-22 13:42:35 CEST
When I look closely, looks like ASLR and DEP had been disable for Unbound Service (Unbound.exe). Hmmm... maybe this is the problem?
Comment 2 Wouter Wijngaards 2016-05-23 09:03:16 CEST
Hi rudyy,

I think windows services framework is restarting the daemon when it stops, because it is set to auto-restart failed services.  And it thinks it failed when you stop it?  Somehow notify the windows services framework.

Best regards, Wouter
Comment 3 rudyy_id 2016-05-23 14:13:31 CEST
"I think windows services framework is restarting the daemon when it stops, because it is set to auto-restart failed services."





No, I don't think thats the problem. Its because I'm already set unbound daemon/service failure action into "no action", but the WER still shown up (unbound daemon/service hang until i close WER faulty report). And, I'm stoping unbound daemon/service with sc (its built in service control program from windows) not with unbound-control.
For reference, I'm using windows 7 x64 and dns64 module turn on.




Anyway, I had some suggestion and a question:
1. With unbound capable doing multithread and handle large amount memory for its cache, why not build unbound binaries with backward compability at least windows nt 5 and compile with dynamicbase (aslr) and nxcompat (dep) turn on?
2. If all unbound binaries always use openssl crypto (5 binaries, i think), why not build unbound with separate openssl library (dynamically)?
Comment 4 Wouter Wijngaards 2016-05-23 14:17:49 CEST
Hi Rudyy,

I don't know how to do 1.

For 2., I did not want dll search path problems.  But you could compile yourself to get this.

For the main bug: I do not know what the problem is, unbound with high verbosity should log what it is doing, also when exiting.  So I don't know what is going on.  Is there a long-running unbound-control connection active?  That might delay shutdown?  Just killing unbound is fine, by the way, it does not actually have to do stuff apart from closing sockets and exiting.

Best regards, Wouter
Comment 5 rudyy_id 2016-05-23 14:45:06 CEST
> For the main bug: I do not know what the problem is, unbound with high
> verbosity should log what it is doing, also when exiting.  So I don't know
> what is going on.  Is there a long-running unbound-control connection
> active?  That might delay shutdown?  Just killing unbound is fine, by the
> way, it does not actually have to do stuff apart from closing sockets and
> exiting.
> 


unbound log? Normal as it is. Except if I stop unbound with unbound-control, there is unbound init again (like unbound starting for the first time). And also when the WER faulty shown up, unbound shutdown sequence didn't write in the log, not until I kill/close WER faulty report. It means unbound shutdown sequence write in the log only after I kill/close WER faulty report.
I think I'll upload my unbound log later to show you complete log.

Is there a long-running unbound-control connection active? No, event with control-enable: no, this think still happen.

delay shutdown? No, event my antivirus not active.

I'm also confusing. That WER faulty report make my brain fried.
Comment 6 rudyy_id 2016-05-23 14:51:06 CEST
I'll upload everything tomorrow.
Comment 7 rudyy_id 2016-05-25 10:27:01 CEST
Created attachment 330 [details]
No Error

Sorry a bit late.

This is a log with unbound successfully shutdown with sc.
Verbosity level 5.
Comment 8 rudyy_id 2016-05-25 10:31:23 CEST
Created attachment 331 [details]
Error

This is a log with unbound failed to shutdown with sc.
WER faulty shown up.
Verbosity level 5.
Comment 9 Wouter Wijngaards 2016-05-27 15:51:29 CEST
Hi Rudyy,

I found an error where unbound attempts to close a WSAEvent after WSA has been stopped, in the exit sequence.  Thank you for the logs.  I hope this is the failure you have; it is certainly good to fix.

If the failure persists; reopen the bugreport.

Best regards, Wouter