Re: [naviserver-devel] Windows Service startup fails

2014-10-21 Thread Andrew Piskorski
On Tue, Oct 21, 2014 at 03:22:59PM -0400, Andrew Piskorski wrote:

> return Ns_Main(argc, argv, ServerInit); 
> 
> But where does that ServerInit thing come from?  And why is it NULL
> when running as a Windows Service, but ok when Naviserver is started
> interactively?

Ah, I see:  ServiceMain() explicitly passes in a NULL initProc:

  Ns_Main((int)argc, argv, NULL);

So, is it supposed to be passing in something else, or is it ok for
that to be NULL and the assertion is inappropriate in this case?
Where are these initProc pointers supposed to come from?  Are we
missing a call to NsRegisterServerInit() somewhere?

Is there a document somewhere explaining the design of Naviserver's
virtual servers, what they're for and how the code underneath sets
them up?  Maybe in an older email?

So far I found this thread, which gives some hints but not a full
explanation:

  
http://www.mail-archive.com/naviserver-devel%40lists.sourceforge.net/msg01707.html
  Re: [naviserver-devel] Explanation of last changes
  Vlad Seryakov Thu, 07 Sep 2006 12:38:46 -0700

-- 
Andrew Piskorski 

--
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


Re: [naviserver-devel] Windows Service startup fails

2014-10-21 Thread Andrew Piskorski
On Mon, Oct 20, 2014 at 10:12:47PM -0400, Andrew Piskorski wrote:

>   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?

Ok, after further debugging, that particular problem was my fault, but
there are others.

In my config file, I decide whether to set up the "dev" or "prod"
server based on a regexp of the full path of the config file (from
"ns_info config").  And that path now has backslashes, not the
forward slashes expected by my regexp (which worked in the past).

So likely I installed this Naviserver service with a command line
using backslashes, while for AOLserver I used forward slashes.
Whatever, clearly that was a bug in my config file, it needs to be
robust to that sort of thing.

Now with that fixed, the service startup gets farther, and instead
fails in NsInitServer with:

  Assertion failed!
  File: server.c
  Line: 220
  Expression:  initProc != NULL

That confuses me.  because NsInitServer is only called from two
places, both of them right next to each other in Ns_Main.  So that
assertion must mean that the initProc being passed into Ns_Main is
NULL, which is only called from main, like so:

return Ns_Main(argc, argv, ServerInit); 

But where does that ServerInit thing come from?  And why is it NULL
when running as a Windows Service, but ok when Naviserver is started
interactively?

-- 
Andrew Piskorski 

--
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