Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ Block Size Rapidly Increases
Block Size Rapidly Increases
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Gatz
(17 posts) Bio
|
Date
| Tue 20 Sep 2005 03:43 AM (UTC) Amended on Tue 20 Sep 2005 03:53 AM (UTC) by Gatz
|
Message
| I'm running an SWR MUD and notice over time the blocks used increases. In the course of about 4 days it reached about 50k over what it normally is. I did a reboot and it dropped. I'm not exactly sure what the issue is. Is this tied to memory leaks or what? My SMAUG FUSS one doesn't do this, so I assume it is tied to something buggy in the code. (It is basically a heavily modified SWR 1.0).
[Edit: Figured I might aswell say I've notice this for awhile, so it isn't a brand new occurance.] |
Owner of NarutoMUD, a fun and fast paced Naruto MUD!
Check it out at: http://narutofor.us/ today! | Top |
|
Posted by
| Gohan_TheDragonball
USA (183 posts) Bio
|
Date
| Reply #1 on Tue 20 Sep 2005 06:08 AM (UTC) |
Message
| This is a persistent problem caused by the smaug file input/output system. Basically files are being opened by your mud and not being closed when their use is done. The same file is eventually opened again, especially if you are using COPYOVER/HOTBOOT. I have the same problem with my mud, though I never noticed it before until I went to Wolfpaw.com for my server, as my previous servers did not count files open in memory as part of my disk usage.
One thing you can try is looking for every instance of fopen() and making sure the file is closed once its use it done. Make sure to fully backup your entire source code, and work in small phases, continually remaking and restarting to make sure you have not done something wrong. On my mud I redid around 20 of these at once and I did something wrong and had no idea which fix I had done caused the problem, and had to reinstate a backup and start again. | Top |
|
Posted by
| Greven
Canada (835 posts) Bio
|
Date
| Reply #2 on Tue 20 Sep 2005 08:53 PM (UTC) |
Message
| Dunno if this is FUSS or not, but one of the worst offenders of this is in db.c, show_file. Replace your whole function with this:
void show_file( CHAR_DATA * ch, char *filename )
{
FILE *fp;
char buf[MAX_STRING_LENGTH];
int c;
int num = 0;
if( ( fp = fopen( filename, "r" ) ) != NULL )
{
while( !feof( fp ) )
{
while( ( buf[num] = fgetc( fp ) ) != EOF
&& buf[num] != '\n' && buf[num] != '\r' && num < ( MAX_STRING_LENGTH - 2 ) )
num++;
c = fgetc( fp );
if( ( c != '\n' && c != '\r' ) || c == buf[num] )
ungetc( c, fp );
buf[num++] = '\n';
buf[num++] = '\r';
buf[num] = '\0';
send_to_pager( buf, ch );
num = 0;
}
fclose( fp );
}
}
Basicly just add the fclose to the botton of the function. |
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | Top |
|
Posted by
| Samson
USA (683 posts) Bio
|
Date
| Reply #3 on Wed 21 Sep 2005 12:12 PM (UTC) |
Message
| Yes, that bug was fixed a long time ago.
You can get a look at what your mud has open by typing:
ls -l /proc/<pid#>/fd
where pid# is the process number for your mud's executable. The listing should show you any open files that are dangling and any sockets that may be open at the moment. | Top |
|
Posted by
| Greven
Canada (835 posts) Bio
|
Date
| Reply #4 on Wed 21 Sep 2005 09:18 PM (UTC) |
Message
| If you just want to count how many are open, I took this from a post from bobarak a long time ago
void do_fdcheck(CHAR_DATA * ch, char *argument)
{
struct stat fs;
int i, j = 0;
argument = NULL;
send_to_char("FD's in use:\n\r", ch);
for (i = 0; i < 256; ++i)
if (!fstat(i, &fs))
{
ch_printf(ch, "%03d ", i);
if (!(++j % 15))
send_to_char("\n\r", ch);
}
if (j % 15)
send_to_char("\n\r", ch);
ch_printf(ch, "%d descriptors in use.\n\r", j);
return;
}
|
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
18,217 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top