Thread: Postgres crashed on invalid IP entry in pg_hba.conf
Hi Everybody, Yesterday, our production database was crashed as soon as we added an invlid entry in the pg_hba.conf file. Immediately, after the SIGHUP it tried to read the pg_hba.conf file and it couldnt validate the IP address and restarted the postgres server, as soon as we change the pg_hba.conf with the right entry everything was back to normal. Attached you will see the postgres log file at the time of the crash. Postgres version we are using is 7.4.2. Is this somekind of bug ? if so, is it fixed in Postgres 8 ? shouldnt it just give an error saying invalid IP address instead of restarting postgres ? Thanks! Pallav
pkalva@deg.cc writes: > Yesterday, our production database was crashed as soon as we added an invlid > entry in the pg_hba.conf file. Immediately, after the SIGHUP it tried to read > the pg_hba.conf file and it couldnt validate the IP address and restarted the > postgres server, as soon as we change the pg_hba.conf with the right entry > everything was back to normal. Attached you will see the postgres log file at > the time of the crash. Postgres version we are using is 7.4.2. Works fine for me in 7.4.7 ... I get log entries like this: LOG: invalid IP address "1727.0.0.1" in pg_hba.conf file: Unknown server error LOG: invalid entry in pg_hba.conf file at line 56, token "1727.0.0.1" FATAL: missing or erroneous pg_hba.conf file HINT: See server log for details. and after I fix the pg_hba.conf file it lets me in again. I see no crash. regards, tom lane
Hi Tom, Thanks! for the quick reply actually i forgot to attach the log file in my first email, the next email has the attachment, anyways here is the output from the log file. as you can see i have 5 numbers in the ip address which was a typo and postgres crashes when it reads the hba file with this entry. do you think this problem is specific to the 7.4.2 version . Feb 15 17:30:55 prod postgres[2322]: [702-1] LOG: invalid IP address "100.1.100.1.50" in pg_hba.conf file: Name or service not known Feb 15 17:30:55 prod postgres[13585]: [702-1] LOG: server process (PID 2322) was terminated by signal 11 Feb 15 17:30:55 prod postgres[13585]: [703-1] LOG: terminating any other active server processes Feb 15 17:30:55 prod postgres[13585]: [704-1] LOG: all server processes terminated; reinitializing Feb 15 17:30:55 prod postgres[2323]: [705-1] LOG: database system was interrupted at 2005-02-15 17:30:51 EST Feb 15 17:30:55 prod postgres[2323]: [706-1] LOG: checkpoint record is at D5/796387A8 Feb 15 17:30:55 prod postgres[2323]: [707-1] LOG: redo record is at D5/796387A8; undo record is at 0/0; shutdown TRUE Feb 15 17:30:55 prod postgres[2323]: [708-1] LOG: next transaction ID: 146738745; next OID: 565698175 Feb 15 17:30:55 prod postgres[2323]: [709-1] LOG: database system was not properly shut down; automatic recovery in progress Feb 15 17:30:55 prod postgres[2323]: [710-1] LOG: record with zero length at D5/796387E8 Feb 15 17:30:55 prod postgres[2323]: [711-1] LOG: redo is not required Feb 15 17:30:55 prod postgres[2324]: [705-1] FATAL: the database system is starting up Feb 15 17:30:57 prod postgres[2323]: [712-1] LOG: database system is ready Feb 15 17:30:59 prod postgres[2329]: [705-1] LOG: invalid IP address "100.1.100.1.50" in pg_hba.conf file: Name or service not known Feb 15 17:30:59 prod postgres[2329]: [706-1] LOG: invalid entry in pg_hba.conf file at line 206, token "100.1.100.1.50" Feb 15 17:30:59 prod postgres[2329]: [707-1] FATAL: missing or erroneous pg_hba.conf file Feb 15 17:30:59 prod postgres[2329]: [707-2] HINT: See server log for details. Feb 15 17:30:59 prod postgres[13585]: [705-1] LOG: server process (PID 2329) was terminated by signal 11 Feb 15 17:30:59 prod postgres[13585]: [706-1] LOG: terminating any other active server processes Tom Lane wrote: >pkalva@deg.cc writes: > > >> Yesterday, our production database was crashed as soon as we added an invlid >>entry in the pg_hba.conf file. Immediately, after the SIGHUP it tried to read >>the pg_hba.conf file and it couldnt validate the IP address and restarted the >>postgres server, as soon as we change the pg_hba.conf with the right entry >>everything was back to normal. Attached you will see the postgres log file at >>the time of the crash. Postgres version we are using is 7.4.2. >> >> > >Works fine for me in 7.4.7 ... I get log entries like this: > >LOG: invalid IP address "1727.0.0.1" in pg_hba.conf file: Unknown server error >LOG: invalid entry in pg_hba.conf file at line 56, token "1727.0.0.1" >FATAL: missing or erroneous pg_hba.conf file >HINT: See server log for details. > >and after I fix the pg_hba.conf file it lets me in again. I see no crash. > > regards, tom lane > > >
Pallav Kalva <pkalva@deg.cc> writes: > do you think this problem is specific to the 7.4.2 > version . You didn't say what platform this is, but it might be related to this 7.4.3 fix: 2004-04-24 16:10 tgl * src/backend/libpq/ip.c (REL7_4_STABLE): Ensure getaddrinfo_all returns null result on failure. In any case, you should be on 7.4.7 on general principles. We don't put out dot-releases just for amusement. regards, tom lane
I am using 7.4.2 on Redhat 9 Linux 2.4. I know iam on old version, we are actually planning to move to 8.0.1 soon, I just wanted to know if this is bug if so if it is 7.4.2 related . Tom Lane wrote: >Pallav Kalva <pkalva@deg.cc> writes: > > >>do you think this problem is specific to the 7.4.2 >>version . >> >> > >You didn't say what platform this is, but it might be related to this >7.4.3 fix: > >2004-04-24 16:10 tgl > > * src/backend/libpq/ip.c (REL7_4_STABLE): Ensure getaddrinfo_all > returns null result on failure. > >In any case, you should be on 7.4.7 on general principles. We don't put >out dot-releases just for amusement. > > regards, tom lane > > >
Pallav Kalva wrote: > I am using 7.4.2 on Redhat 9 Linux 2.4. I know iam on old version, we > are actually planning to move to 8.0.1 soon, I just wanted to know if > this is bug if so if it is 7.4.2 related . You just need to stop your server, install 7.4.7 and restart. There is no reason to be running 7.4.2 unless you can't do 2 minutes of downtime. Even if you upgrade to 8.0.1 you will need to do this when 8.0.2 comes out. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073