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

Sangjin Lee edited comment on YARN-6170 at 2/10/17 7:06 PM:
------------------------------------------------------------

Thanks for the info Varun. I found HADOOP-11749.

I can definitely see an argument that {{HttpServer2.start()}} should ensure it 
stays up. However, it might be somewhat awkward to do it there. I'm not too 
sure if I like the idea of turning some threads it owns into non-daemon to do 
it. The right way to do it is still to join, but you cannot do that (inline) in 
the {{start()}} method.

{{HttpServer2}} does offer a {{join()}} method (probably for this purpose). I'm 
going to put up a patch that utilizes this. Let me know what you think.


was (Author: sjlee0):
Thanks for the info Varun. I found HADOOP-11479.

I can definitely see an argument that {{HttpServer2.start()}} should ensure it 
stays up. However, it might be somewhat awkward to do it there. I'm not too 
sure if I like the idea of turning some threads it owns into non-daemon to do 
it. The right way to do it is still to join, but you cannot do that (inline) in 
the {{start()}} method.

{{HttpServer2}} does offer a {{join()}} method (probably for this purpose). I'm 
going to put up a patch that utilizes this. Let me know what you think.

> TimelineReaderServer should wait to join with HttpServer2
> ---------------------------------------------------------
>
>                 Key: YARN-6170
>                 URL: https://issues.apache.org/jira/browse/YARN-6170
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: timelinereader
>    Affects Versions: 3.0.0-alpha2, YARN-5355
>            Reporter: Sangjin Lee
>            Assignee: Sangjin Lee
>            Priority: Minor
>
> While I was backporting YARN-5355-branch-2 to a 2.6.0-based code branch, I 
> noticed that the timeline reader daemon would promptly shut down upon start. 
> It turns out that in the 2.6.0 code line at least there are only daemon 
> threads left once the main method returns. That causes the JVM to shut down.
> The right pattern to start an embedded jetty web server is to call 
> {{Server.start()}} followed by {{Server.join()}}. That way, the server stays 
> up reliably no matter what other threads get created.
> It works on YARN-5355 only because there *happens* to be one other non-daemon 
> thread. We should add the {{join()}} call to be always correct.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org

Reply via email to