albertxavier001/gnuplot-cpp

create_tmpfile() exceeds file descriptor limit

Closed this issue · 2 comments

What steps will reproduce the problem?
See bugtest.cpp in the attached archive.

What is the expected output? What do you see instead?
Use the makefile in the attached archive to make bugtest-pass and
bugtest-fail. Running bugtest-pass will show the expected output and
bugtest-fail will show the output resulting from the bug. You may also just
view the contents of bugtest-pass.output and bugtest-fail.output, which are
also included in the archive.

What version of the product are you using? On what operating system?
Version 1.0, released May 2009. Running on Fedora Core 10 Linux with the
2.6.27.41-170.2.117.fc10.x86_64 kernel and GCC version 4.3.2 20081105 (Red
Hat 4.3.2-7)

Please provide any additional information below.
This bug is a result of the fact that the mkstemp() POSIX function call on
line 1921 of gnuplot_i.hpp in the 1.0 version of the product opens the
generated path for reading and writing, but that file descriptor is not
subsequently closed. The Linux operating system limits the number of open
file descriptors each process can have, and therefore, once the product has
opened enough temp files to exceed the limit, it receives a “Too many open
files” error.

It does not appear that the similarly used WIN32 call on line 1919 opens
the file, meaning that this bug should not affect the WIN32 platform. For
details about the POSIX and WIN32 calls, see
http://www.opengroup.org/onlinepubs/009695399/functions/mkstemp.html and
http://msdn.microsoft.com/en-us/library/34wc6k1f(VS.80).aspx respectively.

The attached archive contains the following files:
 * bugtest.cpp
 * bugtest-fail.output
 * bugtest-pass.output
 * gnuplot_i.hpp
 * gnuplot_i.hpp.patch
 * gnuplot_i_fixed.hpp
 * Makefile

The bugtest.cpp file, as discussed above, provides sample code that will
identify the bug.

The bugtest-fail.output contains the expected output of the bugtest-fail
executable.

The bugtest-pass.output contains the expected output of the bugtest-pass
executable.

The gnuplot_i.hpp file contains the 1.0 version of the product.

The gnuplot_i.hpp.patch file contains a patch that fixes the bug.

The gnuplot_i_fixed.hpp file contains the 1.0 version of the product with
the patch applied to fix the bug.

The Makefile can be used to make the bugtest-fail and bugtest-pass
executables that demonstrate the expected and received output, respectively.

Original issue reported on code.google.com by clashe...@gmail.com on 31 Mar 2010 at 9:29

Attachments:

This issue was closed by revision r27.

Original comment by ettl.mar...@gmail.com on 23 Aug 2014 at 8:21

  • Changed state: Fixed
Thank you very much for your very good bug report.

Original comment by ettl.mar...@gmail.com on 23 Aug 2014 at 8:23