segasai / q3c

PostgreSQL extension for spatial indexing on a sphere
GNU General Public License v2.0
76 stars 27 forks source link

Creating an index xrashes the instance #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Deploy q3c on 9.0.1 instance with 16kb block size
2. try to create an index whichi crashes the instance,, i.e.:
2011-04-21 14:29:56.811 
CEST,"nienarto","surveys",24251,"::1:37146",4db0232f.5ebb,1,"CREATE 
INDEX",2011-04-21 14:29:35 CEST,5/6,0,ERROR,42883,"function q3c_ang2ipix(double 
precision, double precision) does not exist",,"No function matches the given 
name and argument types. You might need to add explicit type casts.",,,,"CREATE 
INDEX q3c_sources_part_hip_ogle_sdss_cu5_bord_idx ON 
sources_part_hip_ogle_sdss_cu5_bord (q3c_ang2ipix(alpha, delta)); 
",98,"ParseFuncOrColumn, parse_func.c:310","pgAdmin III - Query Tool"
2011-04-21 14:30:09.562 CEST,,,14758,,4d459119.39a6,11,,2011-01-30 17:26:01 
CET,,0,LOG,00000,"server process (PID 24251) was terminated by signal 11: 
Segmentation fault",,,,,,,,"LogChildExit, postmaster.c:2845",""
2011-04-21 14:30:09.562 CEST,,,14758,,4d459119.39a6,12,,2011-01-30 17:26:01 
CET,,0,LOG,00000,"terminating any other active server 
processes",,,,,,,,"HandleChildCrash, postmaster.c:2659",""
2011-04-21 14:30:09.562 
CEST,"oglehip","surveys",23832,"::1:37145",4db022dd.5d18,5,"idle",2011-04-21 
14:28:13 CEST,4/0,0,WARNING,57P02,"terminating connection because of crash of 
another server process","The postmaster has commanded this server process to 
roll back the current transaction and exit, because another server process 
exited abnormally and possibly corrupted shared memory.","In a moment you 
should be able to reconnect to the database and repeat your 
command.",,,,,,"quickdie, postgres.c:2626","pgAdmin III - Query Tool"
2011-04-21 14:30:09.562 
CEST,"oglehip","surveys",23827,"::1:37144",4db022da.5d13,1,"idle",2011-04-21 
14:28:10 CEST,3/0,0,WARNING,57P02,"terminating connection because of crash of 
another server process","The postmaster has commanded this server process to 
roll back the current transaction and exit, because another server process 
exited abnormally and possibly corrupted shared memory.","In a moment you 
should be able to reconnect to the database and repeat your 
command.",,,,,,"quickdie, postgres.c:2626","pgAdmin III - Browser"
2011-04-21 14:30:09.562 CEST,,,23419,,4db0228b.5b7b,2,,2011-04-21 14:26:51 
CEST,1/0,0,WARNING,57P02,"terminating connection because of crash of another 
server process","The postmaster has commanded this server process to roll back 
the current transaction and exit, because another server process exited 
abnormally and possibly corrupted shared memory.","In a moment you should be 
able to reconnect to the database and repeat your command.",,,,,,"quickdie, 
postgres.c:2626",""

What is the expected output? What do you see instead?
well, index created

What version of the product are you using? On what operating system?
in-house compiled PG: 9.0.1, ubuntu 10.10 x64 2.6.32-26-generic #48-Ubuntu SMP 
Wed Nov 24 10:14:11 UTC 2010 x86_64 GNU/Linux

Cheers,
Krzysztof

Original issue reported on code.google.com by krzyszto...@gmail.com on 21 Apr 2011 at 12:10

GoogleCodeExporter commented 9 years ago
Additional note:
seems it does not crash if there are less then million records included in the 
index. the same happens for the query creating temp table.

Original comment by krzyszto...@gmail.com on 21 Apr 2011 at 12:43

GoogleCodeExporter commented 9 years ago
Hi, 

Sorry, I didn't see the bug report earlier (and code.google.com doesn't send 
the notifications by default). 

But I wasn't able to replicate the issue: (64 bit debian, PG 9.0.1 and 9.0.4 
compiled with --block-size=16).
The regression test of q3c worked fine and the following small test worked too:

q3ctest=# CREATE TABLE tmp( ra double precision, dec double precision);
CREATE TABLE
q3ctest=# INSERT INTO tmp select random()*400-10, random()*200-100 from 
generate_series(0,10000000);
INSERT 0 10000001
q3ctest=# CREATE INDEX q3c_idx on tmp(q3c_ang2ipix(ra,dec)) ;
CREATE INDEX
q3ctest=# VACUUM ANALYZE tmp;
q3ctest=# select * from  tmp where q3c_radial_query(ra,dec,180,1,0.1);
        ra        |        dec
------------------+-------------------
.....
q3ctest=# show block_size ;
 block_size
------------
 16384
(1 row)

If you still experience the issue(and interested in solving it), it would be 
nice to get a gdb stacktrace and/or the the list of  ras,decs on which index 
creation fails

Original comment by koposov on 10 Jun 2011 at 3:08

GoogleCodeExporter commented 9 years ago
Hello,
Thanks for checking this.
I'll try to prepare the test case, I did not check what exact values caused the 
exception so will have to scan the table in greater detail.
Cheers,
Krzysztof

Original comment by Krzyszto...@gmail.com on 10 Jun 2011 at 5:34

GoogleCodeExporter commented 9 years ago
Actually I just noticed google skipped additional information I posted after I 
found out that very big values for ra,dec were triggering this error. Synthetic 
creation of similarly looking values did not crash the backend, so I will have 
to use real data to get the stacktrace. 

Original comment by Krzyszto...@gmail.com on 10 Jun 2011 at 6:01

GoogleCodeExporter commented 9 years ago
Hi Krzysztof, 

I think I fixed the issue in r122 .

Before the patch I was able to crash the backend by doing this: 

select sum(q3c_ang2ipix(pow(random()*100,100*random()),random())) from
   generate_series(0,1000);

Now it doesn't crash anymore. I will put the official release in a few days 
time, but you can just grab the updated q3cube.c from the repository.

Thanks for reporting the issue.

Sergey

Original comment by koposov on 10 Jun 2011 at 1:23

GoogleCodeExporter commented 9 years ago
Just in case, I've released 1.4.11 version which fixes your issue.

Original comment by koposov on 13 Jun 2011 at 4:02