DaemonForums  

Go Back   DaemonForums > NetBSD > NetBSD General

NetBSD General Other questions regarding NetBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 3rd June 2008
fenrisW0lf fenrisW0lf is offline
Port Guard
 
Join Date: May 2008
Posts: 17
Default pagedaemon 100% cpu usage

Hi all,

I am having a bit of trouble with apache and php 5 (Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.8e DAV/2 SVN/1.4.6 PHP/5.2.6). I have SVN running over apache and I can commit and update changes without any issue. I have mercurial setup over apache and can sync with remote repositories no problem.

I can run
Code:
<?php
phpinfo();
?>
in a php file and get the configuration back without any problems...


I am pretty sure I have enough free space...
Code:
#df -i
Filesystem  512-blocks      Used     Avail Capacity  iused    ifree  %iused  Mounted on
/dev/wd0a     78544440   6075320  68541900     8%   188037  4696441     3%   /
kernfs               2         2         0   100%      896      128    87%   /kern
If I try to launch dokuwiki, the server locks up. I tried running top to see what was going on and it looks like pagedaemon is hogging the cpu. Is there something that I am doing wrong? Once this process starts to hog the cpu I can't seem to shut it down it locks out my ssh session and I am forced to hard reboot the server.


Code:
#top
load averages:  9.77,  8.53,  5.52                             up 0 days,  1:01   20:22:43
48 processes:  5 runnable, 42 sleeping, 1 on processor
CPU states:  0.0% user,  0.0% nice, 99.4% system,  0.6% interrupt,  0.0% idle
Memory: 150M Act, 73M Inact, 384K Wired, 5204K Exec, 11M File, 20K Free
Swap: 129M Total, 129M Used, 8K Free

  PID USERNAME PRI NICE   SIZE   RES STATE      TIME   WCPU    CPU COMMAND
   10 root     -18    0     0K   16M pgdaemon  11:10 99.02% 99.02% [pagedaemon]
  817 www       28    0    50M   12M RUN        0:01  0.00%  0.00% httpd
  172 www       -5    0    50M   11M biowait    0:01  0.00%  0.00% httpd
  170 www       -5    0    50M 8816K biowait    0:01  0.00%  0.00% httpd
   12 root     -18    0     0K   16M aiodoned   0:01  0.00%  0.00% [aiodoned]
15679 root      28    0   188K  404K CPU        0:00  0.00%  0.00% top
  796 www       28    0    50M   14M RUN        0:00  0.00%  0.00% httpd
17953 www       28    0    50M 6532K RUN        0:00  0.00%  0.00% httpd
28765 root      28    0    24K  128K RUN        0:00  0.00%  0.00% atrun
  222 root      28    0   180K   80K RUN        0:00  0.00%  0.00% syslogd
   11 root      18    0     0K   16M syncer     0:00  0.00%  0.00% [ioflush]
  792 root      18    0   228K    4K pause      0:00  0.00%  0.00% <csh>
  787 troy.wil  18    0   228K    4K pause      0:00  0.00%  0.00% <csh>
    9 root      14    0     0K   16M crypto_w   0:00  0.00%  0.00% [cryptoret]
    6 root      10    0     0K   16M usbtsk     0:00  0.00%  0.00% [usbtask-hc]
    5 root      10    0     0K   16M usbevt     0:00  0.00%  0.00% [usb0]
    8 root      10    0     0K   16M usbevt     0:00  0.00%  0.00% [usb1]
    7 root      10    0     0K   16M usbtsk     0:00  0.00%  0.00% [usbtask-dr]
  755 root      10    0   248K    4K nanoslee   0:00  0.00%  0.00% <cron>
 3700 root      10    0   144K    4K wait       0:00  0.00%  0.00% <sh>
    1 root      10    0   100K    4K wait       0:00  0.00%  0.00% <init>
  103 root       3    0    56K    4K ttyin      0:00  0.00%  0.00% <getty>
  105 root       3    0    56K    4K ttyin      0:00  0.00%  0.00% <getty>
Reply With Quote
  #2   (View Single Post)  
Old 3rd June 2008
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

pagedaemon is a kernel task, you can't kill it.. I honestly don't know why it's consuming so much processor time though.

Very odd indeed..
Reply With Quote
  #3   (View Single Post)  
Old 3rd June 2008
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 3,318
Default

Quote:
Originally Posted by fenrisW0lf View Post
I am pretty sure I have enough free space...
Disk space doesn't appear to be the problem.
Quote:
Code:
#top
load averages:  9.77,  8.53,  5.52                             up 0 days,  1:01   20:22:43
48 processes:  5 runnable, 42 sleeping, 1 on processor
CPU states:  0.0% user,  0.0% nice, 99.4% system,  0.6% interrupt,  0.0% idle
Memory: 150M Act, 73M Inact, 384K Wired, 5204K Exec, 11M File, 20K Free
Swap: 129M Total, 129M Used, 8K Free
How much memory is on this system? Is your top(1) output indicating thrashing?
Reply With Quote
  #4   (View Single Post)  
Old 3rd June 2008
richardpl richardpl is offline
Spam Deminer
 
Join Date: May 2008
Location: Croatia
Posts: 284
Default

Quote:
Originally Posted by ocicat View Post
Disk space doesn't appear to be the problem.

How much memory is on this system? Is your top(1) output indicating thrashing?
That is tipical out of memory problem. Process try to get more memory but fails and than waits in loop, and if lucky will get killed by kernel or if very very unlucky system will panic. In this cases its trying to use swap as real memory - no way - reason why everythings become slow and kernel spends most times allocating free swap bytes from hard disk ....

Solution: Buy more RAM - it is cheap, and forget using swap as memory.
Reply With Quote
  #5   (View Single Post)  
Old 3rd June 2008
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 3,318
Default

Quote:
Originally Posted by richardpl View Post
That is tipical out of memory problem.
Yes, the question was rhetorical, but it was time for the OP to come back with more information.

Given that swap has been exhausted, 42 processes are sleeping, the CPU is being chewed up in system clerical stuff, load averages are going through the roof, it appears to be classic OS thrashing. Given all the httpd instances, it will be interesting to hear whether the OP is doing Web server virtualization stuff or merely getting pounded by outside requests.
Reply With Quote
  #6   (View Single Post)  
Old 3rd June 2008
fenrisW0lf fenrisW0lf is offline
Port Guard
 
Join Date: May 2008
Posts: 17
Default

Hi all, thanks for the replies.

The system is a p4 1.4GHz with 128mb or ram. Everything was working OK till I upgraded from 3.1 to 4.0 (I did a full install after trying an upgrade with no luck). In the full install I copied the configuration files over for apache (httpd.conf) from the old version.

The odd thing is there should be no load on this server at all except for me as this is a test box that I use before doing anything with my production box (even my production box is only used by a small team of developers, 5 people at most). In addition I used to have a very similar setup on an ancient amdk6-2 400mhz system with 64mb of ram without any problems.

Here is the result of top when I don't access the dokuwiki site located on the server. It looks as though swap isn't being used.
Code:
load averages:  0.00,  0.00,  0.00                  up 0 days, 11:41   08:07:46
39 processes:  38 sleeping, 1 on processor
CPU states:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
Memory: 28M Act, 568K Wired, 8220K Exec, 10M File, 156M Free
Swap: 129M Total, 129M Free

  PID USERNAME PRI NICE   SIZE   RES STATE      TIME   WCPU    CPU COMMAND
   11 root      18    0     0K   16M syncer     0:03  0.00%  0.00% [ioflush]
 1635 root      28    0   184K 1064K CPU        0:00  0.00%  0.00% top
 2961 troy.wil  18    0   228K  992K pause      0:00  0.00%  0.00% csh
 3026 root      18    0   228K  984K pause      0:00  0.00%  0.00% csh
    9 root      14    0     0K   16M crypto_w   0:00  0.00%  0.00% [cryptoret]
    5 root      10    0     0K   16M usbevt     0:00  0.00%  0.00% [usb0]
    6 root      10    0     0K   16M usbtsk     0:00  0.00%  0.00% [usbtask-hc]
    7 root      10    0     0K   16M usbtsk     0:00  0.00%  0.00% [usbtask-dr]
    8 root      10    0     0K   16M usbevt     0:00  0.00%  0.00% [usb1]
    1 root      10    0   100K  852K wait       0:00  0.00%  0.00% init
  755 root      10    0   248K  812K nanoslee   0:00  0.00%  0.00% cron
  105 root       3    0    56K  828K ttyin      0:00  0.00%  0.00% getty
  104 root       3    0    56K  828K ttyin      0:00  0.00%  0.00% getty
  103 root       3    0    56K  828K ttyin      0:00  0.00%  0.00% getty
  102 root       3    0    56K  828K ttyin      0:00  0.00%  0.00% getty
  100 root       2    0  5080K 6540K select     0:00  0.00%  0.00% httpd
 2402 root       2    0   408K 3232K netio      0:00  0.00%  0.00% sshd
  109 www        2    0  5120K 2768K kqread     0:00  0.00%  0.00% httpd
 3058 troy.wil   2    0   408K 2448K select     0:00  0.00%  0.00% sshd
  415 root       2    0   296K 1452K select     0:00  0.00%  0.00% sshd
  151 root       2    0   640K 1124K select     0:00  0.00%  0.00% dhclient
  699 postfix    2    0   276K 1096K kqread     0:00  0.00%  0.00% qmgr
 3027 postfix    2    0   216K 1056K kqread     0:00  0.00%  0.00% pickup
  629 root       2    0   196K  992K kqread     0:00  0.00%  0.00% master
  222 root       2    0   188K  864K kqread     0:00  0.00%  0.00% syslogd
  758 root       2    0    72K  848K kqread     0:00  0.00%  0.00% inetd
  107 www       -4    0  5272K 6268K semwait    0:00  0.00%  0.00% httpd
  108 www       -4    0  5260K 5780K semwait    0:00  0.00%  0.00% httpd
  106 www       -4    0  5384K 4744K semwait    0:00  0.00%  0.00% httpd
  878 www       -4    0  5120K 2768K semwait    0:00  0.00%  0.00% httpd
  783 www       -4    0  5120K 2768K semwait    0:00  0.00%  0.00% httpd
   80 www       -4    0  5120K 2768K semwait    0:00  0.00%  0.00% httpd
    4 root      -6    0     0K   16M atath      0:00  0.00%  0.00% [atabus1]
   48 root      -6    0     0K   16M physiod    0:00  0.00%  0.00% [physiod]
    3 root      -6    0     0K   16M atath      0:00  0.00%  0.00% [atabus0]
    0 root     -18    0     0K   16M schedule   0:00  0.00%  0.00% [swapper]
   12 root     -18    0     0K   16M aiodoned   0:00  0.00%  0.00% [aiodoned]
    2 root     -18    0     0K   16M smtaskq    0:00  0.00%  0.00% [sysmon]
   10 root     -18    0     0K   16M pgdaemon   0:00  0.00%  0.00% [pagedaemon]
The funny thing is if I fire up the url to load the dokuwiki site (I even have a clean fresh install with virtually nothing in it) things go through the roof and I have to hard reset the box. Nothing gets written to the log files (I deleted the logs in /var/log/httpd before loading the url to make sure that I wouldn't miss any new entries).

The only thing that I can think of is that there is something wrong with my apache installation or php5. I had php5 and apache installed on NetBSD v3.1 and I copied over the configuration files so there shouldn't be any configuration differences.

Any pointers on things that I could try or look for?

Is it safe to use the old configuration files (particularly from v3.1) in v4.0?
Reply With Quote
  #7   (View Single Post)  
Old 3rd June 2008
richardpl richardpl is offline
Spam Deminer
 
Join Date: May 2008
Location: Croatia
Posts: 284
Default

Well, what is dokuwiki doing in that environment and does the same bahaviour happen on older NetBSD when running dokuwiki?
Reply With Quote
  #8   (View Single Post)  
Old 3rd June 2008
fenrisW0lf fenrisW0lf is offline
Port Guard
 
Join Date: May 2008
Posts: 17
Default

Well,

Dokuwiki is a simple (at least I think it is) wiki that relies on flat files (so no db dependencies).

I have no clue what it is doing - am not a php programmer. I load the url in my browser (on another machine) and point it to the dokuwiki installation (brand new fresh install) and the front page loads, very slowly and then freezes before it is complete.

It did work correctly in NetBSD v3.0 and v3.1. I can't recall off the top of my head what the exact version numbers for apache2 and php5 were, but they would have been the latest from pkgsrc.

Any ideas on tracing the problems from the server itself?
Reply With Quote
  #9   (View Single Post)  
Old 3rd June 2008
fenrisW0lf fenrisW0lf is offline
Port Guard
 
Join Date: May 2008
Posts: 17
Default

I downloaded an older version that I was using on my older server and installed it. It causes pagedaemon to go nuts and hog the cpu.
Reply With Quote
Old 3rd June 2008
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 3,318
Default

Quote:
Originally Posted by fenrisW0lf View Post
Any ideas on tracing the problems from the server itself?
After searching for information on dokuwiki, I see that it isn't in pkgsrc. So, where did you get it?

Likewise, it appears that you asked this on the dokuwiki forum a month ago:

http://forum.dokuwiki.org/thread/2172

Did you get any kind of response then?
Reply With Quote
Old 3rd June 2008
fenrisW0lf fenrisW0lf is offline
Port Guard
 
Join Date: May 2008
Posts: 17
Default

Quote:
Originally Posted by ocicat View Post
After searching for information on dokuwiki, I see that it isn't in pkgsrc. So, where did you get it?
Main site:
http://www.splitbrain.org/projects/dokuwiki

First download I tried, the latest version:
dokuwiki-2008-05-05.tgz

I was running this one on my old system:
dokuwiki-rc2008-04-11.tgz

Installation is as simple as extracting the tgz to a directory that is accessible from apache (well at least that is what I have done in the past). I put it under htdocs/dokuwiki - setting the owner and group to www. Then using a browser navigate to that folder "dokuwiki/install.php" fill out the installation portion and the wiki should be setup.

I have tried both of those versions (fresh installs to different directories) and still the same issue. I'll try other older versions once I get home and see if that helps. At first I thought it may be my data from the older wiki was somehow corrupted. But later tests with the 'fresh' copies confirmed the same behaviour.


Quote:
Likewise, it appears that you asked this on the dokuwiki forum a month ago:

http://forum.dokuwiki.org/thread/2172

Did you get any kind of response then?
There was a response today, but I have already tried out a brand new install with none of my data or templates and I still get the same thing, so the response doesn't really help.

At this point I am not sure where the problem lies - the php script dokuwiki or the apache configuration or php5. Is there anyway to trace.debug the php scripts to see what is happening?

Cheers and thanks for the replies,
Troy
Reply With Quote
Old 3rd June 2008
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 3,318
Default

Quote:
Originally Posted by fenrisW0lf View Post
...I have already tried out a brand new install with none of my data or templates and I still get the same thing, so the response doesn't really help.

At this point I am not sure where the problem lies - the php script dokuwiki or the apache configuration or php5. Is there anyway to trace.debug the php scripts to see what is happening?
It appears then that you expected to simply install an application found in the wild & hoped it would work. This may work with some applications, but what you have just experienced is what motivates the entire pkgsrc ports tree.

Applications found in the wild might be POSIX compliant (which is a good thing...), but more than likely they are Linux-centric, & the chances of them simply running on any of the *BSD's as they originally existed is slim. Even though you are dealing with a Web application which is abstracted away from the OS more than other types of applications, there are fundamentally two general issues when porting anything:
  • The filesystem layouts between the OS'es are markedly different. Some things are equal, but others are in different locations, or simply not there at all. You will need to study the manpage to hier(7) in order to adequately assess the problem.
  • Some libraries translate from the other Unix'es & Unix-like operating system as is. Others need tweaking. Still others don't translate at all such that you will have to write the appropriate shims. As someone porting the application this is your responsibility to determine, & you may need to port some libraries yourself.
You will undoubtedly want to put time into studying the compat_linux(8) manpage.

To be successful at porting, you need to understand the application at a deep level. Having seen the symptoms that you have presented, it would be a reasonable bet to guess that something is amiss in PHP-land which may be due to the reasons outlined above, or there may be a multithreaded race condition which appears on NetBSD which wasn't present in whatever OS dokuwiki was originally developed (again, more likely Linux...). You can continue to ask in various forums (& contacting the maintainer of NetBSD's PHP maintainer would be a good person to befriend...), but I suspect you will not be talking to the right people who have both the depth & particular knowledge you need.

It should now be apparent that porting can range from trivial to very complex. At this point, I would guess that porting dokuwiki is somewhere in the middle of this continuum.

As for how to resolve this set of problems, you have three choices:
  • Continue the porting process. Only you can determine whether you have the time, skill set, & patience needed to complete the task but if you do complete it, share your work by submitting it to the NetBSD project for inclusion in the pkgsrc collection.
  • Choose a different wiki application which has already been ported to NetBSD. The following page will give you information on what applications are already available:

    http://pkgsrc.se/search.php?so=wiki
  • If it important to use dokuwiki (& it sounds like you already had files you were hoping to leverage...), you may want to consider installing it on the operating system in which it is developed. Post to the dokuwiki forums to find out this information.
Good luck. You still have a lot of research in front of you.
Reply With Quote
Old 3rd June 2008
fenrisW0lf fenrisW0lf is offline
Port Guard
 
Join Date: May 2008
Posts: 17
Default

Quote:
Originally Posted by ocicat View Post
It appears then that you expected to simply install an application found in the wild & hoped it would work. This may work with some applications, but what you have just experienced is what motivates the entire pkgsrc ports tree.
Funny thing is that I didn't have a problem with it before with NetBSD 3.1 and it was very simple to install.

Oh well, thanks anyway. I appreciate the informative response.

Cheers,
Troy
Reply With Quote
Old 5th June 2008
fenrisW0lf fenrisW0lf is offline
Port Guard
 
Join Date: May 2008
Posts: 17
Default

I thought I'd report back to close this thread off. There was a problem with NetBSD. When I upgraded from v3.1 to 4.0. I choose to reformat the partition after not having any luck with the upgrade process. Apparently it didn't format the partitions and just put files.

After completely wiping the drive and then verifying the installation was correct everything seems to be working will.


Cheers,
Troy
Reply With Quote
Old 5th June 2008
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 3,318
Default

Glad it worked out for you.

Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Forum usage: How to thank? Greg_Morgan Off-Topic 2 9th October 2009 12:49 AM
dd and split usage problem paul-lkw FreeBSD General 4 31st January 2009 08:13 PM
memory usage monitoring using net-snmp ducu_00 FreeBSD Ports and Packages 2 11th October 2008 03:12 PM
Script to mail me resources usage? bigb89 Programming 5 20th July 2008 06:58 AM
FreeBSD and bandwidth usage per subnett/IP espenfjo FreeBSD General 2 4th July 2008 08:05 AM


All times are GMT. The time now is 07:06 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick