OMNeT++/OMNEST Bug Tracker - OMNeT++
View Issue Details
0000167OMNeT++runtime / Cmdenvpublic2010-06-04 12:452010-06-11 15:15
jeromerousselot 
andras 
normalminorhave not tried
resolvedfixed 
4.1b4 
4.1 
0000167: simulation stop after executing 100 runs with "Cannot open scalar file" error
This happens with Omnet 4.1 rc2 on Ubuntu 10.04 x64.
I have a [General] configuration with some iteration variables.
The simulation is start with a script that calls opp_run, and I do not specify the number of runs. It should run all of them.
The simulations start, until reaching run 101. At the end of that run, I get:

<!> Error in module (wisemac) sim.host[0].nic.mac (id=20): Cannot open output scalar file `results/General-102.sca'.

Restarting the run specifically with -r 102 leads to a successful execution, and correct file generation. I have 50 GB of free space on that partition.

More interestingly, when trying to run the remaining simulations with -r 102-269, i obtain at run 202:

<!> Error in module (wisemac) sim.host[0].nic.mac (id=20): Cannot open output scalar file `results/General-202.sca'.


I did not try to reproduce this with other modules, so there may be a problem with my code. However, I did not modify this c++ code for some time and it used to work with previous versions of omnet.
No tags attached.
Issue History
2010-06-04 12:45jeromerousselotNew Issue
2010-06-04 13:37jeromerousselotNote Added: 0000309
2010-06-11 13:55andrasNote Added: 0000311
2010-06-11 14:58jeromerousselotNote Added: 0000312
2010-06-11 15:13andrasNote Added: 0000313
2010-06-11 15:15andrasStatusnew => resolved
2010-06-11 15:15andrasFixed in Version => 4.1
2010-06-11 15:15andrasResolutionopen => fixed
2010-06-11 15:15andrasAssigned To => andras

Notes
(0000309)
jeromerousselot   
2010-06-04 13:37   
I ran the exact same simulation on another machine (fedora x64, unknown version) without problem.
This may have something to do with upgrading my local computer from ubuntu 9.10 to 10.04. Previously, I never noticed such a problem.
(0000311)
andras   
2010-06-11 13:55   
We cannot reproduce this. Tried on Windows and on Ubuntu 10.04 32-bit (actually, Kubuntu). Originally I thought that it may be caused by the "max number of open files" limit, but we verified (lsof -p <PID>) that the program only keeps open the current output files (sca,vec,vci,elog).

Have you tried lsof?
(0000312)
jeromerousselot   
2010-06-11 14:58   
It is indeed linked to the number of files open.
I have five hosts in the configuration. If I reduce the number of hosts to 3, I can run 102 simulations without errors.
Besides, when trying lsof, near the end of the 100 runs, I obtain:

lsof -p 29967 | grep xml | wc -l
1011

I use mixim, and mixim loads xml configuration files (2 xml files per host here, so 10 per run). These files are apparently not released at the end of the simulation.

Is this a mixim bug or an omnet++ bug ?

In mixim base/phy/BasePhyLayer.cc:81 we find:

 initializeDecider(readPar("decider", (cXMLElement*)0));

And in the ned file I wrote:

decider = xmldoc("Nic802154_TI_CC2420_Decider.xml");
analogueModels = default(xmldoc("config.xml"));

As I understand it, the file is opened by mixim through the readPar call, and I did not find a method in cXMLElement that would let me close the file.
(0000313)
andras   
2010-06-11 15:13   
Right, it's the XML files! fclose(f) calls were missing from src/nedxml/saxparser_expat.cc and src/nedxml/saxparser_libxml.cc. You can patch it by adding that call at the end of the parse() method in both files (just above the "return".) Fixed in the repo too.

Thanks :)