Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem on extension of custom script #12

Closed
juilin opened this issue Jan 27, 2015 · 13 comments
Closed

Problem on extension of custom script #12

juilin opened this issue Jan 27, 2015 · 13 comments
Assignees

Comments

@juilin
Copy link

juilin commented Jan 27, 2015

mrseq is created before the execution of custom script extension. If VM fails to download the script, the custom script will not be executed since mrseq is created and has sequence number 0. Please refer to the logs.

2015/01/27 05:50:33 [Microsoft.OSTCExtensions.CustomScriptForLinux-1.0]sequence number is 0
2015/01/27 05:50:33 [Microsoft.OSTCExtensions.CustomScriptForLinux-1.0]setting file path is/var/lib/waagent/Microsoft.OSTCExtensions.CustomScriptForLinux-1.1/config/0.settings
2015/01/27 05:50:33 [Microsoft.OSTCExtensions.CustomScriptForLinux-1.0]JSON config: {"runtimeSettings":[{"handlerSettings":{"publicSettings":{"fileUris":["https://raw.githubusercontent.com/rlwu607/docs/master/mystart.py"], "commandToExecute": "python mystart.py" }}}]}
2015/01/27 05:50:33 ERROR:Reading from file mrseq Exception is [Errno 2] No such file or directory: 'mrseq'
2015/01/27 05:50:33 [Microsoft.OSTCExtensions.CustomScriptForLinux-1.0]set most recent sequence number to 0
2015/01/27 05:50:33 [Microsoft.OSTCExtensions.CustomScriptForLinux-1.0]Downloading scripts from external links...
2015/01/27 05:52:41 ERROR:[Microsoft.OSTCExtensions.CustomScriptForLinux-1.0]Failed to download external file with uri:https://raw.githubusercontent.com/rlwu607/docs/master/mystart.pywith error:<urlopen error [Errno 110] Connection timed out>
2015/01/27 05:52:41 ERROR:[Microsoft.OSTCExtensions.CustomScriptForLinux-1.0]Failed to enable the extension with error: <urlopen error [Errno 110] Connection timed out>, stack trace: Traceback (most recent call last):
2015/01/27 05:52:41 ERROR: File "/var/lib/waagent/Microsoft.OSTCExtensions.CustomScriptForLinux-1.1/installer/handle.py", line 102, in enable
2015/01/27 05:52:41 ERROR: download_external_files(blob_uris, hutil._context._seq_no, cmd, hutil)
2015/01/27 05:52:41 ERROR: File "/var/lib/waagent/Microsoft.OSTCExtensions.CustomScriptForLinux-1.1/installer/handle.py", line 193, in download_external_files
2015/01/27 05:52:41 ERROR: download_external_file(uri, seqNo, command, hutil)
2015/01/27 05:52:41 ERROR: File "/var/lib/waagent/Microsoft.OSTCExtensions.CustomScriptForLinux-1.1/installer/handle.py", line 201, in download_external_file
2015/01/27 05:52:41 ERROR: download_and_save_file(uri, file_path)
2015/01/27 05:52:41 ERROR: File "/var/lib/waagent/Microsoft.OSTCExtensions.CustomScriptForLinux-1.1/installer/handle.py", line 209, in download_and_save_file
2015/01/27 05:52:41 ERROR: src = urllib2.urlopen(uri)
2015/01/27 05:52:41 ERROR: File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
2015/01/27 05:52:41 ERROR: return _opener.open(url, data, timeout)
2015/01/27 05:52:41 ERROR: File "/usr/lib/python2.7/urllib2.py", line 404, in open
2015/01/27 05:52:41 ERROR: response = self._open(req, data)
2015/01/27 05:52:41 ERROR: File "/usr/lib/python2.7/urllib2.py", line 422, in _open
2015/01/27 05:52:41 ERROR: '_open', req)
2015/01/27 05:52:41 ERROR: File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
2015/01/27 05:52:41 ERROR: result = func(*args)
2015/01/27 05:52:41 ERROR: File "/usr/lib/python2.7/urllib2.py", line 1222, in https_open
2015/01/27 05:52:41 ERROR: return self.do_open(httplib.HTTPSConnection, req)
2015/01/27 05:52:41 ERROR: File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
2015/01/27 05:52:41 ERROR: raise URLError(err)
2015/01/27 05:52:41 ERROR:URLError: <urlopen error [Errno 110] Connection timed out>
2015/01/27 05:52:41 ERROR:

2015/01/27 05:54:31 [Microsoft.OSTCExtensions.CustomScriptForLinux-1.0]sequence number is 0
2015/01/27 05:54:31 [Microsoft.OSTCExtensions.CustomScriptForLinux-1.0]setting file path is/var/lib/waagent/Microsoft.OSTCExtensions.CustomScriptForLinux-1.1/config/0.settings
2015/01/27 05:54:31 [Microsoft.OSTCExtensions.CustomScriptForLinux-1.0]JSON config: {"runtimeSettings":[{"handlerSettings":{"publicSettings":{"fileUris":["https://raw.githubusercontent.com/rlwu607/docs/master/mystart.py"], "commandToExecute": "python mystart.py" }}}]}
2015/01/27 05:54:31 [Microsoft.OSTCExtensions.CustomScriptForLinux-1.0]Current sequence number, 0, is not greater than the sequnce number of the most recent executed configuration. Exiting...

@juilin juilin changed the title Problem on custom extension Problem on extension of custom script Jan 27, 2015
@yuezh
Copy link
Contributor

yuezh commented Jan 28, 2015

Hi, rlwu

Thanks for reporting this issue to us.
There is an easy workaround. By adding a random parameter to the extension's configuration JSON, the mrseq will differ per request.
[hashtable]$Param=@{};
$Param['fileUris'] = $fileUris;
$Param['commandToExecute'] = $commandToExecute;
$Param['timestamp'] = (Get-Date).Ticks
$PublicConfiguration = ConvertTo-Json $Param;

Thanks
Yue

@juilin
Copy link
Author

juilin commented Jan 30, 2015

Yue,

Thanks for your response. I am using cross-platform command line interface not PowerShell. I tried the command below but fail.

azure vm extension set -v rl-ubuntu-1404 CustomScriptForLinux Microsoft.OSTCExtensions 1.1 -i '{"fileUris":["https://raw.githubusercontent.com/rlwu607/docs/master/mystart.py"], "commandToExecute": "python mystart.py", "timestamp": "(Get-Date).Ticks" }'

2015/01/30 06:32:10 [Microsoft.OSTCExtensions.CustomScriptForLinux-1.0]JSON config: {"runtimeSettings":[{"handlerSettings":{"publicSettings":{"fileUris":["https://raw.githubusercontent.com/rlwu607/docs/master/mystart.py"], "commandToExecute": "python mystart.py", "timestamp": "(Get-Date).Ticks" }}}]}
2015/01/30 06:32:10 [Microsoft.OSTCExtensions.CustomScriptForLinux-1.0]Current sequence number, 0, is not greater than the sequnce number of the most recent executed configuration. Exiting...

@yuezh
Copy link
Contributor

yuezh commented Jan 30, 2015

@rlwu607
Sorry, I was assuming you are using Windows Powershell. The point is to add a random parameter field to make each request different. For cli, you could generate a different random number for that field :)

@juilin
Copy link
Author

juilin commented Feb 2, 2015

I see. Thanks for your answer.

2015-01-30 16:02 GMT+08:00 Yue Zhang (MS) notifications@github.com:

@rlwu607 https://github.com/rlwu607
Sorry, I was assuming you are using Windows Powershell. The point is to
add a random parameter field to make each request different. For cli, you
could generate a different random number for that field :)


Reply to this email directly or view it on GitHub
#12 (comment)
.

@smneal
Copy link

smneal commented May 26, 2015

I'm having a similar issue here, but with a bit of a twist. I am also passing in a tick, so my command looks like {"commandToExecute": "sh script.sh", "timestamp": "635682344173313639"} for example as I print the output to try and troubleshoot this. The issue is, that the number displayed here is different to that in the script extension log file which for the last three times I have run this has been 635678934516935423.

Naturally, I get the following message - "Current sequence number, 70, is not greater than the sequnce number of the most recent executed configuration."

Sometimes it works, sometimes it doesn't, but there certainly looks like there is something weird going on.

@bingosummer
Copy link
Member

Feel free to re-open it if you hit the issue again.

@kkorsakov
Copy link

Problem is reproducible. I deploy VM with Linux custom script extension from Visual Studio Online. I have special parameter passed into PS script. -runId $(Build.DefinitionName)/$(Build.BuildNumber). So it is unique each new build. This parameter is passed into "commandToExecute": "[concat( '.......by script.....',parameters('runId')]". Also i have "fileUris" that are downloaded from storage account. So if i have an error in files and deployment fails i can't fix an error and redeploy. Every next deployment fails with the error "Current sequence number, ..., is not greater than the sequnce number of the most recent executed configuration". If i set sequence number minus one in "mrseq" file and delete config/x.settings, download/x/ and status/x.status everything goes ok.

@kkorsakov
Copy link

Also sometimes (i actually can't figure out conditions) nothing helps, it remembers "commandToExecute" from error "azuredeploy.json" and continues to execute it on machine. This goes until i manually delete broken extension in portal.

@bingosummer bingosummer reopened this Feb 9, 2016
@kkorsakov
Copy link

What kind of info is needed? I can provide logs, ssh to server, azure service account.

@bingosummer
Copy link
Member

@kkorsakov
Please send me your logs, ssh to server, azure service account to me via binxi@microsoft.com.
I can have an investigation.

@kkorsakov
Copy link

Done.

@boumenot
Copy link
Member

@bingosummer I haven't seen any activity on this bug since Feb. The bug was assigned to me, but no logs have been shared. Please reopen as necessary.

@Patjomkin
Copy link

Hello!
I have some problem with deploy linux vm from arm template. I tried use extension "CustomScriptForLinux", but first result of running the script has been cached, and I must recreate VM for new deploy for new start result deploy. How I can disable caching for ARM template? Or how I can remove old result last running "CustomScriptForLinux" without remove target linux vm?
I tried use time stamp, but the problem is not solved.
From logs:
[Microsoft.OSTCExtensions.CustomScriptForLinux-1.0]Current sequence number, 0, is not greater than the sequnce number of the most recent executed configuration. Exiting...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants