Thread

  1. removing the exec() from doexec()

    Brett McCormickS <brett@abraxas.scene.com> — 1998-04-30T01:20:55Z

    I'm planning on removing the exec from DoExec() and instead just
    dispatch to the appropriate function.
    
    I don't plan on any changes to the usage of "arguments" to this new
    process, basically I'll just store them somewhere and then the forked
    backend can process them.
    
    Is there anything I should keep in mind?  I'd like this to eventually
    be integrated into the source tree -- any particular reason why we use
    exec() when we're just re-invoking the same binary?
    
    p.s. this is so my ssl patch doesn't have to negotiate twice -- very expensive
    
    
  2. Re: [HACKERS] removing the exec() from doexec()

    Bruce Momjian <maillist@candle.pha.pa.us> — 1998-04-30T01:44:15Z

    > 
    > 
    > I'm planning on removing the exec from DoExec() and instead just
    > dispatch to the appropriate function.
    > 
    > I don't plan on any changes to the usage of "arguments" to this new
    > process, basically I'll just store them somewhere and then the forked
    > backend can process them.
    > 
    > Is there anything I should keep in mind?  I'd like this to eventually
    > be integrated into the source tree -- any particular reason why we use
    > exec() when we're just re-invoking the same binary?
    > 
    > p.s. this is so my ssl patch doesn't have to negotiate twice -- very expensive
    
    No reason for the exec().  I believe the only advantage is that it gives
    us a separate process name in the 'ps' listing.  I have looked into
    simulating this.
    
    This exec() takes 15% of our startup time.  I have wanted it removed for
    many releases now.  The only problem is to rip out the code that
    re-attached to shared memory and stuff like that, because you will no
    longer loose the shared memory in the exec().  The IPC code is
    complicated, so good luck.  I or others can help if you get stuck.
    
    -- 
    Bruce Momjian                          |  830 Blythe Avenue
    maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
      +  If your life is a hard drive,     |  (610) 353-9879(w)
      +  Christ can be your backup.        |  (610) 853-3000(h)
    
    
  3. Re: [HACKERS] removing the exec() from doexec()

    Marc G. Fournier <scrappy@hub.org> — 1998-04-30T02:20:52Z

    On Wed, 29 Apr 1998, Bruce Momjian wrote:
    
    > No reason for the exec().  I believe the only advantage is that it gives
    > us a separate process name in the 'ps' listing.  I have looked into
    > simulating this.
    
    	Under FreeBSD, there is:
    
    setproctitle(3) - set the process title for ps 1
    
    	This isn't available under Solaris though, last I checked...
    
    Marc G. Fournier                                
    Systems Administrator @ hub.org 
    primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org 
    
    
    
  4. Re: [HACKERS] removing the exec() from doexec()

    Brett McCormick <brett@work.chicken.org> — 1998-04-30T02:36:31Z

    sure enough..  well, try this on your OS and you can find out if perl
    knows how to change it.  it doesn't work under solaris.  the args to
    ps might be different for your system.
    
    perl -e '$0 = "it_works!";system "ps -p $$"'
    
    However, the args to the processes are so different that it seems easy
    to tell the difference..  if you're a human.  computers might have
    more trouble.  I've been known to use "killall postgres" (yes, I know,
    I'm bad!!)
    
    I only do it so that I can restart the postmaster.  Our webserver is
    pretty much continually connected, and when it deadlocks, all the
    clients queue up.  It would be nice to have a set of commands to show
    you all connections, the machine/remote port they're from (for
    identd), the username/dbname they're connected as, when they
    connected, idle time, etc.  like "finger" for postgres.
    
    I'm willing to work on it, if someone can point me in the right
    direction.  (First things first though)
    
    On Wed, 29 April 1998, at 23:20:52, The Hermit Hacker wrote:
    
    > 
    > 	Under FreeBSD, there is:
    > 
    > setproctitle(3) - set the process title for ps 1
    > 
    > 	This isn't available under Solaris though, last I checked...
    > 
    > Marc G. Fournier                                
    > Systems Administrator @ hub.org 
    > primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org 
    
    
  5. Re: [HACKERS] removing the exec() from doexec()

    Bruce Momjian <maillist@candle.pha.pa.us> — 1998-04-30T02:42:39Z

    > 
    > On Wed, 29 Apr 1998, Bruce Momjian wrote:
    > 
    > > No reason for the exec().  I believe the only advantage is that it gives
    > > us a separate process name in the 'ps' listing.  I have looked into
    > > simulating this.
    > 
    > 	Under FreeBSD, there is:
    > 
    > setproctitle(3) - set the process title for ps 1
    > 
    > 	This isn't available under Solaris though, last I checked...
    
    Not even BSDI, which is BSD 4.4 like FreeBSD.
    
    -- 
    Bruce Momjian                          |  830 Blythe Avenue
    maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
      +  If your life is a hard drive,     |  (610) 353-9879(w)
      +  Christ can be your backup.        |  (610) 853-3000(h)
    
    
  6. Re: [HACKERS] removing the exec() from doexec()

    Bruce Momjian <maillist@candle.pha.pa.us> — 1998-04-30T02:51:43Z

    > 
    > 
    > sure enough..  well, try this on your OS and you can find out if perl
    > knows how to change it.  it doesn't work under solaris.  the args to
    > ps might be different for your system.
    > 
    > perl -e '$0 = "it_works!";system "ps -p $$"'
    > 
    > However, the args to the processes are so different that it seems easy
    > to tell the difference..  if you're a human.  computers might have
    > more trouble.  I've been known to use "killall postgres" (yes, I know,
    > I'm bad!!)
    
    The args don't change on a fork() either.  The only way is to look at
    the parent of all the postgres children.
    
    
    -- 
    Bruce Momjian                          |  830 Blythe Avenue
    maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
      +  If your life is a hard drive,     |  (610) 353-9879(w)
      +  Christ can be your backup.        |  (610) 853-3000(h)
    
    
  7. Re: [HACKERS] removing the exec() from doexec()

    David Gould <dg@illustra.com> — 1998-04-30T06:24:39Z

    > > On Wed, 29 Apr 1998, Bruce Momjian wrote:
    > > 
    > > > No reason for the exec().  I believe the only advantage is that it gives
    > > > us a separate process name in the 'ps' listing.  I have looked into
    > > > simulating this.
    > > 
    > > 	Under FreeBSD, there is:
    > > 
    > > setproctitle(3) - set the process title for ps 1
    > > 
    > > 	This isn't available under Solaris though, last I checked...
    > 
    > Not even BSDI, which is BSD 4.4 like FreeBSD.
    
    ubik:~$ uname -a
    Linux ubik 2.0.32 #1 Wed Nov 19 00:46:45 EST 1997 i586 unknown
    ubik:~$ perl -e '$0 = "it_works!";system "ps p $$"'
      PID TTY STAT  TIME COMMAND
     7629  p8 S    0:00 it_works!                                                  
    
    -dg
    
    
    
    
  8. Re: [HACKERS] removing the exec() from doexec()

    Bruce Momjian <maillist@candle.pha.pa.us> — 1998-04-30T14:18:44Z

    > 
    > > > On Wed, 29 Apr 1998, Bruce Momjian wrote:
    > > > 
    > > > > No reason for the exec().  I believe the only advantage is that it gives
    > > > > us a separate process name in the 'ps' listing.  I have looked into
    > > > > simulating this.
    > > > 
    > > > 	Under FreeBSD, there is:
    > > > 
    > > > setproctitle(3) - set the process title for ps 1
    > > > 
    > > > 	This isn't available under Solaris though, last I checked...
    > > 
    > > Not even BSDI, which is BSD 4.4 like FreeBSD.
    > 
    > ubik:~$ uname -a
    > Linux ubik 2.0.32 #1 Wed Nov 19 00:46:45 EST 1997 i586 unknown
    > ubik:~$ perl -e '$0 = "it_works!";system "ps p $$"'
    >   PID TTY STAT  TIME COMMAND
    >  7629  p8 S    0:00 it_works!                                                  
    
    Let me clarify.  BSDI does not have setproctitle, but the perl test does
    works, sort of:
    
    $ perl -e '$0 = "it_works!";system "ps -p $$"'
      PID  TT  STAT      TIME COMMAND
    13095  pc  S+     0:00.02 it_works! rks! ! (perl)
    
    
    -- 
    Bruce Momjian                          |  830 Blythe Avenue
    maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
      +  If your life is a hard drive,     |  (610) 353-9879(w)
      +  Christ can be your backup.        |  (610) 853-3000(h)