<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Yes, googling was, of course, my first attempt as well ...</p>
<p><br>
</p>
<p>My understanding is that epoll.cxx is mostly used for socket
management and if I were to create a bunch of open sockets
(without closing them) I would understand the crash.<br>
But the only place where I open sockets repeatedly is in the same
loop where I close them as well (e.g. zmq_close(data_socket) :
"The <em>zmq_close()</em> function shall destroy the socket
referenced by the <em>socket</em>
argument.").</p>
<p>Either I am not doing something correctly or there is a bug in
that function with respect to the OS side.</p>
<p><br>
</p>
<p>Thanks,</p>
<p><br>
</p>
<p>Michael <br>
</p>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">On 2025-01-21 10:08 a.m., Robert
Michaels wrote:<br>
</div>
<blockquote type="cite" cite="mid:BY3PR09MB75713DB0286B55DDFD47CD1EDBE62@BY3PR09MB7571.namprd09.prod.outlook.com">
<style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
<span style="font-family: Calibri;"><span style="font-size: 12pt">
<table style="background-color:#fbe3b3;border: 1px solid black">
<tbody>
<tr>
<td><font style="color:#462c1d"><strong>Caution!</strong>
This message was sent from outside the University of
Manitoba.<span></span></font></td>
</tr>
</tbody>
</table>
</span></span><br>
<div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I haven't encountered this, but I notice that if you Google
"Too many open files (src/epoll.cpp:38)" there are several
suggestions. My experience with Googling is that there may
be 10 ideas and it ends up that 1 of them works.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
yours</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Bob</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature" class="elementToProof">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top: 0px; margin-bottom: 0px;">Dr. Robert
Michaels</p>
<p style="margin-top: 0px; margin-bottom: 0px;">Staff
Scientist, Jefferson Lab</p>
<p style="margin-top: 0px; margin-bottom: 0px;"><a href="http://userweb.jlab.org/~rom" class="OWAAutoLink moz-txt-link-freetext" style="margin-top: 0px; margin-bottom: 0px;" moz-do-not-send="true">http://userweb.jlab.org/~rom</a><br>
</p>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Moller_daq
<a class="moz-txt-link-rfc2396E" href="mailto:moller_daq-bounces@jlab.org"><moller_daq-bounces@jlab.org></a> on behalf of Michael
Gericke <a class="moz-txt-link-rfc2396E" href="mailto:Michael.Gericke@umanitoba.ca"><Michael.Gericke@umanitoba.ca></a><br>
<b>Sent:</b> Tuesday, January 21, 2025 11:01 AM<br>
<b>To:</b> Zuhal Seyma Demiroglu <a class="moz-txt-link-rfc2396E" href="mailto:zdemirog@jlab.org"><zdemirog@jlab.org></a>;
Ciprian Gal <a class="moz-txt-link-rfc2396E" href="mailto:ciprian@jlab.org"><ciprian@jlab.org></a>; Malte Wilfert
<a class="moz-txt-link-rfc2396E" href="mailto:mwilfert@uni-mainz.de"><mwilfert@uni-mainz.de></a>; <a class="moz-txt-link-abbreviated" href="mailto:moller_daq@jlab.org">moller_daq@jlab.org</a>
<a class="moz-txt-link-rfc2396E" href="mailto:moller_daq@jlab.org"><moller_daq@jlab.org></a>; <a class="moz-txt-link-abbreviated" href="mailto:moller_analysis@jlab.org">moller_analysis@jlab.org</a>
<a class="moz-txt-link-rfc2396E" href="mailto:moller_analysis@jlab.org"><moller_analysis@jlab.org></a>; <a class="moz-txt-link-abbreviated" href="mailto:bryerton@gmail.com">bryerton@gmail.com</a>
<a class="moz-txt-link-rfc2396E" href="mailto:bryerton@gmail.com"><bryerton@gmail.com></a>; <a class="moz-txt-link-abbreviated" href="mailto:moller_intdet@jlab.org">moller_intdet@jlab.org</a>
<a class="moz-txt-link-rfc2396E" href="mailto:moller_intdet@jlab.org"><moller_intdet@jlab.org></a><br>
<b>Subject:</b> [Moller_daq] [EXTERNAL] Question: ADC board
software - Too many files open core dump</font>
<div> </div>
</div>
<div>
<p>Hi everyone,</p>
<p>Sorry if you get this multiple times (I am sending to
several email lists with significant overlap).<br>
</p>
<p>I have an annoying problem. For the PMT testing, I want to
run through a given set of tests for each PMT in one sitting
(DAQ and analysis program running continuously), which
<br>
means starting the ADC DAQ on the computer end once and
(currently - ideally) letting it collect upwards of about
1000 5 second long runs at a time for each PMT. The program<br>
runs fine for about 180 5 second sets and then core dumps
with "Too many open files (src/epoll.cpp:38)".</p>
<p>If you have encountered this problem and figured out how to
solve it (beyond the band aid suggestions given in online
posts), can you please let me know.</p>
<p>Thanks,</p>
<p>Michael <br>
</p>
<p><br>
</p>
<p>Some more details ...</p>
<p><br>
</p>
<p>I am writing both root files and binary files, for the raw
data. The code uses a separate thread to write the root
trees, while it keeps getting data from the ADC board
continuously.
<br>
</p>
<p>The thread that writes the root trees and stores them to
file is started only once and within it, ROOT files are
opened and closed in the same loop. The main process writes<br>
the raw data file and handles the communication with the ADC
board. The raw data files are written in a function that
both opens and closes each file that is being written.<br>
</p>
<p>There are two zmq sockets for communication with the ADC
(control and data) and each is opened and closed for each 5
second data chunk that is being received from the ADC<br>
(each single run).</p>
<p>I scoured forums and various information sources, but most
of posts I find suggest that once needs to increase the
nofile parameter in
<code data-highlighted="yes" class="x_hljs x_language-c">/proc/sys/fs/file-max
</code>
or similar. <br>
I have done that, but it doesn't really change anything. It
just allows me to take more runs, but doesn't solve the
problem.
<br>
</p>
<p>In principle, I should be able to run this indefinitely
(aside from storage space issues).</p>
<p>Of course I could just stop the process and restart
periodically (collecting fewer runs at a time), but I want
to move through a series of PMT voltages in one run series,
with<br>
as little time as possible between changing the HV. <br>
</p>
<p>I have encountered this crash every time I start the
program and run for extended periods of time (1 hour or
more) and it is driving me crazy, because I think the
program is written<br>
such that there should not be "many" open files at a time (I
think maybe at most 5 at any given time).<br>
</p>
<p>The only way around this at the moment is to use a script
that restarts the ADC software end after some number of runs
before this crash occurs. That's okay, but doesn't resolve
<br>
the basic problem.</p>
<p>Somehow I feel like there is either a bug in ZMQ or I am
doing something wrong (likely the latter, but some posts I
found seem to suggest the possibility of the former).</p>
<p>I don't want to throw a bunch of code at you. For now, I am
just wondering if any here has encountered a similar issue
and could guess what the problem is.</p>
<p>If anyone wants to take a look (if you have time), the code
is located here:</p>
<p><a class="x_moz-txt-link-freetext" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_mtgericke_MOLLER-2DIntElec-2DPMTGain-2DMeas&d=DwMDaQ&c=CJqEzB1piLOyyvZjb8YUQw&r=oEOVH2JDjF9X3FqUtWH-nt4bOXao4u2S63djv3IksSA&m=h63pm6kCVRZsJZDv6Qm3IadomS8gZlz-u_jJh_kb06vZdHak21HYvLepNBpUh1Zl&s=LOn7q6CUDdVUcA7WtGX-sjMjpFun4LiiFijDNN2RqTM&e=" moz-do-not-send="true">https://github.com/mtgericke/MOLLER-IntElec-PMTGain-Meas</a></p>
<p>The relevant file is CMData.cxx <br>
</p>
<p>The relevant functions are:</p>
<p>void CMData::StartDataCollection() - file lines 712-733
, 758-781, </p>
<p>void *CMData::GetServerData(void *vargp) - file line 826</p>
<p>void* CMData::FillRootTreeThread(void *vargp) - file lines
1070, 1293</p>
<p>void* CMData::GetSocket(SockType type) - file line 458</p>
<p><br>
</p>
<br>
<p><img alt="" width="1173" height="733" data-outlook-trace="F:1|T:1" src="cid:part1.1tg58uDt.dey26SgK@umanitoba.ca" class=""></p>
</div>
</div>
</blockquote>
</body>
</html>