Windows Azure Role recycling due to setting more than 256 character in Environmental Variable through Azure Start-up task.


Couple weeks before, while investigation an issue related to Windows Azure Role recycling, I found that issue was caused due to setting the environmental variable with more than 256 character from a start-up task.

I am also coming from a development background, and I am pretty much aware that, in lot of scenarios developer audience leverage Windows  Environmental variable to set as a global value, So possible more and more Azure Developers may get into this issue, so I thought of blog about the complete investigation details here :

 

SYMPTOM

After deploying the Web/Worker Role, you will notice below error message from  windows Azure portal :

“Role has encountered an error and has stopped. Application startup task failed with exit code -532462766”

 

HOW TO DETERMINE THE ISSUE IS DUE TO SETTING THE ENVIRONMENTAL VARIABLE WITH MORE THAN 256 CHARACTER

Check the WaHostBootstrapper.log file, which located under C:\Resources\Directory\<roleinstance name>.DiagnosticStore directory, and you can find below entry towards bottom of the WaHostBootsrapper.log.

<snip>

[00003372:00001896, 2013/05/18, 05:52:14.906, 00100000] <- WapGetEnvironmentVariable=0x800700cb
[00003372:00001896, 2013/05/18, 05:52:15.250, 00040000] Executing Startup Task type=0 cmd=”E:\approot\bin\..\Monitoring\EventRegister\register.engine.manifests.cmd” > registerLog.txt 2> registerErr.txt
[00003372:00001896, 2013/05/18, 05:52:15.250, 00040000] Executing “E:\approot\bin\..\Monitoring\EventRegister\register.engine.manifests.cmd” > registerLog.txt 2> registerErr.txt.
[00003372:00001896, 2013/05/18, 05:52:16.641, 00040000] Program “E:\approot\bin\..\Monitoring\EventRegister\register.engine.manifests.cmd” > registerLog.txt 2> registerErr.txt exited with 0. Working Directory = E:\approot\bin
[00003372:00001896, 2013/05/18, 05:52:16.641, 00100000] <- WapGetEnvironmentVariable=0x800700cb
[00003372:00001896, 2013/05/18, 05:52:17.000, 00040000] Executing Startup Task type=0 cmd=”E:\approot\bin\..\Initialization\RoleInit.cmd” >> ..\Initialization\RoleInit.cmd.log 2>> ..\Initialization\RoleInit.cmd.err
[00003372:00001896, 2013/05/18, 05:52:17.000, 00040000] Executing “E:\approot\bin\..\Initialization\RoleInit.cmd” >> ..\Initialization\RoleInit.cmd.log 2>> ..\Initialization\RoleInit.cmd.err.
[00003372:00001896, 2013/05/18, 05:52:25.328, 00040000] Program “E:\approot\bin\..\Initialization\RoleInit.cmd” >> ..\Initialization\RoleInit.cmd.log 2>> ..\Initialization\RoleInit.cmd.err exited with 0. Working Directory = E:\approot\bin
[00003372:00001896, 2013/05/18, 05:52:25.891, 00100000] <- WapUpdateEnvironmentVariable=0x8007006f
[00003372:00001896, 2013/05/18, 05:52:26.234, 00100000] <- WapUpdateEnvironmentVariables=0x8007006f
[00003372:00001896, 2013/05/18, 05:52:26.609, 00100000] <- WapModifyEnvironment=0x8007006f
[00003372:00001896, 2013/05/18, 05:52:26.984, 00100000] <- WapDoStartup=0x8007006f
[00003372:00001896, 2013/05/18, 05:52:27.328, 00100000] <- DoStartup=0x8007006f
[00003372:00001896, 2013/05/18, 05:52:27.672, 00100000] <- wmain=0x8007006f

</snip> 

HOW TO REPRODUCE THIS BEHAVIOR

Create a simple Windows Azure project, Web/Worker Role, and add below entry in the Windows Azure definition file [.csdef] :

 

<snip>

<Startup> 
<Task commandLine=”Startup.cmd” taskType=”simple” executionContext =”elevated”> 
   < Environment> 
     < Variable name =”TEST_VARIABLE”    value  = ”<<add some character with more than 256 character ”/> 
    < /Environment> 
  < /Task>
< /Startup>

<snip>

 

WORKAROUND

The available workaround for this issue at present is, you need to restrict the number of character added to the  environment variable from Windows Azure Startup task. Having said that, the fix for character limitation on environment variable has been identified by the Microsoft Product Group, and will be addressed in the upcoming releases.

Comments (0)

Skip to main content