<div dir="auto"><div>Hi Ashlesh<div dir="auto"><br></div><div dir="auto">Boost.Log document says: "As long as the forked process doesn't try to use any of Boost.Log code"…</div><div dir="auto">Thus, you can make sure ndn-cxx logging facility is initialized before forking, and log levels are all set to none, so that Boost.Log functions are never involved after forking.</div><div dir="auto"><br></div><div dir="auto">Otherwise, just stop daemonizing, and do the same as NFD, so that Boost.Log can work correctly.</div><div dir="auto"><br></div><div dir="auto">Yours, Junxiao</div><br><div class="gmail_extra"><br><div class="gmail_quote">On Mar 31, 2017 9:33 AM, "Ashlesh Gawande (agawande)" <<a href="mailto:agawande@memphis.edu">agawande@memphis.edu</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div id="m_-5974426166315088582divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif" dir="ltr">
<p>Hi all</p>
<p><br>
</p>
<p>Chronosync uses ndn-cxx logging facility (wrapper around boost logging facility).</p>
<p><br>
</p>
<p>Now I want to use NLSR based on Chronosync (instead of the old fork, Nsync).</p>
<p><br>
</p>
<p>NLSR has the option to daemonize. So I start nfd and run nlsr -d to daemonize NLSR (number of threads 2).</p>
<p>Then I stop NFD and NLSR gets an error (<span>ERROR: error while receiving data from socket (End of file)</span>).</p>
<p>But ps shows that NLSR is still running, with number of threads as 1.</p>
<p>I attach gdb to it and have attached the bt output.</p>
<p><br>
</p>
<p>I do not have this problem when NLSR is not daemonized.</p>
<p>Seems like it is happening because boost logging facility does not support fork:</p>
<p><span><a href="http://www.boost.org/doc/libs/1_63_0/libs/log/doc/html/log/rationale/fork_support.html" class="m_-5974426166315088582OWAAutoLink" id="m_-5974426166315088582LPlnk108330" target="_blank">http://www.boost.org/doc/libs/<wbr>1_63_0/libs/log/doc/html/log/<wbr>rationale/fork_support.html</a></span><span style="font-size:12pt">?</span></p>
<p><br>
</p>
<p>Any suggestions or comments?</p>
<p>(I am not sure why NLSR runs as daemon, <a href="https://redmine.named-data.net/issues/1795" class="m_-5974426166315088582OWAAutoLink" id="m_-5974426166315088582LPlnk716276" target="_blank">https://redmine.named-<wbr>data.net/issues/1795</a> does not provide much rationale other than backgrounding.
 Also NLSR does not close stdout when daemonizing</p>
<p><a href="https://github.com/named-data/NLSR/blob/master/src/nlsr.cpp#L153" class="m_-5974426166315088582OWAAutoLink" id="m_-5974426166315088582LPlnk911339" target="_blank">https://github.com/named-data/<wbr>NLSR/blob/master/src/nlsr.cpp#<wbr>L153</a>).</p>
<p><br>
</p>
<p>Thanks</p><font color="#888888">
<p>Ashlesh</p></font></div></div></blockquote></div></div></div></div>