{"id":29,"date":"2011-11-29T14:10:59","date_gmt":"2011-11-29T19:10:59","guid":{"rendered":"http:\/\/www.certif.com\/wordpress\/?p=29"},"modified":"2011-12-09T02:13:47","modified_gmt":"2011-12-09T07:13:47","slug":"too_many_open_files","status":"publish","type":"post","link":"https:\/\/www.certif.com\/wordpress\/too_many_open_files\/","title":{"rendered":"I get the message in spec &#8220;Too many open files&#8221; What does it mean?"},"content":{"rendered":"<p>To write data to a file the unix system needs to open the file first. Once you have finished writing to that file unix will close it. In <strong>spec<\/strong>, as in unix, files will be opened the first time they are used and kept opened until a close instruction is executed. Nevertheless <strong>spec<\/strong> will control with the instructions <code>on()<\/code> and <code>off()<\/code> the actual output to files, while keeping them opened. This is to reduce the overhead when you are repeatedly switching writing data to a file, like while running a scan.<\/p>\n<p>To see the list of files currently opened and their output status, type <code>open()<\/code> in <strong>spec<\/strong>:<\/p>\n<pre>11.SPEC&gt; open()\r\n\"tty\" is on.\r\n\"null\" is off.\r\n\"spec.dat\" (path = \"\/Users\/specadm\/data\/spec.dat\") is off.\r\n\"another_file.dat\" (path = \"\/Users\/specadm\/data\/another_file.dat\") is on.<\/pre>\n<p>If macros stop writing to a file, they must <code>close()<\/code> that file. Otherwise output to the file may be off but the file descriptor still be opened.<\/p>\n<p>There is a limit as how many files can be opened at any time by a unix process. <strong>spec<\/strong> will stop you from opening a new file when that limit is reached.<\/p>\n<h2>Solution<\/h2>\n<p>Standard macros will carefully <code>open()<\/code> and <code>close()<\/code> files as necessary.\u00a0 This error is often related with the handling of files by a user macro.<\/p>\n<p>To solve the problem get the list of opened files by typing <code>open()<\/code>. Then you can easily identify which files are causing the problem.\u00a0 You can \u00a0close those files by calling <code>close(filename)<\/code>. Eventually, correct the macro to make sure that files are closed when they are not needed anymore.<\/p>\n<h2>See also<\/h2>\n<p><a href=\"..\/spec_help\/files.html\">help files<\/a><br \/>\n<a href=\"..\/spec_help\/newfile.html\">help newfile<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>To write data to a file the unix system needs to open the file first. Once you have finished writing to that file unix will close it. In spec, as in unix, files will be opened the first time they are used and kept opened until a close instruction is executed. Nevertheless spec will control &hellip; <\/p>\n<p><a class=\"more-link block-button\" href=\"https:\/\/www.certif.com\/wordpress\/too_many_open_files\/\">Continue reading &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18,22],"tags":[21],"_links":{"self":[{"href":"https:\/\/www.certif.com\/wordpress\/wp-json\/wp\/v2\/posts\/29"}],"collection":[{"href":"https:\/\/www.certif.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.certif.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.certif.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.certif.com\/wordpress\/wp-json\/wp\/v2\/comments?post=29"}],"version-history":[{"count":12,"href":"https:\/\/www.certif.com\/wordpress\/wp-json\/wp\/v2\/posts\/29\/revisions"}],"predecessor-version":[{"id":52,"href":"https:\/\/www.certif.com\/wordpress\/wp-json\/wp\/v2\/posts\/29\/revisions\/52"}],"wp:attachment":[{"href":"https:\/\/www.certif.com\/wordpress\/wp-json\/wp\/v2\/media?parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.certif.com\/wordpress\/wp-json\/wp\/v2\/categories?post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.certif.com\/wordpress\/wp-json\/wp\/v2\/tags?post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}