Обсуждение: seg fault with tsearch2

Поиск
Список
Период
Сортировка

seg fault with tsearch2

От
Joel Leyh
Дата:
I have Pg installed on i386 NetBSD from the NetBSD package manager. I
then installed tsearch2 and used its default installation.
I then also got the source and built from it, with debugging enabled.
Again I installed tsearch2 but my results were the same.

Created a new database, added a table with:

CREATE TABLE server_file (
    server_file_id serial NOT NULL,
    server_id integer NOT NULL,
    server_file_path text NOT NULL,
    server_file_name text NOT NULL,
    server_file_ext character varying(20),
    server_file_size integer NOT NULL,
    server_file_index tsvector,
    protocol_id integer NOT NULL
);

ALTER TABLE ONLY server_file
    ADD CONSTRAINT server_file_pkey PRIMARY KEY (server_file_id);

CREATE INDEX server_file_indexindex ON server_file USING gist
(server_file_index);

CREATE TRIGGER tsvectorupdate
    BEFORE INSERT OR UPDATE ON server_file
    FOR EACH ROW
    EXECUTE PROCEDURE tsearch2('server_file_index',
'server_file_name', 'server_file_path');

---------------Query executed:

 insert into server_file values (default,'511','/test/20-Shania
Twain-Party For Two with Billy
Curringtonmp3','mp3','323',default,'1');


---------------Output from gdb------------

   Program received signal SIGSEGV, Segmentation fault.
0x48b22c84 in find_among () from /usr/pkg/lib/tsearch2.so

#0  0x48b22c84 in find_among () from /usr/pkg/lib/tsearch2.so
#1  0x48b21d02 in ts_stat () from /usr/pkg/lib/tsearch2.so
#2  0x48b21e58 in english_stem () from /usr/pkg/lib/tsearch2.so
#3  0x48b14383 in snb_lexize () from /usr/pkg/lib/tsearch2.so
#4  0x081cdf59 in FunctionCall3 (flinfo=<incomplete type>, arg1=137034080,
    arg2=137063728, arg3=11) at fmgr.c:1164
#5  0x48b17bf5 in parsetext_v2 () from /usr/pkg/lib/tsearch2.so
#6  0x48b1a5e4 in tsearch2 () from /usr/pkg/lib/tsearch2.so
#7  0x080f25c7 in ExecCallTriggerFunc (trigdata=0xbfbff670,
    finfo=<incomplete type>, per_tuple_context=<incomplete type>)
    at trigger.c:1149
#8  0x080f2885 in ExecBRInsertTriggers (estate=<incomplete type>,
    relinfo=<incomplete type>, trigtuple=<incomplete type>) at trigger.c:1261
#9  0x081032dd in ExecInsert (slot=<incomplete type>,
    tupleid=<incomplete type>, estate=<incomplete type>) at execMain.c:1344
#10 0x08102f9e in ExecutePlan (estate=<incomplete type>,
    planstate=<incomplete type>, operation=<incomplete type>, numberTuples=0,
    direction=<incomplete type>, dest=<error type>) at execMain.c:1207
#11 0x081023d6 in ExecutorRun (queryDesc=0x8349440,
    direction=<incomplete type>, count=0) at execMain.c:226
#12 0x0816d629 in ProcessQuery (parsetree=<error type>, plan=<error type>,
    params=<error type>, dest=<error type>, completionTag=0xbfbff910 "")
    at pquery.c:173
#13 0x0816e385 in PortalRunMulti (portal=<error type>, dest=<error type>,
    altdest=<error type>, completionTag=0xbfbff910 "") at pquery.c:1016
#14 0x0816dd76 in PortalRun (portal=<error type>, count=2147483647,
    dest=<error type>, altdest=<error type>, completionTag=0xbfbff910 "")
    at pquery.c:617
#15 0x0816a76a in exec_simple_query (query_string=<incomplete type>)
    at postgres.c:933
#16 0x0816c979 in PostgresMain (argc=4, argv=<incomplete type>,
    username=<incomplete type>) at postgres.c:3007
#17 0x0811b4ed in main (argc=4, argv=<incomplete type>) at main.c:334
#18 0x08072122 in ___start ()

Re: seg fault with tsearch2

От
Tom Lane
Дата:
Joel Leyh <hashbang@gmail.com> writes:
>  insert into server_file values (default,'511','/test/20-Shania
> Twain-Party For Two with Billy
> Curringtonmp3','mp3','323',default,'1');

I get
ERROR:  null value in column "server_file_size" violates not-null constraint
which I think indicates you mistranscribed your test query.  I changed
it to

regression=# insert into server_file values (default,'511','/test/','Shania
regression'# Twain-Party For Two with Billy
regression'# Curringtonmp3','mp3','323',default,'1');
INSERT 155964 1

and as you can see I didn't get a crash.  I'm testing with 8.0.2-to-be
(ie, 8.0 branch CVS tip).  Teodor applied some tsearch2 fixes just last
week, so it might be that he fixed your bug --- what version are you
using exactly?

            regards, tom lane

Re: seg fault with tsearch2

От
Joel Leyh
Дата:
Ah ok. I must have copied it incorectly. I am using 8.0.1 from the
latest binary build from NetBSD. The source I used was
postgresql-8.0.1.tar.bz2 stable release.
I will try the CVS release to see if it's fixed.
--Joel

On Apr 7, 2005 12:26 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Joel Leyh <hashbang@gmail.com> writes:
> >  insert into server_file values (default,'511','/test/20-Shania
> > Twain-Party For Two with Billy
> > Curringtonmp3','mp3','323',default,'1');
>
> I get
> ERROR:  null value in column "server_file_size" violates not-null constraint
> which I think indicates you mistranscribed your test query.  I changed
> it to
>
> regression=# insert into server_file values (default,'511','/test/','Shania
> regression'# Twain-Party For Two with Billy
> regression'# Curringtonmp3','mp3','323',default,'1');
> INSERT 155964 1
>
> and as you can see I didn't get a crash.  I'm testing with 8.0.2-to-be
> (ie, 8.0 branch CVS tip).  Teodor applied some tsearch2 fixes just last
> week, so it might be that he fixed your bug --- what version are you
> using exactly?
>
>                         regards, tom lane
>

Re: seg fault with tsearch2

От
Tom Lane
Дата:
Joel Leyh <hashbang@gmail.com> writes:
> Ah ok. I must have copied it incorectly. I am using 8.0.1 from the
> latest binary build from NetBSD. The source I used was
> postgresql-8.0.1.tar.bz2 stable release.

Hmm.  I found I still had an older copy of tsearch2 on my other machine,
but I couldn't duplicate the crash there either, so now I'm not sure
what's up.  Would you send the corrected version of your test query?

            regards, tom lane

Re: seg fault with tsearch2

От
Joel Leyh
Дата:
I compiled 8.0.1 on linux with --with-debug only, and it seemed to
work. I had also compiled 8.0.1 on Netbsd with the same configure
option. I removed the tsearch trigger from the table and I had no
problem. I tried using to_tsvector directly and the server crashed.

PostgreSQL stand-alone backend 8.0.1
backend> select to_tsvector('foo blah blah');

Program received signal SIGSEGV, Segmentation fault.
0x48b22c84 in find_among () from /usr/pkg/lib/tsearch2.so

Yet on a linux computer with the source compiled the EXACT same
way(--with-debug)

PostgreSQL stand-alone backend 8.0.1
backend> select to_tsvector('foo blah blah');
         1: to_tsvector (typeid = 17359, len = -1, typmod = -1, byval = f)
        ----
         1: to_tsvector = "'foo':1 'blah':2,3"  (typeid = 17359, len =
-1, typmod = -1, byval = f)
        ----
backend>

So, the only conclusion I can reach is this problem is some OS
dependant bug, which apparently has been fixed in 8.0.2beta.

--Joel

On Apr 7, 2005 9:04 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Joel Leyh <hashbang@gmail.com> writes:
> > Same problem, same function causing the seg fault. I also tried to
> > narrow down what about the filename is causing the error, but I
> > couldn't figure it out. I also compiled the source on another NetBSD
> > i386 machine, with the same results.
> > Then I compiled 8.0.2beta1 and the above query works just fine. So
> > whatever was causing the problem apparently has been fixed.
>
> Well, that's good news, but it still bothers me that I can't reproduce
> the problem here, and I don't see anything in the CVS logs that looks
> like a fix.  I went back to 8.0.1 sources just to be sure, but it worked
> fine.  Apparently something platform-specific?
>
> What configure options did you use?
>
>                         regards, tom lane
>