View Issue Details

IDProjectCategoryView StatusLast Update
0000094Pgpool-IIBugpublic2015-01-08 16:13
Reporterhootfrancois Assigned Tonagata  
PriorityurgentSeveritycrashReproducibilityalways
Status closedResolutionfixed 
PlatformLinuxOSUbuntuOS Version12.04 LTS
Summary0000094: Segfaults when using ORDER in parallel mode
DescriptionWe're using parallel mode, which works great for most things, but it chokes when we try to use ORDER in a SELECT query. The child process reports a segfault and dies.

kernel: [154998.501807] pgpool[14952]: segfault at 10 ip 00000000004271e9 sp 00007fff1974d170 error 4 in pgpool[400000+109000]
Steps To Reproduce- Make sure hstore is available
CREATE EXTENSION hstore;

- Create a table (on 2 or more nodes)
CREATE TABLE autocomplete (
    id character varying(100) NOT NULL,
    extra_data hstore,
    username character varying(254),
    member_id bigint
);

- Run a SQL query through pgPool
SELECT * FROM autocomplete ORDER BY member_id
Additional InformationHere's a backtrace.

#0 0x0000000000437cd9 in rewrite_query_stmt (node=0x11349b8, frontend=0x111edf0, backend=0x111d310, message=0x724da0) at parallel_query/pool_rewrite_query.c:385
0000001 0x0000000000438571 in pool_do_parallel_query (frontend=0x111edf0, backend=0x111d310, node=0x11349b8, parallel=0x7fffaf69f608 "\001", string=0x7fffaf69f5f0,
    len=0x7fffaf69f5fc) at parallel_query/pool_rewrite_query.c:694
0000002 0x0000000000427b37 in SimpleQuery (frontend=0x111edf0, backend=0x111d310, len=47, contents=0x111d190 "SELECT * FROM autocomplete ORDER BY member_id;")
    at protocol/pool_proto_modules.c:278
0000003 0x000000000042cde4 in ProcessFrontendResponse (frontend=0x111edf0, backend=0x111d310) at protocol/pool_proto_modules.c:2483
0000004 0x0000000000421ebd in read_packets_and_process (frontend=<optimized out>, backend=0x111d310, reset_request=0, state=0x7fffaf69fd14, num_fields=0x7fffaf69fd1c,
    cont=0x7fffaf69fd1f "\001@Er") at protocol/pool_process_query.c:4966
0000005 0x0000000000422419 in pool_process_query (frontend=0x111edf0, backend=0x111d310, reset_request=0) at protocol/pool_process_query.c:260
0000006 0x000000000041e202 in do_child (unix_fd=4, inet_fd=<optimized out>) at protocol/child.c:374
0000007 0x0000000000407edf in fork_a_child (unix_fd=4, inet_fd=5, id=0) at main/main.c:1227
0000008 0x000000000040861a in reaper () at main/main.c:2446
0000009 reaper () at main/main.c:2358
0000010 0x0000000000406bab in main (argc=<optimized out>, argv=<optimized out>) at main/main.c:684
TagsNo tags attached.

Activities

hootfrancois

2014-02-08 06:16

reporter   ~0000391

The same thing happens when I use LIMIT instead of ORDER.

hootfrancois

2014-02-08 07:12

reporter   ~0000392

And COUNT(*)

hootfrancois

2014-02-19 07:27

reporter   ~0000393

I figured out what the cause of these segfaults are.

I had configured the parallel processing's host as '' because I wanted it to use a socket instead of TCP as per the documentation. It did work because INSERT queries would save data on the right backend but the log had all sorts of errors in it. I changed the host to 'localhost' and the problem went away.

You may want to investigate what's going on there and gracefully handle the issue.

Thank you! :)

nagata

2014-02-28 18:03

developer   ~0000396

Thanks for your reporting.

I fixed this. When system_db_hostname was empty string, initialization
of connection to system DB failed, and this caused the segfault.

I attached patch for pgpool-II 3.3.

If your pgpool's version is different and patch doesn't work, please tell
me or get the latest version from the git repository.
http://git.postgresql.org/gitweb/?p=pgpool2.git;a=summary

nagata

2014-02-28 18:04

developer  

parallel_segfault.patch (65,408 bytes)   
parallel_segfault.patch (65,408 bytes)   

Issue History

Date Modified Username Field Change
2014-02-08 06:13 hootfrancois New Issue
2014-02-08 06:16 hootfrancois Note Added: 0000391
2014-02-08 07:12 hootfrancois Note Added: 0000392
2014-02-19 07:27 hootfrancois Note Added: 0000393
2014-02-26 16:41 nagata Assigned To => nagata
2014-02-26 16:41 nagata Status new => assigned
2014-02-28 18:03 nagata Note Added: 0000396
2014-02-28 18:04 nagata File Added: parallel_segfault.patch
2015-01-08 16:13 nagata Status assigned => closed
2015-01-08 16:13 nagata Resolution open => fixed