Too Many Open Files
< Newer Topic
:: Older Topic >
Pages:<< prev 1 next >>
#1 Feb 28, 2010 8:43 am
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.
#2 Feb 28, 2010 9:24 am
Last edited Feb 28, 2010 9:25 am by 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.
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.
#3 Feb 28, 2010 10:13 am
Last edited Feb 28, 2010 10:18 am by 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?
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?
#4 Feb 28, 2010 10:30 am
Geomancer
GroupAdministrators
Posts1,946
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.
#5 Feb 28, 2010 10:36 am
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.
#6 Feb 28, 2010 10:48 am
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.
#7 Feb 28, 2010 11:36 am
Last edited Feb 28, 2010 12:36 pm by Banner
Magician
GroupMembers
Posts169
JoinedNov 29, 2005
Keberus said:That looks promising. I will implement that and see what turns up. Thanks for the link.
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.
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) ---Typeto continue, or q 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' , "\022\000\000\000Q\034+\bP\034+\b", '\0' , "ÿÿÿÿ", '\0' , "@Iá·", '\0' , " s", '\0' , "\023>Ô·", '\0' , "Ä\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. */
#8 Feb 28, 2010 9:45 pm
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
If you want an easy to read count of exactly how many open files do a lsof -u
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 >>