none
Size of startTask cannot be greater than 32768 characters while allocating pool in azure batch RRS feed

  • Question

  • Error while creating azure batch : Microsoft.Azure.Batch.Common.BatchException: Operation returned an invalid status code 'BadRequest' ---> Microsoft.Azure.Batch.Protocol.Models.BatchErrorException: Operation returned an invalid status code 'BadRequest'
       at Microsoft.Azure.Batch.Protocol.PoolOperations.<AddWithHttpMessagesAsync>d__7.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
       at Microsoft.Azure.Batch.Protocol.BatchRequestBase`2.<ExecuteRequestWithCancellationAsync>d__43.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
       at Microsoft.Azure.Batch.Protocol.BatchRequestBase`2.<ExecuteRequestAsync>d__40.MoveNext()
       --- End of inner exception stack trace ---
       at Microsoft.Azure.Batch.Protocol.BatchRequestBase`2.<ExecuteRequestAsync>d__40.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
       at Microsoft.Azure.Batch.ProtocolLayer.<ProcessAndExecuteBatchRequest>d__82`1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
       at Microsoft.Azure.Batch.CloudPool.<CommitAsync>d__2.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.GetResult()

    Request Information
    ClientRequestId:
    RequestId:79ff5db6-bc5c-4877-8806-b64bb5280147
    HttpStatusCode:BadRequest
    StatusMessage:The value provided for one of the property in the request body is
    invalid.


    Error Code = InvalidPropertyValue, Lang=en-US, Message = The value provided for
    one of the property in the request body is invalid.
    RequestId:79ff5db6-bc5c-4877-8806-b64bb5280147
    Time:2016-09-08T10:17:29.9104697Z
    Additional Values:
    Error Details key=PropertyName value=startTask
    Error Details key=Reason value=Total size of startTask cannot be more than 32768
     characters

    Please help me understand the reason behind this error. The finding we have is, we have some .xml & .xslt files in the build folder. When we remove some of them it works. e.g. there are 16 files but If it works only till I keep 6 of them (xslt files). That is too after removing .xml files.

    Thanks

    Vishal 


    • Edited by VishalBold Thursday, September 8, 2016 10:22 AM
    Thursday, September 8, 2016 10:22 AM

Answers

  • Hi Vishal,

    The error is saying that there is a maximum size (in bytes) of the serialized StartTask property. Of course, it's not immediately obvious what the size (in bytes) of that property is without serializing it, but what the error really means is that your StartTask is too big.

    The most common cause of this (which also happens to CloudTask as well) is that you have a very large number of resource files (note when I say large number here I mean 50+ files, not 1-2 files that are very large in size) or a very large number of environment settings (or a combination of the two).

    If you have a large number of ResourceFiles one trick you can use is to zip them up ahead of time and then unzip them at the start of the commandline for your start task, so your resulting task would look something like:

    StartTask:

        ResourceFiles: [myzip.zip]

        CommandLine: "unzip myzip.zip & myexecutable.exe"

    Hope this helps -- let me know if you have any more questions about the above or possible workarounds from this limitation.

    Thanks,

    -Matt

    Thursday, September 8, 2016 4:46 PM
    Owner

All replies

  • Hi Vishal,

    The error is saying that there is a maximum size (in bytes) of the serialized StartTask property. Of course, it's not immediately obvious what the size (in bytes) of that property is without serializing it, but what the error really means is that your StartTask is too big.

    The most common cause of this (which also happens to CloudTask as well) is that you have a very large number of resource files (note when I say large number here I mean 50+ files, not 1-2 files that are very large in size) or a very large number of environment settings (or a combination of the two).

    If you have a large number of ResourceFiles one trick you can use is to zip them up ahead of time and then unzip them at the start of the commandline for your start task, so your resulting task would look something like:

    StartTask:

        ResourceFiles: [myzip.zip]

        CommandLine: "unzip myzip.zip & myexecutable.exe"

    Hope this helps -- let me know if you have any more questions about the above or possible workarounds from this limitation.

    Thanks,

    -Matt

    Thursday, September 8, 2016 4:46 PM
    Owner
  • Above command not working. it is showing inflating myexecutable.exe in str.out file but not running this.

    Pravesh, Azure developer

    Friday, July 12, 2019 6:49 AM