SERVICE_CONTROL_STOP not received

From: howard (anonymous_at_discussions.microsoft.com)
Date: 07/28/04


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



Relevant Pages

  • Re: IPC looking for simple/best way to communicate
    ... want to go to a server/client connection. ... Server accepts connections on given port. ... request or a request with a removal. ... >> one process reads a socket it removes the message from the socket and ...
    (comp.lang.perl.misc)
  • IE6 bug: doesnt resend form-data when server resets connection
    ... When the server closes the connection on a socket where IE is currently ... sends the request on an existing socket and the server immediately replies ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: TCP reset caused by socket.py
    ... seems that all POST requests to Trac's standalone server have ... chance the server will issue a TCP RST. ... A RST when you close a socket is OK. ... handling each request on its own thread. ...
    (comp.lang.python)
  • Re: HowTo, Download first 1024 bytes of file ONLY?
    ... (most of which was stolen from a Microsoft C# socket example) ... string server = SERVER_NAME; ... // Send request to the server. ... after 3-full days of performing errant google searches). ...
    (microsoft.public.dotnet.framework)
  • [REVS] NTLM HTTP Authentication is Insecure By Design
    ... in front of a web server, and that proxy server shares a single TCP ... These are attacks that make use of non-RFC HTTP requests (HTTP Request ... the authentication is associated with the ...
    (Securiteam)