Command is not executing properly (blocking) in Murano Package

Bug #1524347 reported by Gangadhar Sunkara
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Murano
Fix Released
High
Stan Lagun
Mitaka
Fix Released
High
Stan Lagun

Bug Description

We have a script under Resources/scrpits

In middle of the script we have to use a random string. So we used `cat /dev/urandom | tr -dc 'a-z0-9' | fold -w ${1:-12} | head -n 1`
line to get random string. If run this on Bash shell it returns the output immediately. Same command in package blocking the execution.

And the output of `ps -Af` at blocking time is :

root 11652 11651 99 10:46 ? 00:00:02 cat /dev/urandom
root 11653 11651 6 10:46 ? 00:00:00 tr -dc a-z0-9
root 11654 11651 1 10:46 ? 00:00:00 fold -w 12

which is missing `head -n 1` process.

Attached the package which produces above case.

Thanks.

Revision history for this message
Gangadhar Sunkara (gangadhar-sunkara018) wrote :
Stan Lagun (slagun)
Changed in murano:
milestone: none → mitaka-2
importance: Undecided → High
status: New → Triaged
Changed in murano:
milestone: mitaka-2 → mitaka-3
Dmytro Dovbii (ddovbii)
Changed in murano:
assignee: nobody → Dmytro Dovbii (ddovbii)
Revision history for this message
Stan Lagun (slagun) wrote :

Dmytro, can you validate the bug?

Dmytro Dovbii (ddovbii)
Changed in murano:
status: Triaged → Confirmed
Changed in murano:
milestone: mitaka-3 → mitaka-rc1
Revision history for this message
Dmytro Dovbii (ddovbii) wrote :

Unfortunately, this is not a bug of murano. Murano-agent uses `subprocess` module in order to execute shell scripts [1]
I tried to run the same command locally without murano-agent, but just using subprocess module and ipython:

```
import subprocess
cmd = "cat /dev/urandom | tr -dc 'a-z0-9' | fold -w ${1:-12} | head -n 1"
subprocess.call(cmd, shell=True)

```
and faced this the same problem - hanging of execution. I also tried to use another modules such as `os` or `pexpect` and tried to experiment with different parameters of subprocess functions, but allways saw this behaviour. So, looks like this we can't fix it right now. Please, use another methods of generating a random strings.

1. https://github.com/openstack/murano-agent/blob/master/muranoagent/executors/application/__init__.py#L55-L62

Changed in murano:
status: Confirmed → Won't Fix
status: Won't Fix → Confirmed
milestone: mitaka-rc1 → newton-1
Stan Lagun (slagun)
Changed in murano:
assignee: Dmytro Dovbii (ddovbii) → Stan Lagun (slagun)
Stan Lagun (slagun)
Changed in murano:
milestone: newton-1 → mitaka-rc2
no longer affects: murano/newton
Changed in murano:
status: Confirmed → In Progress
Revision history for this message
Stan Lagun (slagun) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to murano-agent (stable/mitaka)

Fix proposed to branch: stable/mitaka
Review: https://review.openstack.org/295850

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to murano-agent (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/295852

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to murano-agent (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/295853

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to murano-agent (master)

Reviewed: https://review.openstack.org/295833
Committed: https://git.openstack.org/cgit/openstack/murano-agent/commit/?id=75712716ba52e945965ab588620e8d9d26795c40
Submitter: Jenkins
Branch: master

commit 75712716ba52e945965ab588620e8d9d26795c40
Author: Stan Lagun <email address hidden>
Date: Tue Mar 22 16:47:49 2016 +0300

    Restores SIGPIPE on script processes

    There is an issue https://bugs.python.org/issue1652
    in Python 2.7 which was resolved in Py3.

    By default Python sets SIGPIPE to SIG_IGN on startup, because
    it prefers to check every write and raise an IOError exception rather
    than taking SIGPIPE. This is all well and good for Python itself.
    However, non-Python Unix subprocesses generally expect to have
    SIGPIPE set to the default action, since that's what will happen if
    they're started from a normal shell.

    As a result scripts with piping that is terminated in reverse chain
    order are never exit.

    See more info here:
    http://www.enricozini.org/blog/2009/debian/python-pipes/

    Closes-Bug: #1524347
    Change-Id: Ia015e7fd46912f6a0be97a6b9c297f8d14fd3f7c

Changed in murano:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to murano-agent (stable/kilo)

Reviewed: https://review.openstack.org/295853
Committed: https://git.openstack.org/cgit/openstack/murano-agent/commit/?id=75e7e046950464a9dfc1afafeb86fc0b1afe6ce2
Submitter: Jenkins
Branch: stable/kilo

commit 75e7e046950464a9dfc1afafeb86fc0b1afe6ce2
Author: Stan Lagun <email address hidden>
Date: Tue Mar 22 16:47:49 2016 +0300

    Restores SIGPIPE on script processes

    There is an issue https://bugs.python.org/issue1652
    in Python 2.7 which was resolved in Py3.

    By default Python sets SIGPIPE to SIG_IGN on startup, because
    it prefers to check every write and raise an IOError exception rather
    than taking SIGPIPE. This is all well and good for Python itself.
    However, non-Python Unix subprocesses generally expect to have
    SIGPIPE set to the default action, since that's what will happen if
    they're started from a normal shell.

    As a result scripts with piping that is terminated in reverse chain
    order are never exit.

    See more info here:
    http://www.enricozini.org/blog/2009/debian/python-pipes/

    Closes-Bug: #1524347
    Change-Id: Ia015e7fd46912f6a0be97a6b9c297f8d14fd3f7c

tags: added: in-stable-kilo
tags: added: in-stable-liberty
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to murano-agent (stable/liberty)

Reviewed: https://review.openstack.org/295852
Committed: https://git.openstack.org/cgit/openstack/murano-agent/commit/?id=0bbfed3bf40192f34607c69c0a46301e81a643be
Submitter: Jenkins
Branch: stable/liberty

commit 0bbfed3bf40192f34607c69c0a46301e81a643be
Author: Stan Lagun <email address hidden>
Date: Tue Mar 22 16:47:49 2016 +0300

    Restores SIGPIPE on script processes

    There is an issue https://bugs.python.org/issue1652
    in Python 2.7 which was resolved in Py3.

    By default Python sets SIGPIPE to SIG_IGN on startup, because
    it prefers to check every write and raise an IOError exception rather
    than taking SIGPIPE. This is all well and good for Python itself.
    However, non-Python Unix subprocesses generally expect to have
    SIGPIPE set to the default action, since that's what will happen if
    they're started from a normal shell.

    As a result scripts with piping that is terminated in reverse chain
    order are never exit.

    See more info here:
    http://www.enricozini.org/blog/2009/debian/python-pipes/

    Closes-Bug: #1524347
    Change-Id: Ia015e7fd46912f6a0be97a6b9c297f8d14fd3f7c

tags: added: in-stable-mitaka
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to murano-agent (stable/mitaka)

Reviewed: https://review.openstack.org/295850
Committed: https://git.openstack.org/cgit/openstack/murano-agent/commit/?id=8738324d9c70675b874256e1f07ebb29e34688b8
Submitter: Jenkins
Branch: stable/mitaka

commit 8738324d9c70675b874256e1f07ebb29e34688b8
Author: Stan Lagun <email address hidden>
Date: Tue Mar 22 16:47:49 2016 +0300

    Restores SIGPIPE on script processes

    There is an issue https://bugs.python.org/issue1652
    in Python 2.7 which was resolved in Py3.

    By default Python sets SIGPIPE to SIG_IGN on startup, because
    it prefers to check every write and raise an IOError exception rather
    than taking SIGPIPE. This is all well and good for Python itself.
    However, non-Python Unix subprocesses generally expect to have
    SIGPIPE set to the default action, since that's what will happen if
    they're started from a normal shell.

    As a result scripts with piping that is terminated in reverse chain
    order are never exit.

    See more info here:
    http://www.enricozini.org/blog/2009/debian/python-pipes/

    Closes-Bug: #1524347
    Change-Id: Ia015e7fd46912f6a0be97a6b9c297f8d14fd3f7c

Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/murano-agent 3.0.0.0b1

This issue was fixed in the openstack/murano-agent 3.0.0.0b1 development milestone.

Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/murano-agent 2015.1.1

This issue was fixed in the openstack/murano-agent 2015.1.1 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

This issue was fixed in the openstack/murano-agent 2015.1.1 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/murano-agent 2.0.0

This issue was fixed in the openstack/murano-agent 2.0.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.