Service stop failes with Error 109 pipe has been ended on Windows 2008 R2


  • My product installs around 5 services out of which 2 services don't stop normally rest stops normally. Service stop is being done manually using service manager stop user interface. Error message thrown by Service Manager is "Error 109 Pipe has been ended" and when i look at event log I can see APPCRASH event. This behavior is occurring only  on Windows 2008 R2. These 2 failing services have socket communication code through ACE library. When I debugged my code I can see whole of my code gets executed from start to the end point but call never returns from StartServiceCtrlDispatcher() function which is a system call. Application crashes when control is inside this function.


    SERVICE_TABLE_ENTRY    DispatchTable[] =
            { service_name_, &base_controller::class_main_static},
            { NULL, NULL }
        /* Attempt to start service */
        if (StartServiceCtrlDispatcher(DispatchTable) == 0)

    I mean to say that base_controller::class_main_static() executes successfully.

    Following Error is displayed and logged in application log when MYSERVICE is 
    stopped from service panel
    "Windows could not stop the MYSERVICE service on local computer
    Error 109: The pipe has been ended "

    Event log shows :

    Faulting application name: MYSERVICE.exe, version:, time stamp:
    Faulting module name: MYSERVICE.exe, version:, time stamp: 0x4d8ac2df
    Exception code: 0xc0000005
    Fault offset: 0x0000000000005b8b
    Faulting process id: 0xf1c
    Faulting application start time: 0x01cbf56f668b73c2
    Faulting application path: C:\Program Files\Scanner\Bin\MYSERVICE.exe
    Faulting module path: C:\Program Files\Scanner\Bin\MYSERVICE.exe
    Report Id: 0161024a-6163-11e0-b4d7-000c29beb70f



    Came across this article while searching for solution This article is about terminal service
    so it can't solve this problem but surely provides some clue about win2008 r2
    and ACE lib combination.
    Tuesday, April 19, 2011 2:59 PM