Hackers,

In guc.c, the maximum for wal_buffers is INT_MAX.  However, wal_buffers
is actually measured in 8KB buffers, not in bytes.  This means that
users are able to set wal_buffers > 2GB.  When the database is started,
this can cause a core dump if the WAL offset is > 2GB.

Attached patch fixes this issue by lowering the maximum for wal_buffers:

josh@Radegast:~/pg94a$ bin/pg_ctl -D data start
server starting
josh@Radegast:~/pg94a$ LOG:  393216 is outside the valid range for
parameter "wal_buffers" (-1 .. 262143)
FATAL:  configuration file "/home/josh/pg94a/data/postgresql.conf"
contains errors

Thanks to Andrew Gierth for diagnosing this issue.

-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
new file mode 100644
index 1b7b914..b3dac51
*** a/src/backend/utils/misc/guc.c
--- b/src/backend/utils/misc/guc.c
*************** static struct config_int ConfigureNamesI
*** 2215,2221 ****
  			GUC_UNIT_XBLOCKS
  		},
  		&XLOGbuffers,
! 		-1, -1, INT_MAX,
  		check_wal_buffers, NULL, NULL
  	},
  
--- 2215,2221 ----
  			GUC_UNIT_XBLOCKS
  		},
  		&XLOGbuffers,
! 		-1, -1, (INT_MAX / XLOG_BLCKSZ),
  		check_wal_buffers, NULL, NULL
  	},
  
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to