Turbofloat reuse handle

Hello Wyatt,

This is a question regarding turbofloat.

Consider this scenario. Our app which has an active turbo float lease crashes. That means we cannot call the TF_Droplease()/TF_Cleanup() on it before it exits.

The API document says that in such a case the lease becomes a zombie and therefore the user has to wait until the server frees up the lease after the specified "Lease" length time in the config.

My question is can we somehow reuse the handle value (i.e uint32) returned by TF_GetHandle in the previous instance of the app so that we can get the access back to the lease and continue running the app normally during the next run?

Any help would be invaluable.

Thanks!

The handle is not useful outside the context of a running process. You can't magically recover a license lease with a handle.

On real machines this is not a problem. Simply request the lease again and you'll get the same lease from the TFS (it won't use another lease slot).

On fake machines (VMs, containers, etc.) if your app crashes before dropping the lease then there's no way to recover that "lease slot" until the lease expires. Hence following 2 pieces of advice:

1. Use short lease lengths. 30 minutes is the default, and it's a good one.

2. In your app have a crash handler that drops the lease. In other words, have a global "try/catch" block that has 1 job: dropping the lease and continuing to crash your app.

Can you explain why 30 mins is a good lease time and why you are considering it to be "short"?As far as I can see, this means 15 mins downtime on average for crashes.

For license leases reasonably short (around the 30-minute mark) is good. Why? Because to address reasons like this: unstable apps and unstable machines "letting go" of a license lease without ever "Dropping" it explicitly.

My question was why do you consider 30 mins to be short? Even for stable apps I don't want to prevent the app from obtaining a license for 15 mins on average, even if occasionally. I would think that 5 mins is reasonable, but not 30.

Well, each lease length (short and longer) has advantages and disadvantages. 30 minutes is a good middle ground. But its up to you.