You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Marc Slemko <ma...@worldgate.com> on 1997/10/25 07:27:35 UTC

inetd mode broken again

gdb httpd httpd.core
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.13 (i386-unknown-freebsd), 
Copyright 1994 Free Software Foundation, Inc...
Core was generated by `httpd'.
Program terminated with signal 11, Segmentation fault.
#0  0x3b485 in set_callback_and_alarm (fn=0x3b154 <timeout>, x=100)
    at http_main.c:826
826         old = scoreboard_image->servers[my_child_num].timeout_len;
(gdb) print scoreboard_image
$1 = (scoreboard *) 0x0





Re: inetd mode broken again

Posted by Dean Gaudet <dg...@arctic.org>.
Which situations? 

The security aspect of it is handled quite nicely with my listenwrap
patch.

The performance aspect of it ... you can tune
SCOREBOARD_MAINTENANCE_INTERVAL=60, and make MinSpareServer 1,
MaxSpareServer 2, and I don't think the resource requirements are that
bad. 

Dean

On Sat, 25 Oct 1997, Marc Slemko wrote:

> I can't say I am thrilled with the idea because inetd mode _does_ work
> fine, except for small things that keep breaking it, and it _is_ useful in
> some situations.
> 
> On Sat, 25 Oct 1997, Brian Behlendorf wrote:
> 
> > 
> > +1 for removing inetd support.
> > 
> > 	Brian
> > 
> > 
> > --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
> > "it's a big world, with lots of records to play." - sig   brian@organic.com
> > 
> 
> 

Re: inetd mode broken again

Posted by Marc Slemko <ma...@worldgate.com>.
I can't say I am thrilled with the idea because inetd mode _does_ work
fine, except for small things that keep breaking it, and it _is_ useful in
some situations.

On Sat, 25 Oct 1997, Brian Behlendorf wrote:

> 
> +1 for removing inetd support.
> 
> 	Brian
> 
> 
> --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
> "it's a big world, with lots of records to play." - sig   brian@organic.com
> 


Re: inetd mode broken again

Posted by Brian Behlendorf <br...@organic.com>.
+1 for removing inetd support.

	Brian


--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
"it's a big world, with lots of records to play." - sig   brian@organic.com

Re: inetd mode broken again

Posted by Dirk-Willem van Gulik <di...@elect6.jrc.it>.
On Fri, 24 Oct 1997, Dean Gaudet wrote:

> I find the following patch fixes all bugs with inetd mode.  YMMV.

Yep, works for me! Nice piece of work, into which I got stuck
completely earlier ths week.

Dw.
> 
> Index: htdocs/manual/upgrading_to_1_3.html
> ===================================================================
> RCS file: /export/home/cvs/apachen/htdocs/manual/upgrading_to_1_3.html,v
> retrieving revision 1.3
> diff -u -r1.3 upgrading_to_1_3.html
> --- upgrading_to_1_3.html	1997/10/07 23:01:35	1.3
> +++ upgrading_to_1_3.html	1997/10/25 05:58:54
> @@ -102,6 +102,9 @@
>       This makes it more convenient to start Apache via rsh, ssh,
>       or crontabs.
>  
> +  <li><code>ServerType inetd</code> is no longer supported.  It was
> +    buggy, inefficient, and not worth maintaining.
> +
>  </ul>
>  
>  <h3>Misc Changes</h3>
> Index: htdocs/manual/mod/core.html
> ===================================================================
> RCS file: /export/home/cvs/apachen/htdocs/manual/mod/core.html,v
> retrieving revision 1.80
> diff -u -r1.80 core.html
> --- core.html	1997/10/10 09:13:09	1.80
> +++ core.html	1997/10/25 05:58:55
> @@ -1551,7 +1551,8 @@
>  <em>Type</em> is one of
>  <dl>
>  <dt>inetd
> -<dd>The server will be run from the system process inetd; the command to start
> +<dd><b>No longer supported as of Apache 1.3</b>
> +The server will be run from the system process inetd; the command to start
>  the server is added to <code>/etc/inetd.conf</code>
>  <dt>standalone
>  <dd>The server will run as a daemon process; the command to start the server
> Index: src/CHANGES
> ===================================================================
> RCS file: /export/home/cvs/apachen/src/CHANGES,v
> retrieving revision 1.471
> diff -u -r1.471 CHANGES
> --- CHANGES	1997/10/25 01:52:41	1.471
> +++ CHANGES	1997/10/25 05:58:56
> @@ -1,5 +1,8 @@
>  Changes with Apache 1.3b3
>  
> +  *) inetd mode no longer exists as it was full of bugs and not
> +     efficient. [Dean Gaudet]
> +
>    *) PORT: AIX now uses USE_FCNTL_SERIALIZED_ACCEPT. PR#849
>       PORT: i386 AIX does not have memmove. PR#1267
>       PORT: HPUX now defaults to using Spencer regex.  PR#482, 1246
> Index: src/main/http_conf_globals.h
> ===================================================================
> RCS file: /export/home/cvs/apachen/src/main/http_conf_globals.h,v
> retrieving revision 1.19
> diff -u -r1.19 http_conf_globals.h
> --- http_conf_globals.h	1997/10/22 20:29:34	1.19
> +++ http_conf_globals.h	1997/10/25 05:58:56
> @@ -55,7 +55,6 @@
>   * Process config --- what the process ITSELF is doing
>   */
>  
> -extern int standalone;
>  extern uid_t user_id;
>  extern char *user_name;
>  extern gid_t group_id;
> Index: src/main/http_config.c
> ===================================================================
> RCS file: /export/home/cvs/apachen/src/main/http_config.c,v
> retrieving revision 1.83
> diff -u -r1.83 http_config.c
> --- http_config.c	1997/10/22 20:29:35	1.83
> +++ http_config.c	1997/10/25 05:58:57
> @@ -1116,7 +1116,6 @@
>  {
>      /* ServerRoot, server_confname set in httpd.c */
>  
> -    standalone = 1;
>      user_name = DEFAULT_USER;
>      user_id = uname2id(DEFAULT_USER);
>      group_id = gname2id(DEFAULT_GROUP);
> Index: src/main/http_core.c
> ===================================================================
> RCS file: /export/home/cvs/apachen/src/main/http_core.c,v
> retrieving revision 1.132
> diff -u -r1.132 http_core.c
> --- http_core.c	1997/10/22 21:49:45	1.132
> +++ http_core.c	1997/10/25 05:58:58
> @@ -1081,8 +1081,12 @@
>  {
>      if (cmd->server->is_virtual)
>  	return "ServerType directive not allowed in <VirtualHost>";
> -    if (!strcasecmp (arg, "inetd")) standalone = 0;
> -    else if (!strcasecmp (arg, "standalone")) standalone = 1;
> +    if (!strcasecmp (arg, "inetd")) {
> +	return "ServerType 'inetd' no longer supported";
> +    }
> +    else if (!strcasecmp (arg, "standalone")) {
> +	/* yawn */
> +    }
>      else return "ServerType must be either 'inetd' or 'standalone'";
>  
>      return NULL;
> Index: src/main/http_main.c
> ===================================================================
> RCS file: /export/home/cvs/apachen/src/main/http_main.c,v
> retrieving revision 1.237
> diff -u -r1.237 http_main.c
> --- http_main.c	1997/10/22 20:29:40	1.237
> +++ http_main.c	1997/10/25 05:58:59
> @@ -147,7 +147,6 @@
>   * for the most part the only code that acts on 'em.  (Hmmm... mod_main.c?)
>   */
>  
> -int standalone;
>  uid_t user_id;
>  char *user_name;
>  gid_t group_id;
> @@ -728,9 +727,6 @@
>  	bsetflag(timeout_req->connection->client, B_EOUT, 1);
>  	bclose(timeout_req->connection->client);
>  
> -	if (!standalone)
> -	    exit(0);
> -
>  	ap_longjmp(jmpbuffer, 1);
>      }
>      else {			/* abort the connection */
> @@ -3107,8 +3103,6 @@
>  {
>      int remaining_children_to_start;
>  
> -    standalone = 1;
> -
>      is_graceful = 0;
>      ++generation;
>  
> @@ -3392,87 +3386,7 @@
>      server_conf = read_config(pconf, ptrans, server_confname);
>      init_modules(pconf, server_conf);
>  
> -    if (standalone) {
> -	STANDALONE_MAIN(argc, argv);
> -    }
> -    else {
> -	conn_rec *conn;
> -	request_rec *r;
> -	struct sockaddr sa_server, sa_client;
> -	BUFF *cio;
> -	NET_SIZE_T l;
> -
> -	open_logs(server_conf, pconf);
> -	init_modules(pconf, server_conf);
> -	set_group_privs();
> -
> -#ifdef MPE
> -	/* Only try to switch if we're running as MANAGER.SYS */
> -	if (geteuid() == 1 && user_id > 1) {
> -	    GETPRIVMODE();
> -	    if (setuid(user_id) == -1) {
> -		GETUSERMODE();
> -		aplog_error(APLOG_MARK, APLOG_ALERT, server_conf,
> -			    "setuid: unable to change uid");
> -		exit(1);
> -	    }
> -	    GETUSERMODE();
> -	}
> -#else
> -	/* Only try to switch if we're running as root */
> -	if (!geteuid() && setuid(user_id) == -1) {
> -	    aplog_error(APLOG_MARK, APLOG_ALERT, server_conf,
> -			"setuid: unable to change uid");
> -	    exit(1);
> -	}
> -#endif
> -	if (ap_setjmp(jmpbuffer)) {
> -	    exit(0);
> -	}
> -
> -	l = sizeof(sa_client);
> -	if ((getpeername(fileno(stdin), &sa_client, &l)) < 0) {
> -/* get peername will fail if the input isn't a socket */
> -	    perror("getpeername");
> -	    memset(&sa_client, '\0', sizeof(sa_client));
> -	}
> -
> -	l = sizeof(sa_server);
> -	if (getsockname(fileno(stdin), &sa_server, &l) < 0) {
> -	    perror("getsockname");
> -	    fprintf(stderr, "Error getting local address\n");
> -	    exit(1);
> -	}
> -	server_conf->port = ntohs(((struct sockaddr_in *) &sa_server)->sin_port);
> -	cio = bcreate(ptrans, B_RDWR | B_SOCKET);
> -#ifdef MPE
> -/* HP MPE 5.5 inetd only passes the incoming socket as stdin (fd 0), whereas
> -   HPUX inetd passes the incoming socket as stdin (fd 0) and stdout (fd 1).
> -   Go figure.  SR 5003355016 has been submitted to request that the existing
> -   functionality be documented, and then to enhance the functionality to be
> -   like HPUX. */
> -
> -	cio->fd = fileno(stdin);
> -#else
> -	cio->fd = fileno(stdout);
> -#endif
> -	cio->fd_in = fileno(stdin);
> -	conn = new_connection(ptrans, server_conf, cio,
> -			      (struct sockaddr_in *) &sa_client,
> -			      (struct sockaddr_in *) &sa_server, -1);
> -	r = read_request(conn);
> -	if (r)
> -	    process_request(r);	/* else premature EOF (ignore) */
> -
> -	while (r && conn->keepalive && !conn->aborted) {
> -	    destroy_pool(r->pool);
> -	    r = read_request(conn);
> -	    if (r)
> -		process_request(r);
> -	}
> -
> -	bclose(cio);
> -    }
> +    STANDALONE_MAIN(argc, argv);
>      exit(0);
>  }
>  
> @@ -3810,7 +3724,6 @@
>      int max_jobs_per_exe;
>      int max_jobs_after_exit_request;
>  
> -    standalone = 1;
>      sd = -1;
>      nthreads = threads_per_child;
>      max_jobs_after_exit_request = excess_requests_per_child;
> Index: src/modules/standard/mod_info.c
> ===================================================================
> RCS file: /export/home/cvs/apachen/src/modules/standard/mod_info.c,v
> retrieving revision 1.30
> diff -u -r1.30 mod_info.c
> --- mod_info.c	1997/10/22 20:30:23	1.30
> +++ mod_info.c	1997/10/25 05:59:00
> @@ -410,10 +410,6 @@
>                          MODULE_MAGIC_NUMBER);
>              rputs(buf, r);
>              ap_snprintf(buf, sizeof(buf),
> -                        "<strong>Run Mode:</strong> <tt>%s</tt><br>\n",
> -                        (standalone ? "standalone" : "inetd"));
> -            rputs(buf, r);
> -            ap_snprintf(buf, sizeof(buf),
>                          "<strong>User/Group:</strong> "
>                          "<tt>%s(%d)/%d</tt><br>\n",
>                          user_name, (int) user_id, (int) group_id);
> 
> 


Re: inetd mode broken again

Posted by Dean Gaudet <dg...@arctic.org>.
I find the following patch fixes all bugs with inetd mode.  YMMV.

Dean

Index: htdocs/manual/upgrading_to_1_3.html
===================================================================
RCS file: /export/home/cvs/apachen/htdocs/manual/upgrading_to_1_3.html,v
retrieving revision 1.3
diff -u -r1.3 upgrading_to_1_3.html
--- upgrading_to_1_3.html	1997/10/07 23:01:35	1.3
+++ upgrading_to_1_3.html	1997/10/25 05:58:54
@@ -102,6 +102,9 @@
      This makes it more convenient to start Apache via rsh, ssh,
      or crontabs.
 
+  <li><code>ServerType inetd</code> is no longer supported.  It was
+    buggy, inefficient, and not worth maintaining.
+
 </ul>
 
 <h3>Misc Changes</h3>
Index: htdocs/manual/mod/core.html
===================================================================
RCS file: /export/home/cvs/apachen/htdocs/manual/mod/core.html,v
retrieving revision 1.80
diff -u -r1.80 core.html
--- core.html	1997/10/10 09:13:09	1.80
+++ core.html	1997/10/25 05:58:55
@@ -1551,7 +1551,8 @@
 <em>Type</em> is one of
 <dl>
 <dt>inetd
-<dd>The server will be run from the system process inetd; the command to start
+<dd><b>No longer supported as of Apache 1.3</b>
+The server will be run from the system process inetd; the command to start
 the server is added to <code>/etc/inetd.conf</code>
 <dt>standalone
 <dd>The server will run as a daemon process; the command to start the server
Index: src/CHANGES
===================================================================
RCS file: /export/home/cvs/apachen/src/CHANGES,v
retrieving revision 1.471
diff -u -r1.471 CHANGES
--- CHANGES	1997/10/25 01:52:41	1.471
+++ CHANGES	1997/10/25 05:58:56
@@ -1,5 +1,8 @@
 Changes with Apache 1.3b3
 
+  *) inetd mode no longer exists as it was full of bugs and not
+     efficient. [Dean Gaudet]
+
   *) PORT: AIX now uses USE_FCNTL_SERIALIZED_ACCEPT. PR#849
      PORT: i386 AIX does not have memmove. PR#1267
      PORT: HPUX now defaults to using Spencer regex.  PR#482, 1246
Index: src/main/http_conf_globals.h
===================================================================
RCS file: /export/home/cvs/apachen/src/main/http_conf_globals.h,v
retrieving revision 1.19
diff -u -r1.19 http_conf_globals.h
--- http_conf_globals.h	1997/10/22 20:29:34	1.19
+++ http_conf_globals.h	1997/10/25 05:58:56
@@ -55,7 +55,6 @@
  * Process config --- what the process ITSELF is doing
  */
 
-extern int standalone;
 extern uid_t user_id;
 extern char *user_name;
 extern gid_t group_id;
Index: src/main/http_config.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/http_config.c,v
retrieving revision 1.83
diff -u -r1.83 http_config.c
--- http_config.c	1997/10/22 20:29:35	1.83
+++ http_config.c	1997/10/25 05:58:57
@@ -1116,7 +1116,6 @@
 {
     /* ServerRoot, server_confname set in httpd.c */
 
-    standalone = 1;
     user_name = DEFAULT_USER;
     user_id = uname2id(DEFAULT_USER);
     group_id = gname2id(DEFAULT_GROUP);
Index: src/main/http_core.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/http_core.c,v
retrieving revision 1.132
diff -u -r1.132 http_core.c
--- http_core.c	1997/10/22 21:49:45	1.132
+++ http_core.c	1997/10/25 05:58:58
@@ -1081,8 +1081,12 @@
 {
     if (cmd->server->is_virtual)
 	return "ServerType directive not allowed in <VirtualHost>";
-    if (!strcasecmp (arg, "inetd")) standalone = 0;
-    else if (!strcasecmp (arg, "standalone")) standalone = 1;
+    if (!strcasecmp (arg, "inetd")) {
+	return "ServerType 'inetd' no longer supported";
+    }
+    else if (!strcasecmp (arg, "standalone")) {
+	/* yawn */
+    }
     else return "ServerType must be either 'inetd' or 'standalone'";
 
     return NULL;
Index: src/main/http_main.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/http_main.c,v
retrieving revision 1.237
diff -u -r1.237 http_main.c
--- http_main.c	1997/10/22 20:29:40	1.237
+++ http_main.c	1997/10/25 05:58:59
@@ -147,7 +147,6 @@
  * for the most part the only code that acts on 'em.  (Hmmm... mod_main.c?)
  */
 
-int standalone;
 uid_t user_id;
 char *user_name;
 gid_t group_id;
@@ -728,9 +727,6 @@
 	bsetflag(timeout_req->connection->client, B_EOUT, 1);
 	bclose(timeout_req->connection->client);
 
-	if (!standalone)
-	    exit(0);
-
 	ap_longjmp(jmpbuffer, 1);
     }
     else {			/* abort the connection */
@@ -3107,8 +3103,6 @@
 {
     int remaining_children_to_start;
 
-    standalone = 1;
-
     is_graceful = 0;
     ++generation;
 
@@ -3392,87 +3386,7 @@
     server_conf = read_config(pconf, ptrans, server_confname);
     init_modules(pconf, server_conf);
 
-    if (standalone) {
-	STANDALONE_MAIN(argc, argv);
-    }
-    else {
-	conn_rec *conn;
-	request_rec *r;
-	struct sockaddr sa_server, sa_client;
-	BUFF *cio;
-	NET_SIZE_T l;
-
-	open_logs(server_conf, pconf);
-	init_modules(pconf, server_conf);
-	set_group_privs();
-
-#ifdef MPE
-	/* Only try to switch if we're running as MANAGER.SYS */
-	if (geteuid() == 1 && user_id > 1) {
-	    GETPRIVMODE();
-	    if (setuid(user_id) == -1) {
-		GETUSERMODE();
-		aplog_error(APLOG_MARK, APLOG_ALERT, server_conf,
-			    "setuid: unable to change uid");
-		exit(1);
-	    }
-	    GETUSERMODE();
-	}
-#else
-	/* Only try to switch if we're running as root */
-	if (!geteuid() && setuid(user_id) == -1) {
-	    aplog_error(APLOG_MARK, APLOG_ALERT, server_conf,
-			"setuid: unable to change uid");
-	    exit(1);
-	}
-#endif
-	if (ap_setjmp(jmpbuffer)) {
-	    exit(0);
-	}
-
-	l = sizeof(sa_client);
-	if ((getpeername(fileno(stdin), &sa_client, &l)) < 0) {
-/* get peername will fail if the input isn't a socket */
-	    perror("getpeername");
-	    memset(&sa_client, '\0', sizeof(sa_client));
-	}
-
-	l = sizeof(sa_server);
-	if (getsockname(fileno(stdin), &sa_server, &l) < 0) {
-	    perror("getsockname");
-	    fprintf(stderr, "Error getting local address\n");
-	    exit(1);
-	}
-	server_conf->port = ntohs(((struct sockaddr_in *) &sa_server)->sin_port);
-	cio = bcreate(ptrans, B_RDWR | B_SOCKET);
-#ifdef MPE
-/* HP MPE 5.5 inetd only passes the incoming socket as stdin (fd 0), whereas
-   HPUX inetd passes the incoming socket as stdin (fd 0) and stdout (fd 1).
-   Go figure.  SR 5003355016 has been submitted to request that the existing
-   functionality be documented, and then to enhance the functionality to be
-   like HPUX. */
-
-	cio->fd = fileno(stdin);
-#else
-	cio->fd = fileno(stdout);
-#endif
-	cio->fd_in = fileno(stdin);
-	conn = new_connection(ptrans, server_conf, cio,
-			      (struct sockaddr_in *) &sa_client,
-			      (struct sockaddr_in *) &sa_server, -1);
-	r = read_request(conn);
-	if (r)
-	    process_request(r);	/* else premature EOF (ignore) */
-
-	while (r && conn->keepalive && !conn->aborted) {
-	    destroy_pool(r->pool);
-	    r = read_request(conn);
-	    if (r)
-		process_request(r);
-	}
-
-	bclose(cio);
-    }
+    STANDALONE_MAIN(argc, argv);
     exit(0);
 }
 
@@ -3810,7 +3724,6 @@
     int max_jobs_per_exe;
     int max_jobs_after_exit_request;
 
-    standalone = 1;
     sd = -1;
     nthreads = threads_per_child;
     max_jobs_after_exit_request = excess_requests_per_child;
Index: src/modules/standard/mod_info.c
===================================================================
RCS file: /export/home/cvs/apachen/src/modules/standard/mod_info.c,v
retrieving revision 1.30
diff -u -r1.30 mod_info.c
--- mod_info.c	1997/10/22 20:30:23	1.30
+++ mod_info.c	1997/10/25 05:59:00
@@ -410,10 +410,6 @@
                         MODULE_MAGIC_NUMBER);
             rputs(buf, r);
             ap_snprintf(buf, sizeof(buf),
-                        "<strong>Run Mode:</strong> <tt>%s</tt><br>\n",
-                        (standalone ? "standalone" : "inetd"));
-            rputs(buf, r);
-            ap_snprintf(buf, sizeof(buf),
                         "<strong>User/Group:</strong> "
                         "<tt>%s(%d)/%d</tt><br>\n",
                         user_name, (int) user_id, (int) group_id);