Seg fault in pgbench

Started by Jeff Janesalmost 11 years ago5 messageshackers
Jump to latest
#1Jeff Janes
jeff.janes@gmail.com

If I give pgbench an empty file, I get a segfault.

$ touch empty.sql
$ src/bin/pgbench/pgbench -T 60 -f empty.sql
starting vacuum...end.
Segmentation fault (core dumped)

This has been since this commit:

commit 8bea3d2219844887e170471f223ba100b3c17571
Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Wed Jan 27 02:54:22 2016 +0100

pgbench: improve multi-script support

I wasn't able to figure out which email thread corresponds to this commit.

Thanks,

Jeff

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#2Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Jeff Janes (#1)
Re: Seg fault in pgbench

Jeff Janes wrote:

If I give pgbench an empty file, I get a segfault.

$ touch empty.sql
$ src/bin/pgbench/pgbench -T 60 -f empty.sql
starting vacuum...end.
Segmentation fault (core dumped)

This has been since this commit:

commit 8bea3d2219844887e170471f223ba100b3c17571
Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Wed Jan 27 02:54:22 2016 +0100

pgbench: improve multi-script support

I wasn't able to figure out which email thread corresponds to this commit.

Thanks for the report, will fix.

--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Jeff Janes (#1)
Re: Seg fault in pgbench

Jeff Janes wrote:

If I give pgbench an empty file, I get a segfault.

$ touch empty.sql
$ src/bin/pgbench/pgbench -T 60 -f empty.sql
starting vacuum...end.
Segmentation fault (core dumped)

I fixed this by checking whether the first command is NULL; originally
this case was handled by checking whether the command list itself was
NULL. It could also be fixed by having process_file() return NULL in
the case of an command-less file, but it seemed more churn for no actual
reason, since the case is going to be rejected by exiting the program
anyway.

--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Jeff Janes
jeff.janes@gmail.com
In reply to: Alvaro Herrera (#3)
Re: Seg fault in pgbench

On Fri, Feb 12, 2016 at 12:22 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:

Jeff Janes wrote:

If I give pgbench an empty file, I get a segfault.

$ touch empty.sql
$ src/bin/pgbench/pgbench -T 60 -f empty.sql
starting vacuum...end.
Segmentation fault (core dumped)

I fixed this by checking whether the first command is NULL; originally
this case was handled by checking whether the command list itself was
NULL. It could also be fixed by having process_file() return NULL in
the case of an command-less file, but it seemed more churn for no actual
reason, since the case is going to be rejected by exiting the program
anyway.

Looks good. Thanks.

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#5Fabien COELHO
coelho@cri.ensmp.fr
In reply to: Jeff Janes (#1)
Re: Seg fault in pgbench

If I give pgbench an empty file, I get a segfault.

$ touch empty.sql
$ src/bin/pgbench/pgbench -T 60 -f empty.sql
starting vacuum...end.
Segmentation fault (core dumped)

Oops, shame on me:-(

I should have tested this one, especially as I tested it for other
changes in pgbench...

Thanks for the report, and for Alvaro's fix.

--
Fabien.

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers