Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > windows service not starting, may be something to do with static variables

Reply
Thread Tools

windows service not starting, may be something to do with static variables

 
 
keepyourstupidspam@yahoo.co.uk
Guest
Posts: n/a
 
      07-03-2006
Hi,


I have written a service that can start and stop normally using net
start and net stop but when I reboot the machine the serivce does not
restart. The code seems to bomb out on the following line.

m_pFileLogAppender = new FileLogAppender(severity, logFile);


The class FileLogAppender is a singleton, actually it inherites from a
template singleton base class. I am wondering if this is the problem,
the singleton base class implements a static instance variable and
maybe this has not been initialized yet. Could this be the problem, is
there a way that I can ensure that it has been initialized. By using a
pragma maybe.

Am I on the correct path at all.

Your help yould be greatly appreciated this is really hard to debug as
the machine is rebooting.

Thanks,
Enda Mannion

 
Reply With Quote
 
 
 
 
Allan M. Bruce
Guest
Posts: n/a
 
      07-03-2006

<> wrote in message
news: oups.com...
> Hi,
>
>
> I have written a service that can start and stop normally using net
> start and net stop but when I reboot the machine the serivce does not
> restart. The code seems to bomb out on the following line.
>
> m_pFileLogAppender = new FileLogAppender(severity, logFile);
>
>
> The class FileLogAppender is a singleton, actually it inherites from a


If FileLogAppender is a singleton, why are you creating a new instance of
it? A singleton is normally accessed by something like:
FileLogAppender::GetInstance()

This could indeed be your problem depending on the imlpementation of
FileLogAppender
Allan


 
Reply With Quote
 
 
 
 
mlimber
Guest
Posts: n/a
 
      07-03-2006
[cross-posting deleted]

wrote:
> I have written a service that can start and stop normally using net
> start and net stop but when I reboot the machine the serivce does not
> restart. The code seems to bomb out on the following line.
>
> m_pFileLogAppender = new FileLogAppender(severity, logFile);
>
>
> The class FileLogAppender is a singleton, actually it inherites from a
> template singleton base class. I am wondering if this is the problem,
> the singleton base class implements a static instance variable and
> maybe this has not been initialized yet. Could this be the problem, is
> there a way that I can ensure that it has been initialized. By using a
> pragma maybe.
>
> Am I on the correct path at all.
>
> Your help yould be greatly appreciated this is really hard to debug as
> the machine is rebooting.


Windows, net start/stop, services, etc. are off-topic in this newsgroup
(see this FAQ:
http://www.parashift.com/c++-faq-lit....html#faq-5.9), but
you may have an on-topic C++ language question here. Can you reduce the
failure to a *minimal* but *complete* compilable sample that you could
post here for us to inspect? (Compare these code posting tips:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.8.)

Cheers! --M

 
Reply With Quote
 
keepyourstupidspam@yahoo.co.uk
Guest
Posts: n/a
 
      07-04-2006
I have changed my implementation of the singleton class, now I use
::Instance() to return a pointer to the class instance instead of using
new.

But the service is still not starting up on a reboot. My implementation
works fine when I use net start when the machine is already running.

On a reboot the code terminates when I try to reference the singleton.

Anyone have any ideas, is there any pragmas I can use??

Thanks,
Enda



mlimber wrote:
> [cross-posting deleted]
>
> wrote:
> > I have written a service that can start and stop normally using net
> > start and net stop but when I reboot the machine the serivce does not
> > restart. The code seems to bomb out on the following line.
> >
> > m_pFileLogAppender = new FileLogAppender(severity, logFile);
> >
> >
> > The class FileLogAppender is a singleton, actually it inherites from a
> > template singleton base class. I am wondering if this is the problem,
> > the singleton base class implements a static instance variable and
> > maybe this has not been initialized yet. Could this be the problem, is
> > there a way that I can ensure that it has been initialized. By using a
> > pragma maybe.
> >
> > Am I on the correct path at all.
> >
> > Your help yould be greatly appreciated this is really hard to debug as
> > the machine is rebooting.

>
> Windows, net start/stop, services, etc. are off-topic in this newsgroup
> (see this FAQ:
> http://www.parashift.com/c++-faq-lit....html#faq-5.9), but
> you may have an on-topic C++ language question here. Can you reduce the
> failure to a *minimal* but *complete* compilable sample that you could
> post here for us to inspect? (Compare these code posting tips:
> http://www.parashift.com/c++-faq-lit...t.html#faq-5.8.)
>
> Cheers! --M


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Several issues that may or may not be connected kingchuffalo ASP .Net 0 09-21-2008 07:08 PM
First P&S that may "may" not be a piece of crap? Rich Digital Photography 31 08-07-2008 04:25 AM
Beginner's Networking Query - this may or may not be a problem slaterino@googlemail.com Cisco 1 03-25-2007 05:34 AM
How to optionally use classes that may or may not be installed ? Sam Iam Java 0 01-31-2004 04:09 AM
how may in hell may i take advantage of a IF statement in two separate functions? like quit anytime with button Q Rahmi Acar C++ 5 07-28-2003 08:14 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57