Hi Douglas,

I would expect one DB connection per running job as normal.
How do you have Maximum Concurrent Jobs configured?
I'm currently not sure if or why the DB Connection is already opened at 
scheduled time, when
Maximum Concurrent Jobs is less then the number of scheduled jobs.

Regards,

Stephan

On 08/09/2017 05:20 PM, Douglas K. Rand wrote:
> I'm having a problem where Bareos consumes all 150 of my Postgres connections 
> and then backup jobs start to fail with
> the error:
> 
> 06-Aug 21:00 bareos JobId 0: Fatal error: sql_pooling.c:83 Could not open 
> database "bareos": ERR=postgresql.c:246 Unable
> to connect to PostgreSQL server. Database=bareos User=bareos
> Possible causes: SQL server not running; password incorrect; max_connections 
> exceeded.
> 
> I can keep bumping max_connections in Postgres, but there seems to be a 
> problem here. I'm using Bareos 16.2.4 on FreeBSD
> 10.2 with Postgres 9.5.2.
> 
> At a minute before the backups start there are two connections to Postgres:
> 
>  usename |  pid  | state  |                          query
> ---------+-------+--------+---------------------------------------------------------
>  bareos  |  6542 | idle   | SET client_encoding TO 'SQL_ASCII'
>  bareos  | 43277 | active | SELECT usename, pid, state, query FROM 
> pg_stat_activity
> 
> But a minute after backups start there are 96 connections to Postgres, I've 
> attached the status to the email, which is a
> result of:
> 
> psql --pset=pager=off --user=bareos --dbname=bareos --command="SELECT 
> usename, pid, state, query FROM pg_stat_activity"
> 
> lsof -i :postgresql
> 
> ps -axlwwH -U bareos
> 
> As you can see there are 9 UPDATE Media statements running, all via different 
> connections each from a different Bareos
> thread; and 74 SELECT count(*) from Media statements also each from different 
> threads; and then a handful of other
> statements. Each connection is from the Bareos director process, but from 
> what seems to be different threads.
> 
> It almost seems that each scheduled spawns a thread for when that job is 
> scheduled to run (21:00 in my case) and then as
> the backups finish the threads go away, along with the Postgres connection. 
> Here are the number of Postgres connections
> over time:
> 
> 2017-08-08/21:00:00:(2 rows)
> 2017-08-08/21:01:00:(96 rows)
> 2017-08-08/21:02:00:(92 rows)
> 2017-08-08/21:03:00:(94 rows)
> 2017-08-08/21:05:00:(93 rows)
> 2017-08-08/21:06:00:(91 rows)
> 2017-08-08/21:07:00:(89 rows)
> 2017-08-08/21:08:00:(87 rows)
> 2017-08-08/21:09:00:(84 rows)
> 2017-08-08/21:10:00:(78 rows)
> 2017-08-08/21:11:00:(77 rows)
> 2017-08-08/21:12:00:(75 rows)
> 2017-08-08/21:13:00:(72 rows)
> 2017-08-08/21:14:00:(71 rows)
> 2017-08-08/21:15:00:(64 rows)
> 2017-08-08/21:16:00:(63 rows)
> 2017-08-08/21:17:00:(60 rows)
> 2017-08-08/21:18:00:(58 rows)
> 2017-08-08/21:19:00:(56 rows)
> 2017-08-08/21:20:00:(53 rows)
> 2017-08-08/21:21:00:(51 rows)
> 2017-08-08/21:23:00:(48 rows)
> 2017-08-08/21:24:00:(46 rows)
> 2017-08-08/21:25:00:(44 rows)
> 2017-08-08/21:26:00:(43 rows)
> 2017-08-08/21:27:00:(42 rows)
> 2017-08-08/21:28:00:(41 rows)
> 2017-08-08/21:31:00:(40 rows)
> 2017-08-08/21:32:00:(34 rows)
> 2017-08-08/21:33:00:(28 rows)
> 2017-08-08/21:34:00:(24 rows)
> 2017-08-08/21:35:00:(21 rows)
> 2017-08-08/21:36:00:(19 rows)
> 2017-08-08/21:37:00:(13 rows)
> 2017-08-08/21:44:00:(11 rows)
> 2017-08-08/21:51:00:(9 rows)
> 2017-08-08/21:53:00:(7 rows)
> 2017-08-08/21:56:00:(6 rows)
> 2017-08-08/22:47:00:(5 rows)
> 2017-08-09/02:13:00:(4 rows)
> 2017-08-09/02:16:00:(3 rows)
> 
> Backup completes at 02:15
> 

-- 
  Stephan Dühr                              [email protected]
  Bareos GmbH & Co. KG                      Phone: +49 221-630693-90
  http://www.bareos.com

  Sitz der Gesellschaft: Köln | Amtsgericht Köln: HRA 29646
  Komplementär: Bareos Verwaltungs-GmbH
  Geschäftsführer: S. Dühr, M. Außendorf, J. Steffens, Philipp Storz

-- 
You received this message because you are subscribed to the Google Groups 
"bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to