This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Some debug tips


I've recently had lots of issues trying to get apache (and xinetd and 
init and sshd!) running as a windows service.  Just thought I'd share
some notes I took while researching/troubleshooting that eventually
helped me figure out the issues.  Especially since I searched and
searched for hours on these newsgroups and never found exactly what 
I needed!

Hope someone can use them.

I had the same issue as reported in this thread.

-Dustin

1) use "strace" -- 
$ strace httpd2.exe > strace.out
$ vi strace.out
<snip> 
Go to bottom and scroll up for signal's or exit conditions.  For example:

153  177882 [main] httpd2 3764 transport_layer_pipes::connect: Error opening t
he pipe (2)
 61  177943 [main] httpd2 3764 client_request::make_request: cygserver un-avai
lable
 29  177972 [main] httpd2 3764 semget: -1 [88] = semget ()
 29  178001 [main] httpd2 3764 __set_errno: int semget(long long int, int, int
):140 val 88
 35  178036 [main] httpd2 3764 kill0: kill (3764, 12)
 38  178074 [main] httpd2 3764 sig_send: sendsig 0x718, pid 3764, signal 12, i
ts_me 1
</snip>

Indicates it was looking for cygserver, which I had stopped as a 
service for another issue.

2) Make sure all log files specified in config files are in writable
directories.  Try doing chmod gou+rwx on your log dirs or even /var (ahh!)

3) Add "-e debug" to apache startup.  (-a "-e debug", if adding to 
services via cygrunsrv).  Output will be placed in /var/log/apache.log.

4) Run service under strace.  Not sure if this makes sense to do or not.  
I tried it anyways. YMMV.  In my case, apache/httpd2 would start normally
in standalone (either by apachectl2 start or httpd2.exe).  However, it 
would NOT start as a service and I would sometimes briefly see httpd2.exe
in task manager, then it would exit and cygrunsrv would remain running.
I did this to troubleshoot:


$ cygrunsrv -I apache -p /usr/bin/strace -d "Apache (cygwin)" \
     -a "-m ALL -f -n /usr/sbin/httpd2.exe -e debug"  \
     -e "CYGWIN=ntsec"

Check out /var/log/apache.log.  Go to the bottom and scroll up past where
you see it closing things down (for example, "closing 
'/var/log/apache2/access_log'").

I still see issues with cygserver (see #1 above)

5) Run apache with "CYGWIN=ntsec server". Now, I see log message in 
error_log such as:

$ cygrunsrv -I apache -p /usr/bin/strace -d "Apache (cygwin)" \
     -a "-m ALL -f -n /usr/sbin/httpd2.exe -e debug"  \
     -e "CYGWIN=ntsec server"

[Thu Jun 30 11:30:50 2005] [alert] Child 2476 returned a Fatal error...
Apache is exiting!
[Thu Jun 30 11:30:50 2005] [alert] (22)Invalid argument: setgid: unable
to set group id to Group 4294967295

6) Changed User and Group in httpd.conf to the following (was commented out):
User Guest
Group None

7) Removed service and reinstalled as:
$ cygrunsrv -R apache
$ cygrunsrv -I apache -p /usr/sbin/apache2.exes -d "Apache (cygwin)" \
     -e "CYGWIN=ntsec server"
$ cygrunsrv -S apache

IT WORKS NOW!  But, you have to make darn sure cygserver is running, too.

Hmmm...

Just thought this may help others since I spent MANY hours troubleshooting
and most links I find don't have a definitive solution!

-Dustin


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]