Re: pgbench bug candidate: negative "initial connection time"
Fabien COELHO <coelho@cri.ensmp.fr>
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: "kuroda.hayato@fujitsu.com" <kuroda.hayato@fujitsu.com>
Cc: "'pgsql-hackers@lists.postgresql.org'"
<pgsql-hackers@lists.postgresql.org>
Date: 2021-06-11T14:57:35Z
Lists: pgsql-hackers
Hello Hayato-san, > I played pgbench with wrong parameters, That's good:-) > and I found bug-candidate. > > 1. Do initdb and start. > 2. Initialize schema and data with "scale factor" = 1. > 3. execute following command many times: > > $ pgbench -c 101 -j 10 postgres > > Then, sometimes the negative " initial connection time" was returned. > Lateyncy average is also strange. > > ``` > $ pgbench -c 101 -j 10 postgres > starting vacuum...end. > pgbench: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: sorry, too many clients already Hmmm. AFAICR there was a decision to generate a report even if something went very wrong, in this case some client could not connect, so some values are not initialized, hence the absurd figures, as you show below. Maybe we should revisit this decision. > initial connection time = -372896921.586 ms > I sought pgbench.c and found a reason. > When a thread failed to get some connections, they do not fill any values to thread->bench_start in threadRun(). > And if the failure is caused in the final thread (this means threads[nthreads - 1]->bench_start is zero), > the following if-statement sets bench_start to zero. > I cannot distinguish whether we have to fix it, but I attache the patch. > This simply ignores a result when therad->bench_start is zero. > How do you think? Hmmm. Possibly. Another option could be not to report anything after some errors. I'm not sure, because it would depend on the use case. I guess the command returned an error status as well. I'm going to give it some thoughts. -- Fabien.
Commits
-
pgbench: Fix typo in comment.
- d8dba4d03068 15.0 landed
-
pgbench: Improve error-handling in pgbench.
- cd29be5459f0 15.0 landed
-
pgbench: Fix handling of socket errors during benchmark.
- c5f7e702d78f 12.9 landed
- 8cf4f7118596 13.5 landed
- 8231c500ed74 14.1 landed
- 2acb7cc6b56c 15.0 landed
-
pgbench: Correct log level of message output when socket wait method fails.
- 3cc85d7d5353 13.5 landed
- 8021334d3710 14.1 landed
- d33674708948 15.0 landed
-
pgbench: Synchronize client threads.
- aeb57af8e640 14.0 cited
-
pgbench: Use common logging API
- 30a3e772b401 13.0 cited