Project

General

Profile

Refactor #27874

Optimize process tree in tfm-* wrappers

Added by Ewoud Kohl van Wijngaarden about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Category:
RPMs
Target version:
-
Difficulty:
Triaged:
Yes
Bugzilla link:

Description

Currently we execute bash and within that bash we execute scl enable tfm "bash wrapper". This results in a complex process tree:

/bin/bash /usr/bin/tfm-rake -- console
 \_ scl enable tfm bash /tmp/tmp.4vH4dRd7aM
     \_ /bin/bash /var/tmp/scliO1x5z
         \_ bash /tmp/tmp.4vH4dRd7aM
             \_ /opt/rh/rh-ruby25/root/usr/bin/ruby /opt/rh/rh-ruby25/root/usr/bin/rake -- console

It can also use source scl_enable tfm && exec ruby "$@" and end up with a much smaller process tree since it replaces the parent process:

/opt/rh/rh-ruby25/root/usr/bin/ruby /opt/rh/rh-ruby25/root/usr/bin/rake console

This still avoids https://bugzilla.redhat.com/show_bug.cgi?id=1248418 in a different way.

Associated revisions

Revision 682a5f1a (diff)
Added by Ewoud Kohl van Wijngaarden about 1 year ago

Fixes #27874 - Optimize tfm wrappers

This avoids a complex process tree and replaces the original process.
This saves memory and also makes ps auxf and similar commands much more
understandable.

Compare:

/bin/bash /usr/bin/tfm-rake -- console
\_ scl enable tfm bash /tmp/tmp.4vH4dRd7aM
\_ /bin/bash /var/tmp/scliO1x5z
\_ bash /tmp/tmp.4vH4dRd7aM
\_ /opt/rh/rh-ruby25/root/usr/bin/ruby /opt/rh/rh-ruby25/root/usr/bin/rake -- console

With:

/opt/rh/rh-ruby25/root/usr/bin/ruby /opt/rh/rh-ruby25/root/usr/bin/rake console

Revision 5b0eb66c (diff)
Added by Ewoud Kohl van Wijngaarden about 1 year ago

Refs #27874 - Quote the variable in tfm wrappers

History

#1 Updated by The Foreman Bot about 1 year ago

  • Assignee set to Ewoud Kohl van Wijngaarden
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman-packaging/pull/4115 added

#2 Updated by The Foreman Bot about 1 year ago

  • Fixed in Releases 1.24.0 added

#3 Updated by Ewoud Kohl van Wijngaarden about 1 year ago

  • Status changed from Ready For Testing to Closed

#4 Updated by The Foreman Bot about 1 year ago

  • Pull request https://github.com/theforeman/foreman-packaging/pull/4129 added

Also available in: Atom PDF