TurboFloat locks license upon server reboot (how to release a lease before a system shutdown / restart)Answered

Our software consist of a service and when it runs on the same machine as the TurboFloat service it works.
When I reboot the license is not freed at shutdown and thus no longer available on startup.

If in a working situation our service is restarted I see that the license is released and obtained again in the tfs-log.

At reboot the license is not released, so my hypothesis is that the TurboFloat service is stopped by windows before our service has a chance to release the license.

How do I make sure that my service exits and releases it license before the TurboFloat service halts?

I'm looking for a solution in which a user/admin can just reboot the server from windows without worrying about services. Any suggestions?

How is this gonna work?

The current case:

  • Windows is being shutdown by the user
  • Windows shutsdown the turbofloat service
    • Turbofloat service stores leased license to disk
  • My service shutsdown
    • Tries to release the license but the turbofloat service is not there anymore
  • System reboots
  • Turbofloat service starts and loads leased license from disk
  • My service starts and tries to get a license but fails (no seats left)

The API I linked to shows you how to slow down the shutdown / restart process so you have time to release the lease (TF_DropLease() ).

But at the moment my service notices that the system is shutting down it can delay whatever, but the TurboFloat service is already stopped. 

When the turbo float service was stopped it had stored its active leases. There is no way to drop it at that point. After the reboot it will reload that lease (which does not make sense?) and wait till it times out.

Basically I want a way to (guaranteed) delay the stopping of the TurboFloat service by windows till after my service has been stopped. How do I accomplish/configure that?

Don't install your app and the TFS instance on the same machine. Sure, you *can* do that, but why (besides dev testing)?

Just use activations in that case (TurboActivate).

Because most clients use or want to use virtual machines and we anticipated on the hosted TurboFloat instances being available soon to avoid licensing directly on the virtual machines altogether. Integrating TurboActivate at this point means a lot of work at our end which I would like to avoid. 

But please, is there a valid solution to the problem?

Why does the TurboFloat server reload licenses from the previous session? I would expect them to expire as soon as connection is lost

I can imagine a few dirty tricks (like reactivating the license from te command line when my service starts) but figuring that I'm not the first one to encounter this, is there a neat solution?

Tried it and it makes it guaranteed that the TurboFloat service is started before mine. However this still is not working at shutdown apparently… Any further suggestions?

Honestly, I don't know this stuff off the top of my head. I just google MSDN with something like “windows service dependencies shutdown” and get:

To set the shutdown order of services manually, create a multistring registry value that contains the service names in the order in which they should be shut down and assign it to the Control key's PreshutdownOrder value, as follows:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\PreshutdownOrder="Shutdown Order"

To set the shutdown order of dependent services from your application, use the SetProcessShutdownParameters function. The SCM uses this function to give its handler 0x1E0 priority. The SCM sends SERVICE_CONTROL_SHUTDOWN notifications when its control handler is called and waits for the services to exit before returning from its control handler.