SERVICE_CONTROL_STOP not received
From: howard (anonymous_at_discussions.microsoft.com)
Date: 07/28/04
- Next message: Alex the 1'th: "Re: Best option for 'idle wait'"
- Previous message: Jan Newger: "Re: prevent close dialog in console app"
- Next in thread: Arkady Frenkel: "Re: SERVICE_CONTROL_STOP not received"
- Reply: Arkady Frenkel: "Re: SERVICE_CONTROL_STOP not received"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 28 Jul 2004 14:30:11 -0700
hi folks,
I hope this is the right place to post this daunting
problem.
I created a service, the ServiceMain() will start a socket
server ( TCP ). The socket server is wrapped in a class
from a 3rd party library.
This service is working pretty well on 2k and XP. Once
it's started,it could handle the requests from the client
without any problem. However, if I tried to stop the
service, I get an error message from SCM - "error 1053:
The service did not respond to the start or control
request in a timely fashion".
My first reaction is that the service doesn't finish on
time. But eventually i found that SERVICE_CONTROL_STOP is
not received by the main thread ( which runs main() and
StartServiceCtrlDispatcher() ). Spy++ shows that status of
the main thread is "wait" and the reason is "Executive",
status of the service thread ( which runs ServiceMain() )
is "Wait" and the reason is "User Request" )
I also found out that if the service was started and no
client would send any request to it, it could be stopped
without any problem. Both the main thread and service
thread looked exactly the same in spy++ as they did in
previous test.
The problem turned out to be that main thread didn't
receive SERVICE_CONTROL_STOP at all in certain
circumstances. And it seemed that this is caused by some
problem in the socket server, as everything worked
perfectly if the socket server didn't get any request.
I'm wondering if anyone have seen this, and give me a
hint. What will prevent the main thread from receiving
SERVICE_CONTRL_STOP or other control messages from SCM ?
Is there any work around for this ? How does the SCM send
the SERVICE_CONTROL_xxx command to a service ?
Any input would be greatly appreciated
thanks in advance
howard
- Next message: Alex the 1'th: "Re: Best option for 'idle wait'"
- Previous message: Jan Newger: "Re: prevent close dialog in console app"
- Next in thread: Arkady Frenkel: "Re: SERVICE_CONTROL_STOP not received"
- Reply: Arkady Frenkel: "Re: SERVICE_CONTROL_STOP not received"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|