agroal / pgagroal

High-performance connection pool for PostgreSQL
https://agroal.github.io/pgagroal/
BSD 3-Clause "New" or "Revised" License
667 stars 59 forks source link

Connection error at the bottom of `status details` #413

Closed fluca1978 closed 3 months ago

fluca1978 commented 3 months ago

On d9f9253504605194b6bac1dd18491f132059b145 the connection goes into an error when dealing with status details:

% pgagroal-cli status details
Status:              Running
Active connections:  0
Total connections:   1
Max connections:     15
---------------------
Server:              rachel
Host:                localhost
Port:                5432
State:               Primary
---------------------
---------------------
Server:              a
Host:                spengler
Port:                5432
State:               Not init
---------------------
---------------------
Server:              b
Host:                spengler
Port:                6432
State:               Not init
---------------------
---------------------
Database:            testdb
Username:            luca
Active connections:  0
Max connections:     2
Initial connections: 1
Min connections:     1
---------------------
Connection    0:     Primary         2024-03-18 09:02:05        21     luca testdb 
Connection    1:     Not init                                            
Connection    2:     Not init                                            
Connection    3:     Not init                                            
Connection    4:     Not init                                            
Connection    5:     Not init                                            
Connection    6:     Not init                                            
Connection    7:     Not init                                            
Connection    8:     Not init                                            
Connection    9:     Not init                                            
Connection   10:     Not init                                            
Connection   11:     Not init                                            
Connection   12:     Not init                                            
Connection   13:     Not init                                            
Connection   14:     Not init            
Connection error on /tmp

It seems at glance a problem with handling the last line of the command result.Does not happen with JSON output:

% pgagroal-cli status details --format json
{
        "command":      {
                "name": "status details",
                "status":       "OK",
                "error":        0,
                "exit-status":  0,
                "output":       {
                        "status":       {
                                "message":      "Running",
                                "status":       1
                        },
                        "connections":  {
                                "active":       0,
                                "total":        1,
                                "max":  15,
                                "list": [{
                                                "number":       0,
                                                "state":        "Primary",
                                                "time": "2024-03-18 09:05:15",
                                                "pid":  "",
                                                "fd":   "21",
                                                "database":     "testdb",
                                                "user": "luca",
                                                "detail":       ""
                                        }, {
                                                "number":       1,
                                                "state":        "Not init",
                                                "time": "",
                                                "pid":  "",
                                                "fd":   "",
                                                "database":     "",
                                                "user": "",
                                                "detail":       ""
                                        }, {
                                                "number":       2,
                                                "state":        "Not init",
                                                "time": "",
                                                "pid":  "",
                                                "fd":   "",
                                                "database":     "",
                                                "user": "",
                                                "detail":       ""
                                        }, {
                                                "number":       3,
                                                "state":        "Not init",
                                                "time": "",
                                                "pid":  "",
                                                "fd":   "",
                                                "database":     "",
                                                "user": "",
                                                "detail":       ""
                                        }, {
                                                "number":       4,
                                                "state":        "Not init",
                                                "time": "",
                                                "pid":  "",
                                                "fd":   "",
                                                "database":     "",
                                                "user": "",
                                                "detail":       ""
                                        }, {
                                                "number":       5,
                                                "state":        "Not init",
                                                "time": "",
                                                "pid":  "",
                                                "fd":   "",
                                                "database":     "",
                                                "user": "",
                                                "detail":       ""
                                        }, {
                                                "number":       6,
                                                "state":        "Not init",
                                                "time": "",
                                                "pid":  "",
                                                "fd":   "",
                                                "database":     "",
                                                "user": "",
                                                "detail":       ""
                                        }, {
                                                "number":       7,
                                                "state":        "Not init",
                                                "time": "",
                                                "pid":  "",
                                                "fd":   "",
                                                "database":     "",
                                                "user": "",
                                                "detail":       ""
                                        }, {
                                                "number":       8,
                                                "state":        "Not init",
                                                "time": "",
                                                "pid":  "",
                                                "fd":   "",
                                                "database":     "",
                                                "user": "",
                                                "detail":       ""
                                        }, {
                                                "number":       9,
                                                "state":        "Not init",
                                                "time": "",
                                                "pid":  "",
                                                "fd":   "",
                                                "database":     "",
                                                "user": "",
                                                "detail":       ""
                                        }, {
                                                "number":       10,
                                                "state":        "Not init",
                                                "time": "",
                                                "pid":  "",
                                                "fd":   "",
                                                "database":     "",
                                                "user": "",
                                                "detail":       ""
                                        }, {
                                                "number":       11,
                                                "state":        "Not init",
                                                "time": "",
                                                "pid":  "",
                                                "fd":   "",
                                                "database":     "",
                                                "user": "",
                                                "detail":       ""
                                        }, {
                                                "number":       12,
                                                "state":        "Not init",
                                                "time": "",
                                                "pid":  "",
                                                "fd":   "",
                                                "database":     "",
                                                "user": "",
                                                "detail":       ""
                                        }, {
                                                "number":       13,
                                                "state":        "Not init",
                                                "time": "",
                                                "pid":  "",
                                                "fd":   "",
                                                "database":     "",
                                                "user": "",
                                                "detail":       ""
                                        }, {
                                                "number":       14,
                                                "state":        "Not init",
                                                "time": "",
                                                "pid":  "",
                                                "fd":   "",
                                                "database":     "",
                                                "user": "",
                                                "detail":       ""
                                        }]
                        },
                        "databases":    {
                                "disabled":     {
                                        "count":        0,
                                        "state":        "disabled",
                                        "list": []
                                }
                        },
                        "servers":      {
                                "count":        3,
                                "list": [{
                                                "server":       "rachel",
                                                "host": "localhost",
                                                "port": 5432,
                                                "state":        "Primary"
                                        }, {
                                                "server":       "a",
                                                "host": "spengler",
                                                "port": 5432,
                                                "state":        "Not init"
                                        }, {
                                                "server":       "b",
                                                "host": "spengler",
                                                "port": 6432,
                                                "state":        "Not init"
                                        }]
                        },
                        "limits":       {
                                "list": [{
                                                "database":     "testdb",
                                                "username":     "luca",
                                                "connections":  {
                                                        "active":       0,
                                                        "max":  2,
                                                        "initial":      1,
                                                        "min":  1
                                                }
                                        }],
                                "count":        1
                        }
                }
        },
        "application":  {
                "name": "pgagroal-cli",
                "major":        1,
                "minor":        7,
                "patch":        0,
                "version":      "1.7.0"
        }
}
jesperpedersen commented 3 months ago

There is

---------------------
---------------------

as well... either one line or information in-between