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

Fixed cockpit process starting #20077

Conversation

yrudman
Copy link
Contributor

@yrudman yrudman commented Apr 16, 2020

Issue: Cockpit process not starting

There were multiple issues with each preventing successful starting for cockpit process.

After:
Cockpit process successfully started on reproducer environment:

[----] I, [2020-04-20T16:23:44.266812 #31345:2b15806da5b8]  INFO -- : MIQ(MiqCockpitWsWorker::Runner#cockpit_ws_run) Starting cockpit-ws process with command: /usr/libexec/cockpit-ws --port 9002 --address 127.0.0.1 --no-tls 
[----] I, [2020-04-20T16:23:44.267070 #31345:2b15806da5b8]  INFO -- : MIQ(MiqCockpitWsWorker::Runner#cockpit_ws_run) Cockpit environment {"XDG_CONFIG_DIRS"=>"/var/www/miq/vmdb/config", "DRB_URI"=>"drbunix:///tmp/cockpit20200420-31345-1w35084"} 
[----] I, [2020-04-20T16:23:44.291255 #31345:2b15806da5b8]  INFO -- : MIQ(MiqCockpitWsWorker::Runner#cockpit_ws_run) MIQ(MiqCockpitWsWorker::Runner) cockpit-ws process started - pid=31363

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1824355

@miq-bot add-label bug, core, ivanchuk/yes

@@ -151,7 +151,7 @@ def cockpit_ws_run
Bundler.with_clean_env do
stdin, stdout, stderr, wait_thr = Open3.popen3(env, *cockpit_ws.command(BINDING_ADDRESS), :unsetenv_others => true)
end
stdin.close
stdin&.close
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the intention was to have stdin.close in the scope of the Open3 command and was accidentally moved to a different scope, outside the Bundler.with_clean_env scope, in commit: 63b44ed

I believe checking for stdin here is not right. We should either not close stdin at all or move the stdin.close in the with_clean_env block.

cc @carbonin

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move the stdin.close in the with_clean_env block.

☝️ This I think.

@yrudman yrudman force-pushed the check-for-nilif-stdin-not-nil-in-cockpit-worker branch from a94aa2c to e00b25d Compare April 16, 2020 19:36
@yrudman yrudman changed the title check if for stdin is nil in MiqCockpitWsWorker::Runner [WIP] check if for stdin is nil in MiqCockpitWsWorker::Runner Apr 17, 2020
@miq-bot miq-bot added the wip label Apr 17, 2020
@yrudman
Copy link
Contributor Author

yrudman commented Apr 17, 2020

it looks like Open3.popen3 does not return anything or not invoked

@yrudman yrudman force-pushed the check-for-nilif-stdin-not-nil-in-cockpit-worker branch 3 times, most recently from 593cdea to 5295103 Compare April 20, 2020 19:51
 fixed possible nil.close,
 close stderr and stdout when process terminated
 added missing default value in MiqCockpitWsWorker::Runner#wait_on_cockpit_ws(pid) method,
 added logging what command used to start cockpit process and enviroment settings
 fixed typo when accessig command to start cockpit
 return pid or raise error if cockpit process not started

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1824355
@yrudman yrudman force-pushed the check-for-nilif-stdin-not-nil-in-cockpit-worker branch from 5295103 to 6e67f1f Compare April 20, 2020 20:08
@yrudman yrudman changed the title [WIP] check if for stdin is nil in MiqCockpitWsWorker::Runner Fixed cockpit process starting Apr 20, 2020
@miq-bot miq-bot removed the wip label Apr 20, 2020
@miq-bot
Copy link
Member

miq-bot commented Apr 20, 2020

Checked commits yrudman/manageiq@7bb0735~...ddec1e3 with ruby 2.5.7, rubocop 0.69.0, haml-lint 0.28.0, and yamllint
2 files checked, 0 offenses detected
Everything looks fine. 🍰

@jrafanie jrafanie merged commit 87de914 into ManageIQ:master Apr 21, 2020
simaishi pushed a commit that referenced this pull request Apr 23, 2020
@simaishi
Copy link
Contributor

Jansa backport details:

$ git log -1
commit 6787863defd4a01889cb07787ede02db13a61a43
Author: Joe Rafaniello <jrafanie@users.noreply.github.com>
Date:   Tue Apr 21 13:42:19 2020 -0400

    Merge pull request #20077 from yrudman/check-for-nilif-stdin-not-nil-in-cockpit-worker

    Fixed cockpit process starting

    (cherry picked from commit 87de914b8bd946dc2d91b6446d66db5187daef92)

    https://bugzilla.redhat.com/show_bug.cgi?id=1824355

simaishi pushed a commit that referenced this pull request May 7, 2020
@simaishi
Copy link
Contributor

simaishi commented May 7, 2020

Ivanchuk backport details:

$ git log -1
commit c9453d4c6f6f32d472a72a8bb7e103b6852985eb
Author: Joe Rafaniello <jrafanie@users.noreply.github.com>
Date:   Tue Apr 21 13:42:19 2020 -0400

    Merge pull request #20077 from yrudman/check-for-nilif-stdin-not-nil-in-cockpit-worker

    Fixed cockpit process starting

    (cherry picked from commit 87de914b8bd946dc2d91b6446d66db5187daef92)

    https://bugzilla.redhat.com/show_bug.cgi?id=1824355

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

Successfully merging this pull request may close these issues.

7 participants