You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Martin Kraemer <Ma...@Fujitsu-Siemens.com> on 2001/02/13 23:18:54 UTC

Core dump in apache-1.3.18, with VirtualHosts

I just observed a core dump in the routine dump_a_vhost() in http_vhost.c
but I do not know whether it is somehow related to the recent change to
allow "NameVirtualHost *" or if this error is older than that change.

I trigger the core dump by invoking Apache as:
  % httpd -S
  VirtualHost configuration:
  wildcard NameVirtualHosts and _default_ servers:
  *:82                   pgtm0035.mch.fsc.net (/opt/apache/conf/httpd.conf:1080)
  *:80                   is a NameVirtualHost
                         default server deejai.mch.fsc.net (/opt/apache/conf/httpd.conf:1061)
                         port 80 namevhost deejai.mch.fsc.net (/opt/apache/conf/httpd.conf:1061)
                         port 80 namevhost Apache.mch.fsc.net (/opt/apache/conf/httpd.conf:1066)
                         port 80 namevhost Apache-Dev.mch.fsc.net (/opt/apache/conf/httpd.conf:1071)
                         port 80 namevhost PGTM0035.mch.fsc.net (/opt/apache/conf/httpd.conf:1076)
                         port 80 namevhost BS2000-Partner.mch.fsc.net (/opt/apache/conf/httpd.conf:1085)
                         port 80 namevhost deejai.penguinpowered.com (/opt/apache/conf/httpd.conf:1090)
                         port 80 namevhost deejai.mch.fsc.net (/opt/apache/conf/httpd.conf:1101)
  Program received signal SIGSEGV, Segmentation fault.
  0x806907f in dump_a_vhost (f=0x80a3970, ic=0x8105c04) at http_vhost.c:436
  436             fprintf(f, "%-22s %s (%s:%u)\n", buf, ic->server->server_hostname,
  (gdb) p ic->server
  $1 = (server_rec *) 0x0
  (gdb) 

and the configuration looks like this (each Include contains a
ServerName and optional ServerAliases):

VirtualDocumentRoot /home/www/%1/htdocs/
VirtualScriptAlias  /home/www/%1/cgi-bin/
NameVirtualHost *:80
<VirtualHost *:80>
  Include /home/www/deejai/conf/vhost.conf
</VirtualHost>
<VirtualHost *:80>
  Include /home/www/apache/conf/vhost.conf
</VirtualHost>
<VirtualHost *:80>
  Include /home/www/apache-dev/conf/vhost.conf
</VirtualHost>
<VirtualHost *:80>
  Include /home/www/pgtm0035/conf/vhost.conf
</VirtualHost>
<VirtualHost *:82>
  Include /home/www/pgtm0035/conf/vhost:81.conf
</VirtualHost>
<VirtualHost *:80>
  Include /home/www/bs2000-partner/conf/vhost.conf
</VirtualHost>
<VirtualHost *:80>
  Header set X-Virtual-Host deejai.penguinpowered.com
  ServerName deejai.penguinpowered.com
  ServerAdmin Webmaster+deejai@deejai.mch.fsc.net
  DocumentRoot /home/www/deejai/htdocs/
 DirectoryIndex index Welcome
</VirtualHost>
<VirtualHost _default_:80>
  Include /home/www/_default_/conf/vhost.conf
</VirtualHost>

If I add a check for a NULL-server in the ipaddr_chain records, then
the core dump of course vanishes, but why are there ipaddr_chain records
with NULL-server entries in the first place?

For normal operation, this may lead to wrong operation (funny virtual host
behavior? core dumps?), if I am not mistaken.

   Martin
-- 
<Ma...@Fujitsu-Siemens.com>    |       Fujitsu Siemens
       <ma...@apache.org>              |   81730  Munich,  Germany

Re: Core dump in apache-1.3.18, with VirtualHosts

Posted by Martin Kraemer <Ma...@Fujitsu-Siemens.com>.
On Sat, Feb 17, 2001 at 01:38:28PM -0500, Rodent of Unusual Size wrote:
> Martin Kraemer wrote:
> > 
> > 4) Now uncomment the second "NameVirtualHost *:80", and retry:
> 
> So that now you have two 'NameVirtualHost *:80' lines?

Exactly.  My guess is (I did NOT trace or verify that against the code!):
That creates a second instance of an ipaddr_chain struct for
the *:80 vhosts. But the server_rec structs are (after being created)
only being inserted into the first matching ipaddr_chain struct, so
the server_rec ptr in the second instance remains NULL.

At least at the moment when the server_rec ptr is dereferenced
(and NULL), we are in an ipaddr_chain struct with both
"server" and "names" pointers being NULL.

The patch I committed circumvents dereferencing, but does not eliminate
the reason why there is such an ipaddr_chain struct.
What would be the best behavior here? Test whether two NameVirtualHost's
have the same arguments (what about the argument: "*"?
Is that equal to "*:*" or to "*:80" ?) and treat them as one? Or bail out
when we detect such a misconfiguration?

Ehhmmm.. And why does this error only happen if I add a second
<VirtualHost> which does NOT match any of the NameVirtalHost's?!?!?

Puzzled,
   Martin
-- 
<Ma...@Fujitsu-Siemens.com>    |       Fujitsu Siemens
       <ma...@apache.org>              |   81730  Munich,  Germany

Re: Core dump in apache-1.3.18, with VirtualHosts

Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
Martin Kraemer wrote:
> 
> 4) Now uncomment the second "NameVirtualHost *:80", and retry:

So that now you have two 'NameVirtualHost *:80' lines?
-- 
#ken    P-)}

Ken Coar                    <http://Golux.Com/coar/>
Apache Software Foundation  <http://www.apache.org/>
"Apache Server for Dummies" <http://Apache-Server.Com/>
"Apache Server Unleashed"   <http://ApacheUnleashed.Com/>

Re: Core dump in apache-1.3.18, with VirtualHosts

Posted by Martin Kraemer <Ma...@Fujitsu-Siemens.com>.
Ah, here we go.
1) create a plain vanilla httpd:
   % ./configure --prefix=/tmp/apademo
   % make
   % make install
2) Append the following lines to httpd.conf:
   % cat >>/tmp/apademo/conf/httpd.conf <<_eof_
   NameVirtualHost *:80
   #NameVirtualHost *:80
   <VirtualHost *:80>
     ServerName Apache.mch.fsc.net
   </VirtualHost>
   <VirtualHost *:82>
     ServerName  pgtm0035.mch.fsc.net
   </VirtualHost>
   _eof_
3) try it:
   % src/httpd -S
   VirtualHost configuration:
   wildcard NameVirtualHosts and _default_ servers:
   *:82                   pgtm0035.mch.fsc.net (/tmp/apademo/conf/httpd.conf:955)
   *:80                   is a NameVirtualHost
                          default server Apache.mch.fsc.net (/tmp/apademo/conf/httpd.conf:952)
                          port 80 namevhost Apache.mch.fsc.net (/tmp/apademo/conf/httpd.conf:952)
4) Now uncomment the second "NameVirtualHost *:80", and retry:
   % src/httpd -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
   *:82                   pgtm0035.mch.fsc.net (/tmp/apademo/conf/httpd.conf:955)
   *:80                   is a NameVirtualHost
                          default server Apache.mch.fsc.net (/tmp/apademo/conf/httpd.conf:952)
                          port 80 namevhost Apache.mch.fsc.net (/tmp/apademo/conf/httpd.conf:952)
   Segmentation fault (core dumped)

That's all. But I have not the faintest why the *:82 vhost makes a difference.

   Martin

On Fri, Feb 16, 2001 at 08:58:39PM +0000, Tony Finch wrote:
> Please would you give me a VERBATIM configuration snippet that
> reproducibly demonstrates the problem when I paste it into the bottom
> of the default httpd.conf, NOT one full of ellipses and etceteras.
-- 
<Ma...@Fujitsu-Siemens.com>    |       Fujitsu Siemens
       <ma...@apache.org>              |   81730  Munich,  Germany

Re: Core dump in apache-1.3.18, with VirtualHosts

Posted by Tony Finch <do...@dotat.at>.
Martin Kraemer <Ma...@Fujitsu-Siemens.com> wrote:
>
>But I narrowed the problem in: it is not the "VirtualHost" directives
>that cause the funny structiures, but is was the fact that I had:
>  NameVirtualHost *
>  ...
>  NameVirtualHost *:80
>  ...
>  <VirtualHost aaa>
>  ...
>etc. in my configuration. That combination breaks it.

That doesn't work for me. I have:

NameVirtualHost *
NameVirtualHost *:80
<VirtualHost hand.dotat.at>
</VirtualHost>

And apache says:

[Fri Feb 16 20:53:20 2001] [warn] NameVirtualHost *:80 has no VirtualHosts
[Fri Feb 16 20:53:20 2001] [warn] NameVirtualHost *:80 has no VirtualHosts
VirtualHost configuration:
127.0.0.1:80           localhost (/usr/local/apache/conf/httpd.conf:953)

Please would you give me a VERBATIM configuration snippet that
reproducibly demonstrates the problem when I paste it into the bottom
of the default httpd.conf, NOT one full of ellipses and etceteras.

Tony.
-- 
f.a.n.finch    fanf@covalent.net    dot@dotat.at
MALIN: SOUTHWESTERLY 4 OR 5. RAIN OR DRIZZLE. MODERATE OR GOOD.

Re: Core dump in apache-1.3.18, with VirtualHosts

Posted by Martin Kraemer <Ma...@Fujitsu-Siemens.com>.
On Fri, Feb 16, 2001 at 11:13:30AM -0600, William A. Rowe, Jr. wrote:
> Is this related to the parse_uri_scheme goodies?

No.

> Can you hack a fix, Tony, Martin?
Yes. Will commit right away.

   Martin
-- 
<Ma...@Fujitsu-Siemens.com>    |       Fujitsu Siemens
       <ma...@apache.org>              |   81730  Munich,  Germany

Re: Core dump in apache-1.3.18, with VirtualHosts

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
From: "Martin Kraemer" <Ma...@Fujitsu-Siemens.com>
Sent: Friday, February 16, 2001 6:47 AM


> But I narrowed the problem in: it is not the "VirtualHost" directives
> that cause the funny structiures, but is was the fact that I had:
>   NameVirtualHost *
>   ...
>   NameVirtualHost *:80
>   ...
>   <VirtualHost aaa>
>   ...
> etc. in my configuration. That combination breaks it.

Do you all feel this need a fix in 1.3.18 [is this specific variant a showstopper?]
Is this related to the parse_uri_scheme goodies?

Can you hack a fix, Tony, Martin?

On another note, I have no issue with the parse_uri


Re: Core dump in apache-1.3.18, with VirtualHosts

Posted by Martin Kraemer <Ma...@Fujitsu-Siemens.com>.
On Thu, Feb 15, 2001 at 08:43:50PM +0000, Tony Finch wrote:
> I can't trivially reproduce the problem so if you can send me a config
> file that triggers it that would be helpful. If you like and if they
> are 1386 you can also send me your httpd binary and core file.

I have FreeBSD-4.2 on i386, yes.

But I narrowed the problem in: it is not the "VirtualHost" directives
that cause the funny structiures, but is was the fact that I had:
  NameVirtualHost *
  ...
  NameVirtualHost *:80
  ...
  <VirtualHost aaa>
  ...
etc. in my configuration. That combination breaks it.
  
   Martin
-- 
<Ma...@Fujitsu-Siemens.com>         |     Fujitsu Siemens
Fon: +49-89-636-46021, FAX: +49-89-636-41143 | 81730  Munich,  Germany

Re: Core dump in apache-1.3.18, with VirtualHosts

Posted by Tony Finch <do...@dotat.at>.
I can't trivially reproduce the problem so if you can send me a config
file that triggers it that would be helpful. If you like and if they
are 1386 you can also send me your httpd binary and core file.

Tony.
-- 
f.a.n.finch    fanf@covalent.net    dot@dotat.at
FAEROES: SOUTHERLY VEERING WESTERLY 4 OR 5, INCREASING 7 TO SEVERE GALE 9.
RAIN OR SHOWERS. MODERATE OR GOOD.

Re: Core dump in apache-1.3.18, with VirtualHosts

Posted by Martin Kraemer <Ma...@Fujitsu-Siemens.com>.
On Fri, Feb 16, 2001 at 01:49:48PM +0100, Martin Kraemer wrote:
> On Thu, Feb 15, 2001 at 08:33:49PM +0000, Tony Finch wrote:
> > ><VirtualHost *:80>
> > >  Include /home/www/deejai/conf/vhost.conf
> > ></VirtualHost>
> > [...]
> > ><VirtualHost _default_:80>
> > >  Include /home/www/_default_/conf/vhost.conf
> > ></VirtualHost>
> > 
> > And that doesn't make any sense.
> 
> Blush...  Uhmmm. I was just trying around... Thx for pointing this out.
> But these don't cause the core dump.

I've been thinking about this, and I think it does make sense.
In the 1st Include (one of several similar Includ files), there's a
ServerName directive in each VHost block. In the _default_ case, there
isn't, because that's the intention with NameVirtualHosts: _default_
matches what has not been matched yet, and "*" matches only if the
ServerName matches. Or am I mistaken here?
(it worked for me until now, though)

  Martin
-- 
<Ma...@Fujitsu-Siemens.com>    |       Fujitsu Siemens
       <ma...@apache.org>              |   81730  Munich,  Germany

Re: Core dump in apache-1.3.18, with VirtualHosts

Posted by Martin Kraemer <Ma...@Fujitsu-Siemens.com>.
On Thu, Feb 15, 2001 at 08:33:49PM +0000, Tony Finch wrote:
> ><VirtualHost *:80>
> >  Include /home/www/deejai/conf/vhost.conf
> ></VirtualHost>
> [...]
> ><VirtualHost _default_:80>
> >  Include /home/www/_default_/conf/vhost.conf
> ></VirtualHost>
> 
> And that doesn't make any sense.

Blush...  Uhmmm. I was just trying around... Thx for pointing this out.
But these don't cause the core dump.

   Martin
-- 
<Ma...@Fujitsu-Siemens.com>    |       Fujitsu Siemens
       <ma...@apache.org>              |   81730  Munich,  Germany

Re: Core dump in apache-1.3.18, with VirtualHosts

Posted by Tony Finch <do...@dotat.at>.
Martin Kraemer <Ma...@Fujitsu-Siemens.com> wrote:
>
>and the configuration looks like this (each Include contains a
>ServerName and optional ServerAliases):

Well, those are slightly important :-(

>VirtualDocumentRoot /home/www/%1/htdocs/
>VirtualScriptAlias  /home/www/%1/cgi-bin/
>NameVirtualHost *:80
><VirtualHost *:80>
>  Include /home/www/deejai/conf/vhost.conf
></VirtualHost>
[...]
><VirtualHost _default_:80>
>  Include /home/www/_default_/conf/vhost.conf
></VirtualHost>

And that doesn't make any sense.

I'm looking...

Tony.
-- 
f.a.n.finch    fanf@covalent.net    dot@dotat.at
FINISTERRE SOLE: EAST OR NORTHEAST 4 OR 5. DRIZZLE AT TIMES. MODERATE OR GOOD.