[ 
https://issues.apache.org/jira/browse/FLINK-15488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17010266#comment-17010266
 ] 

Xintong Song commented on FLINK-15488:
--------------------------------------

I agree with [~azagrebin] and [~trohrmann] that the logs generated during 
{{BashJavaUtils}} should be preserved. Those logs contains information about 
how memory sizes are calculated from the configurations, and hints of how to 
fix an improper configuration, which are important to the users. I also agree 
that if the logs are configured to be outputted to stdout, we should also 
forward them to stdout of {{taskmanager.sh}}.

The example mentioned by [~dwysakowicz], 
{{OptimizerPlanEnvironment#getPipeline}}, inspires me with another approach. If 
separating logs and {{BashJavaUtils}} calculation results with regex is too 
fragile, maybe we can separate them inside {{BashJavaUtils}}, by overwriting 
the stdout.

To be specific, we can overwrite stdout to a {{ByteArrayOutputStream}}, and 
make {{getTmResourceDynamicConfigs}} and {{getTmResourceJvmParams}} return 
string type results. Then we can make sure the calculation result is always 
outputted in the first or last line (it is already always the last line now but 
we can make it an explicit contract). If the result is not generated (say an 
exception is thrown during the calculation), we can use an empty line as a 
placeholder, and non-zero exit code should be returned so the shell script can 
learn that the result is invalid by checking the exit code. A 
{{try-catch(Throwable)-finally}} could be used to make sure the cached stdout 
will be outputted.

> Cannot start a taskmanger if using logback
> ------------------------------------------
>
>                 Key: FLINK-15488
>                 URL: https://issues.apache.org/jira/browse/FLINK-15488
>             Project: Flink
>          Issue Type: Bug
>          Components: API / Core, Deployment / Scripts
>    Affects Versions: 1.10.0
>            Reporter: Dawid Wysakowicz
>            Priority: Blocker
>             Fix For: 1.10.0
>
>
> When using logback it is not possible to start the taskmanager using 
> {{taskamanger.sh}} scripts. The same problem (probably) occurs when using 
> slf4j that logs into the console.
> The problem is that when calculating memory configuration with 
> {{BashJavaUtils}} class the result is returned through standard output. If 
> something is logged into the console it may result in undefined behavior such 
> as e.g. 
> {code}
> Error: Could not find or load main class 13:51:23.961
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to