On Tue, 19 Jan 2016 14:34:54 +0000 Thom Brown <t...@linux.com> wrote:
> The segfault issue I originally reported now appears to be resolved. > > But now I have another one: > > psql > 'postgresql://thom@127.0.0.1:5530,127.0.0.1:5531,127.0.0.1:5532,127.0.0.1:5533/postgres?hostorder=random&readonly=1&failover_timeout=5' > -c 'show port' > > Segmentation fault This segfault appears to be a simple programming error. which comes out only when we need to retry address list (which happens when no node is available at the time of first scan) There is code which prevents random hostorder to connect same node twice a row while (current != NULL) { if (current == conn->addr_cur) { current = current->ai_next; } count++; if ((rand()&0xffff) < 0x10000 / count) { choice = current; } current = current->ai_next; } There should be continue; after first current = current->ai_next; > This is where no nodes are available. If I remove hostorder=random, > or replace it with hostorder=sequential, it doesn't segfault. > However, it then tries to connect to PGHOST on PGPORT repeatedly, even > if I bring up one of the nodes it should be looking for. Not only > this, but it seems to do it forever if failover_timeout is greater > than 0. But this turns out to be more complicated matter, so I'm not ready to provide next version of patch yet. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers