Adding the specified count to the semaphore would cause it to exceed its maximum count

Hi,

Configuration:
Octopus 3.14.159
Tentacle version 3.14.159
Calamari: 3.7.83

Recently after update from version 3.11 I’m receiving errors while trying to deploy several applications at once to the same target.
The are all failing while trying to verify or update IIS application properties (App Pool, Physical Path , etc.)

The errors log:
Executing feature-class 'Calamari.Deployment.Features.IisWebSiteBeforeDeployFeature’
June 29th 2017 11:14:44Verbose
Creating ‘E:\Websites\Focus\Dev\Services\Policy\FulfilmentBrokerService\Octopus.Features.IISWebSite_BeforePostDeploy.ps1’ from embedded resource
June 29th 2017 11:14:44Verbose
Executing 'E:\Websites\Focus\Dev\Services\Policy\FulfilmentBrokerService\Octopus.Features.IISWebSite_BeforePostDeploy.ps1’
June 29th 2017 11:14:59Verbose
Name Value
June 29th 2017 11:14:59Verbose


June 29th 2017 11:14:59Verbose
PSVersion 4.0
June 29th 2017 11:14:59Verbose
WSManStackVersion 3.0
June 29th 2017 11:14:59Verbose
SerializationVersion 1.1.0.1
June 29th 2017 11:14:59Verbose
CLRVersion 4.0.30319.42000
June 29th 2017 11:14:59Verbose
BuildVersion 6.3.9600.17400
June 29th 2017 11:14:59Verbose
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
June 29th 2017 11:14:59Verbose
PSRemotingProtocolVersion 2.2
June 29th 2017 11:15:04Verbose
PowerShell Environment Information:
June 29th 2017 11:15:04Verbose
OperatingSystem: Microsoft Windows NT 6.3.9600.0
June 29th 2017 11:15:04Verbose
OsBitVersion: x64
June 29th 2017 11:15:04Verbose
Is64BitProcess: True
June 29th 2017 11:15:04Verbose
CurrentUser: NT AUTHORITY\SYSTEM
June 29th 2017 11:15:04Verbose
MachineName: GSY-SVR-APP2
June 29th 2017 11:15:04Verbose
ProcessorCount: 4
June 29th 2017 11:15:04Verbose
CurrentDirectory: E:\Websites\Focus\Dev\Services\Policy\FulfilmentBrokerService
June 29th 2017 11:15:04Verbose
CurrentLocation: E:\Websites\Focus\Dev\Services\Policy\FulfilmentBrokerService
June 29th 2017 11:15:04Verbose
TempDirectory: C:\Windows\TEMP
June 29th 2017 11:15:04Verbose
HostProcessName: powershell
June 29th 2017 11:15:04Verbose
TotalPhysicalMemory: 16774180 KB
June 29th 2017 11:15:04Verbose
AvailablePhysicalMemory: 4510668 KB
June 29th 2017 11:15:14Info
Making sure a Web Application “/Dev/Services/Policy/FulfilmentBrokerService” is configured as a child of “Default Web Site” at “E:\Websites\Focus\Dev\Services\Policy\FulfilmentBrokerService”…
June 29th 2017 11:15:14Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 1 of 25. Please wait…
June 29th 2017 11:15:19Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 2 of 25. Please wait…
June 29th 2017 11:15:24Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 3 of 25. Please wait…
June 29th 2017 11:15:29Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 4 of 25. Please wait…
June 29th 2017 11:15:34Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 5 of 25. Please wait…
June 29th 2017 11:15:39Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 6 of 25. Please wait…
June 29th 2017 11:15:44Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 7 of 25. Please wait…
June 29th 2017 11:15:49Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 8 of 25. Please wait…
June 29th 2017 11:15:54Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 9 of 25. Please wait…
June 29th 2017 11:15:59Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 10 of 25. Please wait…
June 29th 2017 11:16:04Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 11 of 25. Please wait…
June 29th 2017 11:16:09Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 12 of 25. Please wait…
June 29th 2017 11:16:14Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 13 of 25. Please wait…
June 29th 2017 11:16:19Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 14 of 25. Please wait…
June 29th 2017 11:16:24Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 15 of 25. Please wait…
June 29th 2017 11:16:29Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 16 of 25. Please wait…
June 29th 2017 11:16:34Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 17 of 25. Please wait…
June 29th 2017 11:16:39Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 18 of 25. Please wait…
June 29th 2017 11:16:44Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 19 of 25. Please wait…
June 29th 2017 11:16:49Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 20 of 25. Please wait…
June 29th 2017 11:16:54Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 21 of 25. Please wait…
June 29th 2017 11:16:59Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 22 of 25. Please wait…
June 29th 2017 11:17:09Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 23 of 25. Please wait…
June 29th 2017 11:17:14Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 24 of 25. Please wait…
June 29th 2017 11:17:19Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 25 of 25. Please wait…
June 29th 2017 11:17:24Verbose
Possible case of semaphore Global\Octopus-IIS-Metabase having not been released by a terminated/failed process, attempting to take control
June 29th 2017 11:17:24Verbose
Forcing semaphore release, the result was (it should be zero): 0
June 29th 2017 11:17:24Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 1 of 25. Please wait…
June 29th 2017 11:17:29Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 2 of 25. Please wait…
June 29th 2017 11:17:34Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 3 of 25. Please wait…
June 29th 2017 11:17:39Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 4 of 25. Please wait…
June 29th 2017 11:17:44Verbose
Cannot start this IIS website related task yet. There is already another task running that cannot be run in conjunction with any other task. Attempt 5 of 25. Please wait…
June 29th 2017 11:17:49Verbose
Acquired SemaphoreInstance Global\Octopus-IIS-Metabase
June 29th 2017 11:17:49Verbose
Looking for the parent Site “Default Web Site” at “IIS:\Sites\Default Web Site”…
June 29th 2017 11:17:49Error
Exception calling “Release” with “0” argument(s): "Adding the specified count
June 29th 2017 11:17:49Error
to the semaphore would cause it to exceed its maximum count."
June 29th 2017 11:17:49Error
At E:\Websites\Focus\Dev\Services\Policy\FulfilmentBrokerService\Octopus.Featur
June 29th 2017 11:17:49Error
es.IISWebSite_BeforePostDeploy.ps1:172 char:4
June 29th 2017 11:17:49Error

  •         $result = $SemaphoreInstance.Release()
    

June 29th 2017 11:17:49Error

  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

June 29th 2017 11:17:49Error
+ CategoryInfo : NotSpecified: (:slight_smile: [], ParentContainsErrorRecordE
June 29th 2017 11:17:49Error
xception
June 29th 2017 11:17:49Error
+ FullyQualifiedErrorId : SemaphoreFullException
June 29th 2017 11:17:49Error
June 29th 2017 11:17:49Verbose
Deleting 'E:\Websites\Focus\Dev\Services\Policy\FulfilmentBrokerService\Octopus.Features.IISWebSite_BeforePostDeploy.ps1’
June 29th 2017 11:17:49Error
Script ‘E:\Websites\Focus\Dev\Services\Policy\FulfilmentBrokerService\Octopus.Features.IISWebSite_BeforePostDeploy.ps1’ returned non-zero exit code: 1

Please help

This error happened with me too deploying mutiple applications in the same target:

Exception calling “Release” with “0” argument(s): “Adding the specified count to the semaphore would cause it to exceed its maximum count.”

It happened only after an upgrade to version 3.17.4.

Hi Tiago,

Thanks for reporting. I’ve created an issue you can track and contribute to: https://github.com/OctopusDeploy/Issues/issues/3851

Cheers,
Shane