0

After running a bash fork bomb which made my webserver down, I think I should be more careful even not under root.I thought it would be totally fine while I'm not under root.So I ignored the warning and ran the bash fork bomb which is :() { :|:& }; : .(Please don't run it if u don't understand this code cuz it will make you system down).And I think I need a list of common ways those could cause a sever shutting down unexpectly even not under root.

Any suggestion would be appreciated.

Regards `

2
  • 9
    Clearly, now, we have to add "Letting you manage it" to the list of ways to shut a server down unexpectedly. :-)
    – tvanfosson
    Mar 18, 2010 at 16:10
  • I will remove it soon:)
    – SpawnCxy
    Mar 18, 2010 at 16:15

3 Answers 3

1

If linux runs out of memory resources then it will invoke the 'out of memory' killer.

This will pick (at random) a process to terminate to free up resources. If you system is invoking the oom killer then it really is out of resources, it usual kills processes as a last resort.

This blog post has a good explanation of it

http://prefetch.net/blog/index.php/2009/09/30/how-the-linux-oom-killer-works/

in your case, I think the OOM killer killed your web server process.

You can stop things like fork bombs by setting per process limits.

However, you can just avoid typing in commands that will harm your system into a live server.

That's what virtual machines are for! ;-)

2
  • The "you can stop things like fork bombs by setting per process limits" is the only relevant part of this answer. The rest is irrelevant and misleading in the case of a fork bomb.
    – Jakob Borg
    Mar 20, 2010 at 16:56
  • true, true. ulimit -u 128 will do the trick. Mar 20, 2010 at 21:01
1

You probably used up your RAM while running the fork bomb and then the webserver tried to allocate some memory. As no memory was available malloc() or alike returned a NULL-pointer which wasn't checked correctly in the code resulting in trying to read/write a memory block the program had no access to. Therefore the OS Kernel killed the program.

When a webserver or any other service shuts down unexpectedly its most commonly a bug in the software. Either used via remote to use a security hole or locally as in your case.

2
  • 1
    Do you not get how a "fork bomb" works? See en.wikipedia.org/wiki/Fork_bomb. Running a program out of memory generally won't bring down the system -- running the kernel out of resources or corrupting kernel data structures, now that's how to crash a system (or at least bring it to its knees).
    – tvanfosson
    Mar 18, 2010 at 16:31
  • you should always check for error's on every system call that you make, it's just good practise. Just because your asking for resources doesn't mean your going to them! Mar 18, 2010 at 22:28
1

A large enough tar bomb may do the trick. Though that's generally more malicious than user error.

Not the answer you're looking for? Browse other questions tagged .