Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Apache Restart problems
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
daank
n00b
n00b


Joined: 06 Oct 2002
Posts: 7

PostPosted: Fri Oct 29, 2004 7:58 am    Post subject: Apache Restart problems Reply with quote

I have recently created a sort of a log-change for my apache logs.
But i am having a problem with restarting the apache daemon.

The problem only shows when there are a lot of visitors on my websites (around 4k/day)

I created a workaround for this problem by firing the /usr/sbin/apachectl start every hour.
But this is not the best solution.

I'm running the following.
PHP Version 4.3.2
Linux umfserver 2.4.20-gentoo-r5 #1 SMP Wed Jun 18 21:28:56 CEST 2003 i686
Apache/1.3.27

anyone have an idea for this problem?

/var/log/apache/error_log wrote:
[Fri Oct 29 00:26:21 2004] [notice] caught SIGTERM, shutting down
[Fri Oct 29 00:26:21 2004] [notice-phpa] Cache shared memory removed (pid 15195)
[Fri Oct 29 00:26:21 2004] [notice-phpa] Cache semaphores removed (pid 15195)
[Fri Oct 29 00:26:23 2004] [notice-phpa] Acquiring cache : uid 81 gid 81 perms 666 (pid 2001)
[Fri Oct 29 00:26:23 2004] [notice-phpa] PHPA 1.3.3r2 on linux_i686_glibc2.1.3 (pid 2001)
[Fri Oct 29 00:26:23 2004] [notice-phpa] Initialised 8MB cache at 0x40f99000 with 512 process entries (pid 2001)
[Fri Oct 29 00:26:23 2004] [notice-phpa] Lock thresholds 10/10 (pid 2001)
[Fri Oct 29 00:26:24 2004] [notice] Apache/1.3.27 (Unix) (Gentoo/Linux) mod_ssl/2.8.14 OpenSSL/0.9.6i PHP/4.3.2 configured -- resuming normal operations
[Fri Oct 29 00:26:24 2004] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Fri Oct 29 00:26:24 2004] [notice] Accept mutex: sysvsem (Default: sysvsem)
[Fri Oct 29 00:26:26 2004] [warn] child process 2049 still did not exit, sending a SIGTERM
[Fri Oct 29 00:26:30 2004] [notice] caught SIGTERM, shutting down
[Fri Oct 29 00:26:30 2004] [notice-phpa] Cache shared memory removed (pid 2001)
[Fri Oct 29 00:26:30 2004] [notice-phpa] Cache semaphores removed (pid 2001)
Back to top
View user's profile Send private message
ocbMaurice
Tux's lil' helper
Tux's lil' helper


Joined: 14 Feb 2003
Posts: 90
Location: Switzerland

PostPosted: Fri Oct 29, 2004 4:27 pm    Post subject: Reply with quote

You did not mention what the problem really is (actually which commands you issue)? I believe you're trying to use "/etc/init.d/apache restart" which then does not actually restart apache (altough it will shut it down)?

I also made a workaround for this. Basically the problem is, that the /etc/init.d/apache script does first issue "apachectl stop" and then "apachectl start", which is not save, as the stoping can take some time if there are many apache threads running. So on "start" it simply will tell you that "apache is still running".

Well, I'm not using the apache from portage, I just checked it out someday. I compile apache myself and use the apachectl script from apache directly and use my own init script.

To solve the restart problem I edited the apachectl script to include a new option which I named "save-restart".

Code:

save-restart)
        # stop apache if running
        if [ $RUNNING -eq 1 ]; then
            if kill $PID ; then
                echo "$0 $ARG: httpd stopped"
            else
                echo "$0 $ARG: httpd could not be stopped"
                ERROR=4
            fi
        fi
        # wait until the apache mother-thread has really exited
        while [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; do
            sleep 1
        done
        # start apache again
        if $HTTPD ; then
            echo "$0 $ARG: httpd started"
        else
            echo "$0 $ARG: httpd could not be started"
            ERROR=3
        fi
        ;;


This should restart the server correctly. But be sure not to use the init script from gentoo to restart the server, use the apachectl script directly. You can of course replace the restart section within apachectl directly. But restart in apachectl actually means gracefull restart, which is something different then actually stopping and starting apache.

Anyway, for log-rotation I would suggest you take a look at cronolog, which is what I use for logrotation.

greets, Maurice
Back to top
View user's profile Send private message
daank
n00b
n00b


Joined: 06 Oct 2002
Posts: 7

PostPosted: Mon Nov 01, 2004 1:33 pm    Post subject: Reply with quote

maurice, thanks for the restart function, will have a go with that , and see if it improves restarting the apache

you said that you compiled your own apache , doesn't this affect the portage?

i mean , if you do a upgrade , it's likely that your config files are all mixed up
Back to top
View user's profile Send private message
ocbMaurice
Tux's lil' helper
Tux's lil' helper


Joined: 14 Feb 2003
Posts: 90
Location: Switzerland

PostPosted: Tue Nov 02, 2004 5:21 am    Post subject: Reply with quote

I have my personalized apache configurations in /www/apache/. Apache itself goes into /usr/local/apache/. Apachectl is in /usr/bin/. The apachectl is changed so httpd is started with a specific config file. The pidfile is also changed (which has to be reflected within apachectl). I have one server with main reverse proxy and chrooted vhosts, I use them for a special cms application. I "automated" all needed tasks via bash-scripts (apachectl controls the backend webserver according to the logged-in user) :-)

So I can update apache as often as I want, I do not change/need any single file from the original tree. I'm also quite sure that "make install" will not overwrite the default config file if there is allready another. Altough it will overwrite apachectl und it's installation tree. The only thing is that I have to check apache.org from time to time to see if an update is available.

Maurice
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum