Failed pgbench: setrandom invalid maximum number 0
Seeing the following on an old box I use for testing various
things. Thought it was something to do with my box at first,
but the problem seems to only occur in >= 8.4. But it's also
not pgbench alone, as it was working fine one day, and not the
next. Here's what I now get on 8.4, 9.0, and 9.1:
$ pgbench btest1 -n
setrandom: invalid maximum number 0
Client 0 aborted in state 3. Execution meta-command failed.
transaction type: TPC-B (sort of)
scaling factor: 0
query mode: simple
number of clients: 1
number of threads: 1
number of transactions per client: 10
number of transactions actually processed: 0/10
tps = 0.000000 (including connections establishing)
tps = 0.000000 (excluding connections establishing)
What I get on 8.3 and older is this:
$ pgbench btest1 -n
transaction type: TPC-B (sort of)
scaling factor: 1
number of clients: 1
number of transactions per client: 10
number of transactions actually processed: 10/10
tps = 332.005312 (including connections establishing)
tps = 372.703216 (excluding connections establishing)
Here's a snippet of strace for the failing run:
<<closing .pgpass>>
munmap(0xb773b000, 4096) = 0
socket(PF_FILE, SOCK_STREAM, 0) = 3
fcntl64(3, F_SETFL, O_RDONLY|O_NONBLOCK) = 0
fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
connect(3, {sa_family=AF_FILE, path="/tmp/.s.PGSQL.5900"}, 110) = 0
getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
getsockname(3, {sa_family=AF_FILE, NULL}, [2]) = 0
time(NULL) = 1306638084
time(NULL) = 1306638084
poll([{fd=3, events=POLLOUT|POLLERR}], 1, 10000) = 1 ([{fd=3, revents=POLLOUT}])
send(3, "\0\0\0#\0\3\0\0user\0greg\0database\0btest"..., 35, MSG_NOSIGNAL) = 35
time(NULL) = 1306638084
poll([{fd=3, events=POLLIN|POLLERR}], 1, 10000) = 1 ([{fd=3, revents=POLLIN}])
recv(3, "R\0\0\0\10\0\0\0\0S\0\0\0\26application_name\0\0"..., 16384, 0) = 332
gettimeofday({1306638084, 217401}, NULL) = 0
write(2, "setrandom: invalid maximum numbe"..., 36setrandom: invalid maximum number 0
) = 36
write(2, "Client 0 aborted in state 3. Exe"..., 60Client 0 aborted in state 3. Execution meta-command failed.
) = 60
<<writing all the other lines seen above>>
--
Greg Sabino Mullane greg@endpoint.com
End Point Corporation
PGP Key: 0x14964AC8
Greg Sabino Mullane <greg@endpoint.com> writes:
Seeing the following on an old box I use for testing various
things. Thought it was something to do with my box at first,
but the problem seems to only occur in >= 8.4. But it's also
not pgbench alone, as it was working fine one day, and not the
next. Here's what I now get on 8.4, 9.0, and 9.1:
$ pgbench btest1 -n
setrandom: invalid maximum number 0
That's not valid syntax. Some versions of getopt() take it upon
themselves to rearrange the switch order, some do not ...
regards, tom lane
That's not valid syntax. Some versions of getopt() take it upon
themselves to rearrange the switch order, some do not ...
Sorry: I should have made clear this happens without the -n as well,
I just wanted to make the sample output a little smaller.
--
Greg Sabino Mullane greg@endpoint.com
End Point Corporation
PGP Key: 0x14964AC8
but the problem seems to only occur in >= 8.4. But it's also
Good news and bad news. The good news is that it started occuring on
all versions of pgbench, which makes it more likely to be a problem
with my system rather than pgbench (although that error message
sure is inscrutable). The bad news is I had to reboot the box for
other reasons and I cannot duplicate the issue. Yet. :)
--
Greg Sabino Mullane greg@endpoint.com
End Point Corporation
PGP Key: 0x14964AC8
setrandom: invalid maximum number 0
Okay, nevermind, user error: some other process was deleting a
row from pgbench_branches, and the pgbench.c happily set scale
to 0 from the 'select count(*) from pgbench_branches' query
inside of it, until it gives the totally not-helpful error
seen above later on as it sets :scale to 0, multiplies the tpc_b
default number of branches by zero, and then complains when the
minimum number of branches (1) is less than the max allowed (0).
Oddly enough, the code checks for the count(*) < 0 but not <= 0.
--
Greg Sabino Mullane greg@endpoint.com
End Point Corporation
PGP Key: 0x14964AC8