CodeTwo Base.title

How to extend the timeout for services if they do fail to start or stop

Problem:

CodeTwo services either do not start or do not stop.

Solution:

In some environments the services may require more time to start or stop. Click below on the problem you want to solve:

CodeTwo service is unable to start on its own and times out.

228-0
Fig. 1. The service does not start and times out.

To avoid such problems, you can set an option to delay the automatic start of a service. The service with such configuration will attempt to start only if critical services already started. In order to configure your service this way, please follow steps described below:

  1. Run services.msc
  2. Right-click on service you would like to configure
  3. Select Properties from the context menu
  4. On the General tab switch the Startup type to Automatic (Delayed Start)

228-2
Fig. 2. Changed value of properties.

Additionally, you can extend the timeout value for the service startup in the Windows registry:

  1. In Registry Editor, locate, and then right-click the following registry subkey:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
  2. Point to New, and then click DWORD Value.
  3. In the right pane of Registry Editor a new value named New Value #1 will appear.
  4. Type ServicesPipeTimeout to replace New Value #1, and then press ENTER.
  5. Right-click the ServicesPipeTimeout registry entry that you created in step 3, and then click Modify.The Edit DWORD Value dialog box will appear.
  6. Change Base to Decimal.
  7. In the Value data text box, type <TimeoutPeriod>, where TimeoutPeriod is the amount of time allowed for service to start (in milliseconds), and then click OK.
  8. Finally, restart the machine.

In our test environment the value was set to 240.000ms which is 4 minutes and this rendered the service to start correctly. It is permissible to set to a higher value - it should not have any impact on performance.

CodeTwo service hangs on stopping.

If the problem occurred for the first time and you cannot close the service from within Windows Services Menu (services.msc) or Task Manager you can kill the service using sc tool. Please see this Knowledge Base article for details.

If the problem occurs often follow the steps below to extend the service closing timeout:

  1. In Registry Editor, locate, and then right-click the following registry subkey:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
  2. Point to New, and then click DWORD Value.
  3. In the right pane of Registry Editor a new value named New Value #1 will appear.
  4. Type WaitToKillServiceTimeout to replace New Value #1, and then press ENTER.
  5. Right-click the WaitToKillServiceTimeout registry entry that you created in step 3, and then click Modify.The Edit DWORD Value dialog box will appear.
  6. Change Base to Decimal.
  7. In the Value data text box, type <TimeoutPeriod>, where TimeoutPeriod is the amount of time allowed for service to stop (in milliseconds), and then click OK.
  8. Finally, restart the machine.

As per this MS KB article, by default Windows waits 20.000ms so you need to increase this value.

See also:

Our Clients:
Unicef
Facebook
Shell
T-Systems
Loreal
Casio
UPS Israel
Oford University
Mitsubishi Motors
Toshiba TEC UK Imaging Systems Ltd
Illinois Institute of Technology
MAN Diesel
McDonalds India
Skoda Auto
Bank of Israel
Fujifilm
China Mobile
Santander
Samsung SDI
Skanska
Generali
Telmex
Toyota Tsusho
BECHTEL
Ricoh
BAE SYSTEMS
Federação Portuguesa de Futebol
Credit Agricole
HYUNDAI
Rothschild
Toyota Boshoku
Oriflame Romania
ING
Ikea
Nordea

Partners, certificates & awards