Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Yandex, Bing

Members: 0
Guests: 9
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SWR FUSS » Too Many Open Files
Forum Rules | Mark all | Recent Posts

Too Many Open Files
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Feb 28, 2010, 6:43 am
Go to the top of the page
Go to the bottom of the page

Banner
Magician
GroupMembers
Posts169
JoinedNov 29, 2005

After hotbooting exactly four times, I receive this error. I've never received it before so I believe it may have something to do with something I changed involving loading from files.

Sun Feb 28 09:39:34 2010 ::  Done Structures 
Sun Feb 28 09:39:34 2010 :: Loading Accessory Data
Sun Feb 28 09:39:34 2010 :: [*****] BUG: Cannot open ../structures/accessory.dat
Sun Feb 28 09:39:34 2010 :: Done Accessories
Sun Feb 28 09:39:34 2010 :: Loading Realty Data
Sun Feb 28 09:39:34 2010 :: [*****] BUG: Cannot open ../structures/realty.dat
Sun Feb 28 09:39:34 2010 :: Done Realties
Sun Feb 28 09:39:34 2010 :: Done loading Structure Data.
Sun Feb 28 09:39:34 2010 :: Loading Player Memory Module.
Sun Feb 28 09:39:34 2010 :: [*****] BUG: Cannot open ../system/memory.dat
Sun Feb 28 09:39:34 2010 :: Reading in Vendors
Sun Feb 28 09:39:34 2010 :: [*****] BUG: Load_vendors: can't open VENDOR_DIR
../vendor/: Too many open files
Sun Feb 28 09:39:34 2010 :: Loading Hall of Fame
Unable to open hall of fame file: Too many open files
Sun Feb 28 09:39:34 2010 :: Resetting variables
Sun Feb 28 09:39:34 2010 :: Initializing socket
Sun Feb 28 09:39:34 2010 :: &wStar Wars: Galactic Insights v4.0 is ready to rock and roll at mud.swgi.org on port 4000.&W
Sun Feb 28 09:39:34 2010 :: Initiating hotboot recovery.
hotboot_recover: fopen: Too many open files
Sun Feb 28 09:39:34 2010 :: [*****] BUG: Hotboot file not found. Exitting.

Program exited with code 01.
(gdb) bt
No stack.
       
Post is unread #2 Feb 28, 2010, 7:24 am   Last edited Feb 28, 2010, 7:25 am by Caius
Go to the top of the page
Go to the bottom of the page

Caius
Magician
GroupMembers
Posts132
JoinedJan 29, 2006

Sounds to me that you're opening a whole bunch of files somewhere without closing them. If I remember correctly a Linux OS typically allow up to 1024 files being open at once per process. Hitting such a number could suggest that you open files in a loop somewhere without closing them.

Only thing I can think of.

Oh, and did you get those other bugs as well before? I mean the "Cannot open ../structures/realty.dat" ones.
       
Post is unread #3 Feb 28, 2010, 8:13 am   Last edited Feb 28, 2010, 8:18 am by Banner
Go to the top of the page
Go to the bottom of the page

Banner
Magician
GroupMembers
Posts169
JoinedNov 29, 2005

As stated, I've never received this error before. I guess all that remains is to go through the code and find where someone hasn't closed a file.

EDIT: 200+ structure files were being opened and not closed. Modifying the code rectified the problem. Caius, do you know if there is a way to print the number of files currently open via gdb or possibly another command in the shell?
       
Post is unread #4 Feb 28, 2010, 8:30 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
JoinedJul 26, 2005

There is a way to see what you have open in linux, It has been awhile so I don't recall the full path to see all the stuff open for the process. I'm sure it has been posted around somewhere though. If I get a chance later I'll look and see if I can find it.
       
Post is unread #5 Feb 28, 2010, 8:36 am
Go to the top of the page
Go to the bottom of the page

Banner
Magician
GroupMembers
Posts169
JoinedNov 29, 2005


Remcon said:

There is a way to see what you have open in linux, It has been awhile so I don't recall the full path to see all the stuff open for the process. I'm sure it has been posted around somewhere though. If I get a chance later I'll look and see if I can find it.


I found this link, but rather or not it is relevant is unclear. My system claims 52,960 files and I doubt I could have possibly reached that since 1024 sounds more reasonable, taking into consideration 220 files and being opened with four hotboots.
       
Post is unread #6 Feb 28, 2010, 8:48 am
Go to the top of the page
Go to the bottom of the page

Keberus
Conjurer
GroupFUSS Project Team
Posts341
JoinedJun 4, 2005

You might want to check out this snippet. It's one that was written by Darien and modified by me, but basically it's a fopen/fclose tracker. It's pretty easy to implement if you have access to anything like VS where you can do a find and replace in all files of the fopen/fclose calls.
       
Post is unread #7 Feb 28, 2010, 9:36 am   Last edited Feb 28, 2010, 10:36 am by Banner
Go to the top of the page
Go to the bottom of the page

Banner
Magician
GroupMembers
Posts169
JoinedNov 29, 2005

Keberus said:

You might want to check out this snippet. It's one that was written by Darien and modified by me, but basically it's a fopen/fclose tracker. It's pretty easy to implement if you have access to anything like VS where you can do a find and replace in all files of the fopen/fclose calls.
That looks promising. I will implement that and see what turns up. Thanks for the link.

EDIT: Removing any reference to a close or open of fpReserve in any random file causes the MUD to fail to boot.

#24 0x081587c9 in __FileOpen (filename=0xbf561180 "../system/time.dat", mode=0x82ce746 "r", file=0x82b1ce3 "filehandler.cpp", function=0x82b1d1a "__FileOpen", line=28)
    at filehandler.cpp:28
#25 0x081587c9 in __FileOpen (filename=0xbf5612b0 "../system/time.dat", mode=0x82ce746 "r", file=0x82b1ce3 "filehandler.cpp", function=0x82b1d1a "__FileOpen", line=28)
    at filehandler.cpp:28
#26 0x081587c9 in __FileOpen (filename=0xbf5613e0 "../system/time.dat", mode=0x82ce746 "r", file=0x82b1ce3 "filehandler.cpp", function=0x82b1d1a "__FileOpen", line=28)
    at filehandler.cpp:28
#27 0x081587c9 in __FileOpen (filename=0xbf561510 "../system/time.dat", mode=0x82ce746 "r", file=0x82b1ce3 "filehandler.cpp", function=0x82b1d1a "__FileOpen", line=28)
    at filehandler.cpp:28
#28 0x081587c9 in __FileOpen (filename=0xbf561640 "../system/time.dat", mode=0x82ce746 "r", file=0x82b1ce3 "filehandler.cpp", function=0x82b1d1a "__FileOpen", line=28)
---Type <return> to continue, or q <return> to quit---q
 at filehanQuit
(gdb) list
126     void do_note args( ( CHAR_DATA * ch, char *arg_passed, bool IS_MAIL ) );
127     int num_changes args( ( void ) );
128     bool chk_watch( short player_level, const char *player_name, const char *player_site );
129
130
131     int main( int argc, char **argv )
132     {
133     //   struct timeval now_time;
134        time_t now;
135        bool fCopyOver = FALSE;
(gdb) frame 28
#28 0x081587c9 in __FileOpen (filename=0xbf561640 "../system/time.dat", mode=0x82ce746 "r", file=0x82b1ce3 "filehandler.cpp", function=0x82b1d1a "__FileOpen", line=28)
    at filehandler.cpp:28
28          if( ( fp = FileOpen( fbuf, mode ) ) == NULL )
(gdb) list
23          if( strstr( mode, "w" ) )
24              snprintf( fbuf, 256, "%s.temporary", filename );
25          else
26              snprintf( fbuf, 256, "%s", filename );
27
28          if( ( fp = FileOpen( fbuf, mode ) ) == NULL )
29          {
30              perror( fbuf );
31              return NULL;
32          }
(gdb) print fbuf
$1 = "../system/time.dat\000¿R\026V¿?\027V¿@\026V¿?\027V¿", '\0' <repeats 40 times>, "\022\000\000\000Q\034+\bP\034+\b", '\0' <repeats 16 times>, "ÿÿÿÿ", '\0' <repeats 40 times>, "@Iá·", '\0' <repeats 14 times>, " s", '\0' <repeats 12 times>, "\023>Ô·", '\0' <repeats 12 times>, "Ä\034V¿\000\000\000\000ôOá·R\034+\b\224<Ô·\f\034V¿Ç\216Ñ·ôOá· \231&\b V\a\b\030\026V¿b!Ò·@\026V¿\000\001\000\000P\034+\b"
(gdb) print filename
$2 = 0xbf561640 "../system/time.dat"



swgi@swgi:~/swgi/src$ grep fpRe *
comm.cpp:FILE *fpReserve;  /* Reserved file handle    */
comm.cpp:   if( ( fpReserve = FileOpen( NULL_FILE, "r" ) ) == NULL )
mud.h:extern FILE *fpReserve;
Binary file swgi matches
swgi@swgi:~/swgi/src$

occ 1:
FILE *fpReserve;  /* Reserved file handle    */



occ 2:
   init_pfile_scan_time(  );  /* Pfile autocleanup initializer - Samson 5-8-99 */

   /*
    * Reserve two channels for our use.                 
    */              
   if( ( fpReserve = FileOpen( NULL_FILE, "r" ) ) == NULL )
   {
      perror( NULL_FILE );
      exit( 1 );     
   }
   if( ( fpLOG = FileOpen( NULL_FILE, "r" ) ) == NULL )
   {
      perror( NULL_FILE );  
      exit( 1 );         
   }

    /*
     * Get the port number.
     */
       
Post is unread #8 Feb 28, 2010, 7:45 pm
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008


Banner said:


Remcon said:

There is a way to see what you have open in linux, It has been awhile so I don't recall the full path to see all the stuff open for the process. I'm sure it has been posted around somewhere though. If I get a chance later I'll look and see if I can find it.


I found this link, but rather or not it is relevant is unclear. My system claims 52,960 files and I doubt I could have possibly reached that since 1024 sounds more reasonable, taking into consideration 220 files and being opened with four hotboots.


You many want to try lsof -u <your user name here>
If you want an easy to read count of exactly how many open files do a lsof -u <user name> | wc -l

That will show all open files by your user account.
Your system claims that it can handle a TOTAL of 52,960 (Linux default) if your following the cat /proc/sys/fs/file-max.

Note, not all Linux systems have lsof installed.

Hope this helps some,
ayuri
       
Pages:<< prev 1 next >>