You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "Josh Elser (Jira)" <ji...@apache.org> on 2019/09/04 16:03:00 UTC
[jira] [Commented] (PHOENIX-5454) Phoenix scripts start foreground
java processes as child processes
[ https://issues.apache.org/jira/browse/PHOENIX-5454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16922628#comment-16922628 ]
Josh Elser commented on PHOENIX-5454:
-------------------------------------
One question for you, Istvan:
{quote}The variants which include a "{{p}}" near the end ({{execlp()}}, {{execlpe()}}, {{execvp()}}, and {{execvpe()}}) will use the PATH environment variable to locate the program file
{quote}
{quote}The other variants, {{execl()}}, {{execle()}}, {{execv()}}, and {{execve()}}, will not use the PATH variable to locate the executable
{quote}
The above is from the Python documentation.
{code:java}
cmd = java_cmd % {'java': java, 'root_logger': 'INFO,console', 'log_dir': '.', 'log_file': 'psql.log'}
- # Because shell=True is not set, we don't have to alter the environment
- child = subprocess.Popen(cmd.split())
- sys.exit(child.wait())
+ splitcmd = cmd.split()
+ os.execv(splitcmd[0], splitcmd) {code}
Wouldn't this mean that the relative {{java}} command would fail? Need to try this out locally, but seems problematic as-is, but {{execvp}} would do what you want?
> Phoenix scripts start foreground java processes as child processes
> ------------------------------------------------------------------
>
> Key: PHOENIX-5454
> URL: https://issues.apache.org/jira/browse/PHOENIX-5454
> Project: Phoenix
> Issue Type: Improvement
> Affects Versions: 5.1.0
> Reporter: István Tóth
> Assignee: István Tóth
> Priority: Minor
> Attachments: PHOENIX-5454.master.v1.patch
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Currently the phoenix scripts in python start the java process via subprocess.call() or subprocess.popen() even when the java process has to run in the foreground, and there is no cleanup required.
> I propose that in these cases, we start java via os.exec*(). This has the following advantages:
> * There is no python process idling waiting for the java process to end, reducing process count and memory consumption
> * Signal handling is simplified (signals sent to the starting script are received by the java process started)
> * Return code handling is simplified (no need to check for and return error codes from java in the startup script)
--
This message was sent by Atlassian Jira
(v8.3.2#803003)