Jira (PUP-9826) Puppet exec timeout does not match documentation

19 views
Skip to first unread message

Jason Grammenos (JIRA)

unread,
Jul 15, 2019, 2:30:05 PM7/15/19
to puppe...@googlegroups.com
Jason Grammenos created an issue
 
Puppet / Bug PUP-9826
Puppet exec timeout does not match documentation
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2019/07/15 11:29 AM
Priority: Normal Normal
Reporter: Jason Grammenos

*Puppet Version: 5.5.14-1xenial
*Puppet Server Version: 5.3.8-1xenial
*OS Name/Version: Ubuntu 16.04 Xenial

Describe your issue in as much detail as possible…

When using tries in an exec resource the documentation states that the timeout parameter of the exec block applies to each try, but the code currently does not implement the functionality in that way. The timeout should apply to each try.

Slack community chat snippet

```
natemccurdy [11 minutes ago]
The timeout is for the entire exec, not for each try. (edited)

Jason Grammenos [10 minutes ago]
`Note that the timeout parameter applies to each try rather than to the complete set of tries.`

natemccurdy [10 minutes ago]
err.. sorry, You’re right.

natemccurdy [10 minutes ago]
Read that wrong.

josh [9 minutes ago]
The docs are wrong unfortunately

Jason Grammenos [9 minutes ago]
oh?

natemccurdy [9 minutes ago]
Oh, hah :slightly_smiling_face:

josh [8 minutes ago]
maybe it used to apply to each try at some point?

natemccurdy [8 minutes ago]
Either way, try removing the `timeout` or set it to `0` and see what happens.

josh [6 minutes ago]
Looks like it's been broken since https://github.com/puppetlabs/puppet/commit/e0e6b642c4e

josh [5 minutes ago]
The begin/rescue needs to be inside `tries.times do |try|`
```
Describe steps to reproduce…

Desired Behavior:

```
exec

{ 'configure': command => "/bin/false", path => ['/usr/bin','/bin'], tries => 10, try_sleep => 5, timeout = 10, }

```
This should have a per try timeout of 10 seconds as per the documentation.

Actual Behavior:

The exec time's out because the current implementation applies the timeout to the whole set of tries.

current documentation:
https://puppet.com/docs/puppet/5.3/types/exec.html#exec-attribute-tries

Please take a moment and attach any relevant log output and/or manifests. This will help us immensely when troubleshooting the issue.

```
Exec try 1/10 /etc/puppetlabs/code/modules/mm/manifests/graylog/graylog.pp:83
Jul 15 2019 - 14:10:34 Exec[configure-ldap](provider=posix) Executing 'curl -s -v -i --netrc-file /etc/graylog/server/configure_ldap.netrc -o /etc/graylog/server/configure_ldap.log -H "Content-Type: application/json" -H "X-Requested-By: puppet" -X PUT http://localhost:9000/api/system/ldap/settings --data @/etc/graylog/server/configure_ldap_data.json 2>&1 | grep 'HTTP/1.1 204''

Jul 15 2019 - 14:10:34 Puppet debug Executing: 'curl -s -v -i --netrc-file /etc/graylog/server/configure_ldap.netrc -o /etc/graylog/server/configure_ldap.log -H "Content-Type: application/json" -H "X-Requested-By: puppet" -X PUT http://localhost:9000/api/system/ldap/settings --data @/etc/graylog/server/configure_ldap_data.json 2>&1 | grep 'HTTP/1.1 204''
Jul 15 2019 - 14:10:44 Puppet err Command exceeded timeout
```
Relevant sections of /var/log/puppetlabs/puppetserver/puppetserver.log or any applicable logs from the same directory.

For more detailed information turn up the server logs by upping the log level in the server's logback.xml

Relevant sections of configurations files (puppet.conf, hiera.conf, Server's conf.d, defaults/sysconfig)

For memory issues with server heap dumps are also helpful.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Nate McCurdy (JIRA)

unread,
Jul 15, 2019, 2:43:04 PM7/15/19
to puppe...@googlegroups.com

Nate McCurdy (JIRA)

unread,
Jul 15, 2019, 2:43:04 PM7/15/19
to puppe...@googlegroups.com
Nate McCurdy updated an issue
 
Change By: Nate McCurdy
Affects Version/s: PUP 5.5.14
Affects Version/s: PUP 6.6.0
*Puppet Version: 5.5.14-1xenial
*Puppet Server Version: 5.3.8-1xenial
*OS Name/Version: Ubuntu 16.04 Xenial

Describe your issue in as much detail as possible…

When using tries in an exec resource the documentation states that the timeout parameter of the exec block applies to each try, but the code currently does not implement the functionality in that way. The timeout should apply to each try.

Slack community chat snippet

```
{quote} natemccurdy  [11 minutes ago]
The timeout is for *the entire exec*, not for each try. (edited)


Jason Grammenos  [10 minutes ago]
`Note that the timeout parameter applies to each try rather than to the complete set of tries.`

natemccurdy  [10 minutes ago]
err.. sorry, You’re right.

natemccurdy  [10 minutes ago]
Read that wrong.

josh  [9 minutes ago]
The docs are wrong unfortunately

Jason Grammenos  [9 minutes ago]
oh?

natemccurdy  [9 minutes ago]
Oh, hah :slightly_smiling_face:

josh  [8 minutes ago]
maybe it used to apply to each try at some point?

natemccurdy  [8 minutes ago]
Either way, try removing the `timeout` or set it to `0` and see what happens.

josh  [6 minutes ago]
Looks like it's been broken since
[ https://github.com/puppetlabs/puppet/commit/e0e6b642c4e ]

josh  [5 minutes ago]
The begin/rescue needs to be inside `tries.times do |try|`
```
Describe steps to reproduce…
{quote}
*Desired Behavior:*

``` {code}
exec { '
configure test ':
    command   =>
" ' /bin/false ",
    path      => [
' /usr/bin' , '/bin'],
    tries     => 10,
    try_sleep => 5,
timeout =
> 10,
  }
``` {code}

This should have a per try timeout of 10 seconds as per the documentation.

*Actual Behavior:*


The exec time's out because the current implementation applies the timeout to the whole set of tries.

current documentation:
[ https://puppet.com/docs/puppet/5.3/types/exec.html#exec-attribute-tries ]

Please take a moment and attach any relevant log output and/or manifests. This will help us immensely when troubleshooting the issue.

``` {code}
Exec try 1/10 /etc/puppetlabs/code/modules/mm/manifests/graylog/graylog.pp:83
Jul 15 2019 - 14:10:34 Exec[configure-ldap](provider=posix) Executing 'curl -s -v -i --netrc-file /etc/graylog/server/configure_ldap.netrc -o /etc/graylog/server/configure_ldap.log -H "Content-Type: application/json" -H "X-Requested-By: puppet" -X PUT
[ http://localhost:9000/api/system/ldap/settings ] --data @/etc/graylog/server/configure_ldap_data.json 2>&1 | grep 'HTTP/1.1 204''


Jul 15 2019 - 14:10:34 Puppet debug Executing: 'curl -s -v -i --netrc-file /etc/graylog/server/configure_ldap.netrc -o /etc/graylog/server/configure_ldap.log -H "Content-Type: application/json" -H "X-Requested-By: puppet" -X PUT [ http://localhost:9000/api/system/ldap/settings ] --data @/etc/graylog/server/configure_ldap_data.json 2>&1 | grep 'HTTP/1.1 204''

Jul 15 2019 - 14:10:44 Puppet err Command exceeded timeout
```
Relevant sections of
{ {/var/log/puppetlabs/puppetserver/puppetserver.log code } } or any applicable logs from the same directory.


For more detailed information turn up the server logs by upping the log level in the server's logback.xml

Relevant sections of configurations files (puppet.conf, hiera.conf, Server's conf.d, defaults/sysconfig)

For memory issues with server heap dumps are also helpful.

Nate McCurdy (JIRA)

unread,
Jul 15, 2019, 2:50:02 PM7/15/19
to puppe...@googlegroups.com
Nate McCurdy updated an issue
exec { 'test':
  command   => '/bin/false',

  tries     => 10,
  try_sleep => 5,
  timeout   => 10,
}
{code}
This should have a per try timeout of 10 seconds as per the documentation.

*Actual Behavior:*

The exec time's out because the current implementation applies the timeout to the whole set of tries.

current documentation:
[https://puppet.com/docs/puppet/ 5 6 . 3 6 /types/exec.html#exec-attribute-tries]


Please take a moment and attach any relevant log output and/or manifests. This will help us immensely when troubleshooting the issue.

{code}
Exec try 1/10 /etc/puppetlabs/code/modules/mm/manifests/graylog/graylog.pp:83
Jul 15 2019 - 14:10:34 Exec[configure-ldap](provider=posix) Executing 'curl -s -v -i --netrc-file /etc/graylog/server/configure_ldap.netrc -o /etc/graylog/server/configure_ldap.log -H "Content-Type: application/json" -H "X-Requested-By: puppet" -X PUT [http://localhost:9000/api/system/ldap/settings] --data @/etc/graylog/server/configure_ldap_data.json 2>&1 | grep 'HTTP/1.1 204''

Jul 15 2019 - 14:10:34 Puppet debug Executing: 'curl -s -v -i --netrc-file /etc/graylog/server/configure_ldap.netrc -o /etc/graylog/server/configure_ldap.log -H "Content-Type: application/json" -H "X-Requested-By: puppet" -X PUT [http://localhost:9000/api/system/ldap/settings] --data @/etc/graylog/server/configure_ldap_data.json 2>&1 | grep 'HTTP/1.1 204''
Jul 15 2019 - 14:10:44 Puppet err Command exceeded timeout
{code}

Nate McCurdy (JIRA)

unread,
Jul 15, 2019, 2:51:03 PM7/15/19
to puppe...@googlegroups.com


Please take a moment and attach any relevant log output and/or manifests. This will help us immensely when troubleshooting the issue.
{code} Exec try 1/10 /etc/puppetlabs/code/modules/mm/manifests/graylog/graylog.pp:83
Jul 15 2019 - 14:10:34 Exec[configure-ldap](provider=posix) Executing 'curl -s -v -i --netrc-file /etc/graylog/server/configure_ldap.netrc -o /etc/graylog/server/configure_ldap.log -H "Content-Type: application/json" -H "X-Requested-By: puppet" -X PUT [http://localhost:9000/api/system/ldap/settings] --data @/etc/graylog/server/configure_ldap_data.json 2>&1 | grep 'HTTP/1.1 204''

Jul 15 2019 - 14:10:34 Puppet debug Executing: 'curl -s -v -i --netrc-file /etc/graylog/server/configure_ldap.netrc -o /etc/graylog/server/configure_ldap.log -H "Content-Type: application/json" -H "X-Requested-By: puppet" -X PUT [http://localhost:9000/api/system/ldap/settings] --data @/etc/graylog/server/configure_ldap_data.json 2>&1 | grep 'HTTP/1.1 204''
Jul 15 2019 - 14:10:44 Puppet err Command exceeded timeout
{code}

Nate McCurdy (JIRA)

unread,
Jul 15, 2019, 3:03:02 PM7/15/19
to puppe...@googlegroups.com
Nate McCurdy commented on Bug PUP-9826
 
Re: Puppet exec timeout does not match documentation

exec { 'test':
  command   => '/bin/sleep 5; /bin/false',
  tries     => 10,
  try_sleep => 1,
  timeout   => 4,
}

That triggers the timeout error, but this does not:

exec { 'test':
  command   => '/bin/sleep 4; /bin/false',
  tries     => 10,
  try_sleep => 1,
  timeout   => 5,
}

So, it actually does look like the timeout attribute applies per try, but I think that's just an accident based on looking at the source in exec.rb. Nothing is actually enforcing that timeout applies to all retries cumulatively.

Josh Cooper (JIRA)

unread,
Jul 15, 2019, 11:45:02 PM7/15/19
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Jul 16, 2019, 12:51:03 AM7/16/19
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-9826
 
Re: Puppet exec timeout does not match documentation

The timeout applies to each try, but the problem is if a timeout occurs for any one try, then the entire resource is marked as failed, instead of continuing to retry.

Josh Cooper (Jira)

unread,
Dec 6, 2021, 6:26:01 PM12/6/21
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Labels: tbd
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages