Lighttpd Crashes on my VPS. Any Clues?

Discussion in 'Site & Server Administration' started by Jezz, Sep 13, 2008.

  1. #1
    Hello, Linux noob here :eek:

    I'm having a problem with my VPS, Lighttpd crashes and all sites get a 500 internal server error
    until I restart this service.

    It's got a HyperVM/Lxadmin control panel, And Xcache is enabled.
    When I checked Qos everthing was within limits except for this:

    
    Description     Current Used 	Maximum Held 	Barrier 	Limit		Fail Count 
    
    privvmpages  	 27417  	 92241  	 83200  	 83200		1544
    
    Code (markup):
    what are privvmpages? I know it's to do with ram, but...

    Anyhow the last bit of my Lighttpd error log is:

    
    2008-09-13 20:25:25: (response.c.537) file not found ... or so:  Too many open files /index.html ->  
    2008-09-13 20:25:41: (mod_indexfile.c.180) file not found ... or so:  Too many open files / -> /home/admin/****.net/ 
    2008-09-13 20:25:44: (mod_indexfile.c.180) file not found ... or so:  Too many open files / -> /home/admin/****.net/ 
    2008-09-13 20:28:37: (response.c.537) file not found ... or so:  Too many open files /index.html ->  
    2008-09-13 20:31:05: (response.c.537) file not found ... or so:  Too many open files /robots.txt ->  
    2008-09-13 20:31:05: (mod_indexfile.c.180) file not found ... or so:  Too many open files / -> /home/admin/****.net/ 
    2008-09-13 20:31:10: (mod_indexfile.c.180) file not found ... or so:  Too many open files / -> /home/admin/****.net/ 
    2008-09-13 20:31:45: (mod_indexfile.c.180) file not found ... or so:  Too many open files / -> /home/admin/****.net/ 
    2008-09-13 20:33:16: (mod_cgi.c.584) cgi died, pid: 12160 
    2008-09-13 20:33:16: (mod_cgi.c.1231) cgi died ? 
    2008-09-13 20:33:16: (mod_cgi.c.1231) cgi died ? 
    2008-09-13 20:33:16: (mod_cgi.c.1231) cgi died ? 
    2008-09-13 20:33:16: (mod_cgi.c.1231) cgi died ? 
    
    Code (markup):
    Any ideas? or does anybody know where I can find some info on these error codes?
    Thanks in Advance.
     
    Jezz, Sep 13, 2008 IP
  2. pcsmart

    pcsmart Active Member

    Messages:
    93
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    58
    #2
    "Too many open files", you could me hitting some limits.

    Can you paste the whole output of cat /proc/user_beancounters
     
    pcsmart, Sep 13, 2008 IP
  3. Jezz

    Jezz Active Member

    Messages:
    208
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Just seems to be hitting the privvmpages limit.
    what are privvmpages?

    
    	     resource           held    maxheld    barrier      limit    failcnt
    	     kmemsize        2550282   12249561 2147483646 2147483646          0
                lockedpages           0          0       1000       1000          0
                privvmpages       40859      92241      83200      83200       1544
                shmpages              0        656      65536      65536          0
                dummy                 0          0          0          0          0
                numproc              34        190       1000       1000          0
                physpages         37036      72159          0 2147483647          0
                vmguarpages           0          0      65536 2147483647          0
                oomguarpages      37036      72159      65536 2147483647          0
                numtcpsock           20        208       8000       8000          0
                numflock              2         45       1000       1000          0
                numpty                0          1        500        500          0
                numsiginfo            0          5       1000       1000          0
                tcpsndbuf        357760    2323204   53687296   86455296          0
                tcprcvbuf        327680    4545984   53687296   86455296          0
                othersockbuf      17188     221808   53687296   86455296          0
                dgramrcvbuf           0      29800   53687296   86455296          0
                numothersock         14         37       8000       8000          0
                dcachesize            0          0    9216000    9216000          0
                numfile            1466       6809      24000      24000          0
                dummy                 0          0          0          0          0
                dummy                 0          0          0          0          0
                dummy                 0          0          0          0          0
                numiptent            10         10       1000       1000          0
    
    Code (markup):
     
    Jezz, Sep 13, 2008 IP
  4. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #4
    jayshah, Sep 13, 2008 IP
    Jezz likes this.
  5. pcsmart

    pcsmart Active Member

    Messages:
    93
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    58
    #5
    You are running out of RAM. Basically you are using your burst ram, and the kernel is killing off your processes in that RAM in order to free it up for other users.

    Burst ram is only really there for load spikes.

    oomguarpages is your "Guaranteed" ram which is always available

    privvmpages is your "Burst" ram, which is there if there is free ram on the node, and it's not needed by other users.

    99% of the time burst ram is twice that of the guaranteed ram.

    Perhaps if you can show us the output of ps aux we can help identify what's using all your ram up
     
    pcsmart, Sep 13, 2008 IP
  6. Jezz

    Jezz Active Member

    Messages:
    208
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #6
    Thanks for your help guys :)
    So... I should just order more ram?

    Where do I find ps aux? and is any of this sensitive info?
    (I'm looking for it now)
     
    Jezz, Sep 13, 2008 IP
  7. pcsmart

    pcsmart Active Member

    Messages:
    93
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    58
    #7
    Just type in "ps aux" into SSH, its a command which will output all of the processes currently running.

    You probably will need more RAM But it may be something in particular which is chewing all of your RAM up.
     
    pcsmart, Sep 13, 2008 IP
    Jezz likes this.
  8. Jezz

    Jezz Active Member

    Messages:
    208
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #8
    Yeah proxy sites, lol :eek:

    Thanks heaps for your help. I'll talk with my host about some more ram.
    Also.. my VPS has no swap partition so I'll ask about this as well.
    I really appreciate your help with this. Thanks again!
    Rep added! :D
     
    Jezz, Sep 13, 2008 IP
  9. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #9
    You can actually make the swap yourself, if they say no ;) Just thought you should know :)

    Edit: Thanks for the reputation :D

    Jay
     
    jayshah, Sep 13, 2008 IP
  10. Jezz

    Jezz Active Member

    Messages:
    208
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #10
    Ok.. couldn't help asking, lol
    How do I allocate my own swap partition?
    (I'm not going to do it, I'm just curious)
    Is there a reason why my host would not have given me one?
    I mean... I figure the least amount of disk writes on the server the better.
    So this would be for server optimization?
     
    Jezz, Sep 13, 2008 IP
  11. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #11
    jayshah, Sep 13, 2008 IP
  12. Jezz

    Jezz Active Member

    Messages:
    208
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #12
    I'll just have to ask them.
    Thanks again Jay :D
     
    Jezz, Sep 13, 2008 IP
  13. pcsmart

    pcsmart Active Member

    Messages:
    93
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    58
    #13
    With OpenVZ you basically get "Burst" ram instead of swap. The idea behind it is that burst ram is available for spikes etc when you need more than your guaranteed ram. As anyone knows, RAM is MUCH faster than Hard Disk.

    There is technically nothing wrong with manually creating a swapfile in your VPS, however your VPS will only really use it when you start to use up the burst ram as well. So technically you don't really gain anything by creating one.

    You could ask your host to disable burst ram, and then your swap file would be used when you exceed your huaranteed ram (like a dedicated server or a Xen based VPS), so that gives you stability if you exceed your allocated RAM, but it gets a bit slower. However if you use up your Burst ram, the kernel will kill off your processes after a while for someone else to use, which is why you have been having instability issues.

    Thanks for the rep :)

    HTH

    Chris
     
    pcsmart, Sep 13, 2008 IP
  14. Jezz

    Jezz Active Member

    Messages:
    208
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #14
    Thanks for explaining all that to me Chris :)
    I have more RAM related questions, mainly on what is normal usage between XEN Vs OpenVS (I have both VPS's at the moment)
    But I think I should ask about this in a new thread. :cool:
     
    Jezz, Sep 13, 2008 IP
  15. agnivo007

    agnivo007 Peon

    Messages:
    4,290
    Likes Received:
    289
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Personally, I don't think lighttpd+fcgi for dynamic sites, php etc. with lots of connections is a good solution. It simply doesnt work.
    I switched back to apache on a dedi for proxy sites from lighty and works fine till date.
     
    agnivo007, Sep 13, 2008 IP
  16. Jezz

    Jezz Active Member

    Messages:
    208
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #16
    Thanks agnivo007, would you might taking a look Here And letting me know what you think about this?
    I've got a VPS with apache as well, but that is using heaps of ram even when it's idle.
     
    Jezz, Sep 13, 2008 IP
  17. agnivo007

    agnivo007 Peon

    Messages:
    4,290
    Likes Received:
    289
    Best Answers:
    0
    Trophy Points:
    0
    #17
    What would you expect from a VPS with less than 256MB guaranteed RAM? Sub 256MB VPSs are good for developing or testing etc. not for production in any sense. I personally won't take any VPS less than 512MB ram to run apache serving websites with traffic.

    Unlike lighty, apache is multi-process app. that makes it hog more memory even in idling state. But a little fine tuning and optimization can make apache run nicely.
     
    agnivo007, Sep 16, 2008 IP
  18. Jezz

    Jezz Active Member

    Messages:
    208
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #18
    That's just it! I didn't really know what to expect.
    This machine is not sub 256mb though.
    Hmm... I just didn't think apache would hog that much ram.
     
    Jezz, Sep 16, 2008 IP