[Pgsql-ayuda] Conexiones y finalización de procesos postgres

Jose Joaquin Lorente Garcia jlorente@unesco.upv.es
Thu, 7 Aug 2003 13:42:42 +0200


Hola estimados compañeros,

Trabajando con conexiones locales desde un servidor apache utilizando PHP a una base de datos postgres hemos detectado que en un principio los procesos postgres que atienden el query responden a la petición pero después no "mueren" o ejecutan "exit(0)" (ver más abajo fichero LOG de postgres con la opción DEBUG1 para detalles). Esto implica que postgres alcanza rápidamente el límite de conexiones concurrentes y lo peor no es esto, sino que súbitamente postgres dedice "morir".
Gracias por vuestra colaboración

JJ

============================================================================
[4982]   DEBUG:  /usr/local/pgsql/bin/postmaster: PostmasterMain: initial environ dump:
[4982]   DEBUG:  -----------------------------------------
[4982]   DEBUG:   HOME=/usr/local/pgsql
[4982]   DEBUG:   HZ=
[4982]   DEBUG:   LOGNAME=postgres
[4982]   DEBUG:   PATH=/usr/bin:
[4982]   DEBUG:   PGDATA=/forumUNESCO/base_datos/bda_sql
[4982]   DEBUG:   SHELL=/bin/sh
[4982]   DEBUG:   TERM=dtterm
[4982]   DEBUG:   TZ=WET
[4982]   DEBUG:  -----------------------------------------
[4982]   DEBUG:  FindExec: found "/usr/local/pgsql/bin/postgres" using argv[0]
[4982]   DEBUG:  invoking IpcMemoryCreate(size=1466368)
[4982]   DEBUG:  FindExec: found "/usr/local/pgsql/bin/postmaster" using argv[0]
[4988]   LOG:  database system was shut down at 2003-08-07 12:54:48 WET DST
[4988]   LOG:  checkpoint record is at 0/B699D0
[4988]   LOG:  redo record is at 0/B699D0; undo record is at 0/0; shutdown TRUE
[4988]   LOG:  next transaction id: 1252; next oid: 19440
[4988]   LOG:  database system is ready
[4988]   DEBUG:  proc_exit(0)
[4988]   DEBUG:  shmem_exit(0)
[4988]   DEBUG:  exit(0)
[4982]   DEBUG:  reaping dead processes
[4990]   LOG:  connection received: host=[local]
[4990]   LOG:  connection authorized: user=postgres database=template1
[4990]   DEBUG:  /usr/local/pgsql/bin/postmaster child[4990]: starting with (
[4990]   DEBUG:   postgres
[4990]   DEBUG:   -v131072
[4990]   DEBUG:   -p
[4990]   DEBUG:   template1
[4990]   DEBUG:  )
[4990]   DEBUG:  InitPostgres
[4990]   DEBUG:  StartTransactionCommand
[4990]   LOG:  query: begin; select getdatabaseencoding(); commit
[4990]   DEBUG:  ProcessUtility
[4990]   DEBUG:  CommitTransactionCommand
[4990]   DEBUG:  StartTransactionCommand
[4982]   DEBUG:  BackendStartup: forked pid=4990 socket=9
[4990]   DEBUG:  ProcessQuery
[4990]   DEBUG:  ProcessUtility
[4990]   DEBUG:  CommitTransactionCommand
[4990]   LOG:  duration: 0.002297 sec
[4990]   DEBUG:  StartTransactionCommand
[4990]   LOG:  query: SELECT d.datname as "Name",
       u.usename as "Owner",
       pg_catalog.pg_encoding_to_char(d.encoding) as "Encoding"
FROM pg_catalog.pg_database d
  LEFT JOIN pg_catalog.pg_user u ON d.datdba = u.usesysid
ORDER BY 1;
[4990]   DEBUG:  ProcessQuery
[4990]   DEBUG:  CommitTransactionCommand
[4990]   LOG:  duration: 0.050320 sec
[4990]   DEBUG:  proc_exit(0)
[4990]   DEBUG:  shmem_exit(0)
[4990]   DEBUG:  exit(0)
[4982]   DEBUG:  reaping dead processes
[4982]   DEBUG:  child process (pid 4990) exited with exit code 0



[4995]   LOG:  connection received: host=127.0.0.1 port=32866
[4995]   LOG:  connection authorized: user=sutorru database=website_fuup
[4995]   DEBUG:  /usr/local/pgsql/bin/postmaster child[4995]: starting with (
[4995]   DEBUG:   postgres
[4995]   DEBUG:   -v131072
[4995]   DEBUG:   -p
[4995]   DEBUG:   website_fuup
[4995]   DEBUG:  )
[4995]   DEBUG:  InitPostgres
[4995]   DEBUG:  StartTransactionCommand
[4995]   LOG:  query: begin; select getdatabaseencoding(); commit
[4995]   DEBUG:  ProcessUtility
[4995]   DEBUG:  CommitTransactionCommand
[4995]   DEBUG:  StartTransactionCommand
[4982]   DEBUG:  BackendStartup: forked pid=4995 socket=9
[4995]   DEBUG:  ProcessQuery
[4995]   DEBUG:  ProcessUtility
[4995]   DEBUG:  CommitTransactionCommand
[4995]   LOG:  duration: 0.001531 sec
[4995]   DEBUG:  StartTransactionCommand
[4995]   LOG:  query: SELECT termino_esp, pagina_esp, notas_esp, termino, url FROM indice_fuup ORDER BY termino_esp, pagina_esp;
[4995]   DEBUG:  ProcessQuery
[4995]   DEBUG:  CommitTransactionCommand
[4995]   LOG:  duration: 0.045606 sec
[4995]   DEBUG:  StartTransactionCommand
[4995]   LOG:  query: BEGIN;ROLLBACK;
[4995]   DEBUG:  ProcessUtility
[4995]   DEBUG:  CommitTransactionCommand
[4995]   DEBUG:  StartTransactionCommand
[4995]   DEBUG:  ProcessUtility
[4995]   DEBUG:  CommitTransactionCommand
[4995]   LOG:  duration: 0.000002 sec


[5001]   DEBUG:  proc_exit(0)
[5001]   DEBUG:  shmem_exit(0)
[5001]   DEBUG:  exit(0)

[4982]   DEBUG:  reaping dead processes
[4982]   DEBUG:  child process (pid 5001) exited with exit code 0
[5020]   DEBUG:  proc_exit(0)
[5020]   DEBUG:  shmem_exit(0)
[5020]   DEBUG:  exit(0)
[4982]   DEBUG:  reaping dead processes
[4982]   DEBUG:  child process (pid 5020) exited with exit code 0
[5045]   DEBUG:  proc_exit(0)
[5045]   DEBUG:  shmem_exit(0)
[5045]   DEBUG:  exit(0)
[4982]   DEBUG:  reaping dead processes
[4982]   DEBUG:  child process (pid 5045) exited with exit code 0
[5066]   DEBUG:  proc_exit(0)
[5066]   DEBUG:  shmem_exit(0)
[5066]   DEBUG:  exit(0)
[4982]   DEBUG:  reaping dead processes
[4982]   DEBUG:  child process (pid 5066) exited with exit code 0
[5071]   LOG:  connection received: host=127.0.0.1 port=32867
[5071]   LOG:  connection authorized: user=sutorru database=website_fuup
[5071]   DEBUG:  /usr/local/pgsql/bin/postmaster child[5071]: starting with (
[5071]   DEBUG:   postgres
[5071]   DEBUG:   -v131072
[5071]   DEBUG:   -p
[5071]   DEBUG:   website_fuup
[5071]   DEBUG:  )
[5071]   DEBUG:  InitPostgres
[5071]   DEBUG:  StartTransactionCommand
[5071]   LOG:  query: begin; select getdatabaseencoding(); commit
[5071]   DEBUG:  ProcessUtility
[5071]   DEBUG:  CommitTransactionCommand
[5071]   DEBUG:  StartTransactionCommand
[5071]   DEBUG:  ProcessQuery
[5071]   DEBUG:  ProcessUtility
[5071]   DEBUG:  CommitTransactionCommand
[5071]   LOG:  duration: 0.009020 sec
[5071]   DEBUG:  StartTransactionCommand
[5071]   LOG:  query: SELECT * 
      FROM sedes_fuup 
   WHERE continente_esp='África'
   ORDER BY pais_esp, sedenombre, tipocontacto, nombre, apellidos, sexo
[4982]   DEBUG:  BackendStartup: forked pid=5071 socket=9
[5071]   DEBUG:  ProcessQuery
[5071]   DEBUG:  CommitTransactionCommand
[5071]   LOG:  duration: 0.086630 sec
[5071]   DEBUG:  StartTransactionCommand
[5071]   LOG:  query: BEGIN;ROLLBACK;
[5071]   DEBUG:  ProcessUtility
[5071]   DEBUG:  CommitTransactionCommand
[5071]   DEBUG:  StartTransactionCommand
[5071]   DEBUG:  ProcessUtility
[5071]   DEBUG:  CommitTransactionCommand
[5071]   LOG:  duration: 0.002850 sec
[5079]   DEBUG:  proc_exit(0)
[5079]   DEBUG:  shmem_exit(0)
[5079]   DEBUG:  exit(0)
[4982]   DEBUG:  reaping dead processes
[4982]   DEBUG:  child process (pid 5079) exited with exit code 0
[4982]   DEBUG:  pmdie 2
[4982]   LOG:  fast shutdown request
[4982]   LOG:  aborting any active transactions
[4982]   DEBUG:  SignalChildren: sending signal 15 to process 5071
[4982]   DEBUG:  SignalChildren: sending signal 15 to process 4995
[4995]   FATAL:  This connection has been terminated by the administrator.
[4995]   DEBUG:  proc_exit(0)
[4995]   DEBUG:  shmem_exit(0)
[4995]   DEBUG:  exit(0)
[4982]   DEBUG:  reaping dead processes
[4982]   DEBUG:  child process (pid 4995) exited with exit code 0
[5071]   FATAL:  This connection has been terminated by the administrator.
[5071]   DEBUG:  proc_exit(0)
[5071]   DEBUG:  shmem_exit(0)
[5071]   DEBUG:  exit(0)
[4982]   DEBUG:  reaping dead processes
[4982]   DEBUG:  child process (pid 5071) exited with exit code 0
[5080]   LOG:  shutting down
[5080]   LOG:  database system is shut down
[5080]   DEBUG:  proc_exit(0)
[5080]   DEBUG:  shmem_exit(0)
[5080]   DEBUG:  exit(0)
[4982]   DEBUG:  reaping dead processes
[4982]   DEBUG:  proc_exit(0)
[4982]   DEBUG:  shmem_exit(0)
[4982]   DEBUG:  exit(0)