On Mon, Oct 20, 2014 at 04:07:09PM -0400, Andrew Piskorski wrote:

> Nothing at all gets written to the log file, so I'm not sure how to
> debug this.  But presumably that means something is dying very early,
> perhaps in NsConnectService()?

Briefly, I managed to the nsd Windows Service to start under the
WinDbg debugger.  There, it clearly emits a few ns_log lines I have in
my config file, and then says:

  Fatal: nsmain: no such server 'w7-1-prod'

But, that is the correct server name from my config file, and it works
fine when I'm not running as a Windows Service!  I'm confused, what
could cause it to fail ONLY when running as a Windows Service?

Additional gory detail:

After much googling, I found and followed the (rather tedious)
instructions in both of these pages:

  http://support.microsoft.com/kb/824344
  
http://ww2.ntrglobal.com/support/why-do-i-get-error-message-regarding-interactive-services

That let me attach the WinDbg debugger to the Service.  The key bits
to set that up were:

- Run "C:\Program Files\Debugging Tools for Windows (x64)\gflags.exe",
  configure "nsd.exe" to use this debugger:
  "C:\Program Files\Debugging Tools for Windows (x64)\windbg.exe" 

- Run regedit, and increase the millisecond counter for
  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ServicesPipeTimeout
  to an hour or so.

- In Services, for my NaviServer service, under Log On, Local System
  account, TURN ON the "Allow service to interact with desktop" check box.

- Reboot Windows.

- Manually start up the "Interactive Service Detection" service BEFORE
  trying to start the NaviServer service.

With that, when I start the service an icon starts blinking on the
bottom Windows tool bar.  Clicking on it pops up a special dialog box,
"Interactive Services Detection", and clicking "View the Message" then
takes me to a weird separate Windows desktop (under a different user,
but no icons or start menu).

There the nsd.exe service is running under WinDbg, and this is the
only place I ever see the "Fatal: nsmain: no such server" message.

After the "no such server" message prints out, it seems nsd.exe has
already exited, because the backtrace in WinDbg says I am in function:
  wow64cpu!TurboDispatchJumpAddressEnd
Which ultimately was called by:
  ntdll!LdrInitializeThunk 

If I set a breakpoint on Ns_Fatal or Ns_SetFind, I can get it to stop
with actual Naviserver code on the stack.  WinDbg's "~" (threads) and
"|" (process) commands show 5 threads, only the first one of which
seems to be doing much of anything.

Oddly, the Ns_Main function does NOT appear on the stack trace, only
main, which can't be correct because the only thing main does is call
Ns_Main.  I can't seem to get WinDbg to examine most of the
interesting Ns_Main or NsConnectService code.  Possibly because:

  "Stack unwind information not available. Following frames may be wrong."

That I don't understand, because I compiled with /Zi "complete
debugging information", and have all the *.pdb files in my lib
directory, d which I put onto WinDbg's symbol path and told it to
"reload".

Odlly, WinDbg knows the correct line number for "nsd!main" in
nsd/main.c, but claims it does not have any symbol info for
Ns_SetFind.  I can get it to stop at a Ns_SetFind breakpoint, but
can't seem to see anything of use.

-- 
Andrew Piskorski <a...@piskorski.com>

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to