Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
 parse description bug
Today, 9:00 pm
By Remcon
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
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, DotBot

Members: 0
Guests: 23
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,237
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » Startup file questions.
Forum Rules | Mark all | Recent Posts

Startup file questions.
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Jun 7, 2013, 8:17 am
Go to the top of the page
Go to the bottom of the page

Krell
Fledgling
GroupMembers
Posts8
JoinedJun 7, 2013

The line "limit stacksize unlimited" in src/startup gives me the error "limit: stacksize: Can't remove limit" when I run ./startup &. However, if I comment that line out the mud runs and I can log in, etc...

My questions are; how safe is it in practice to run the mud without setting the limits of stacksize to unlimited? Is there some sort of hard coded minimum it defaults too? Am I setting myself up for some sort of buffer overrun?

Thanks in advance.
       
Post is unread #2 Jun 7, 2013, 10:46 am
Go to the top of the page
Go to the bottom of the page

Zeno
Sorcerer
GroupMembers
Posts723
JoinedMar 5, 2005

What's your stacksize at in your current environment?
       
Post is unread #3 Jun 7, 2013, 11:25 am   Last edited Jun 7, 2013, 11:35 am by Krell
Go to the top of the page
Go to the bottom of the page

Krell
Fledgling
GroupMembers
Posts8
JoinedJun 7, 2013

Well, from /etc/login.conf for default group processes stacksize is 4 MB. For deamon processes it's 8 MB. That should probably be more than enough for stacksize, particularly when machine memory is actually 8 GB, right?
       
Post is unread #4 Jun 7, 2013, 6:01 pm
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

It's helpful to know what the stack actually gets used for.

A process's stack normally gets used for two different things. First, it's where all function parameters and return addresses are pushed. When you call foo(3, 4, str), the compiler will push the address at which foo() was called, and then the values of 3, 4, and a pointer to str. Then control jumps to function foo(), which will pop the 3 arguments off, execute its code, and then pop the return value as it finishes.

The more nested function calls you have, the deeper the stack. Recursive functions will fill the stack quickly, if they're allowed to iterate uncontrolled.

The other thing they're used for is "temporary" variables. That is, non-static things inside functions. If you declare "int x; char str[512];", you will create two stack entries (pointers) which will live until the function exits.

So, how many things will an 8MB stack hold? If your machine is 64-bit, just divide 8M by 8... so 1 million entries. Double that if you're on a 32-bit machine.

Is that enough? One would hope so.... but if we all know the quality of code in MUD's, so I can't swear to it. :)
       
Post is unread #5 Jun 8, 2013, 6:55 am
Go to the top of the page
Go to the bottom of the page

Krell
Fledgling
GroupMembers
Posts8
JoinedJun 7, 2013

Quixadhal said:


...

So, how many things will an 8MB stack hold? If your machine is 64-bit, just divide 8M by 8... so 1 million entries. Double that if you're on a 32-bit machine.

Is that enough? One would hope so.... but if we all know the quality of code in MUD's, so I can't swear to it. :)


Right, so assuming no really bad memory leaks and the like, 8M should be a sufficient limit. Thanks. :)

Last question, should I explicitly tell the mud the amount of its allowed stacksize rather than just letting the OS handle it, even if the OS does handle it?
       
Post is unread #6 Jun 8, 2013, 11:07 am
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

I'm pretty sure the MUD doesn't have any code that would check or adapt to varying stack sizes, so it's more of a ask for as large of one as possible situation.

The script asks for "unlimited" because, if it has permission to do so, you'll not crash due to stack overflows. IMHO, that's not so great since it means recursions will take longer to bomb out (exhausting main memory).

LIke many things, it may have mattered more in 1992, when machines had 8MB of RAM and the stack size might have been limited to 256K.
       
Post is unread #7 Jun 9, 2013, 10:03 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,863
JoinedJul 26, 2005

I've noticed in cygwin it also has to be commented out lol
       
Pages:<< prev 1 next >>