Re: BUG #14584: Segmentation fault importing large XML file

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: jorsol(at)gmail(dot)com
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14584: Segmentation fault importing large XML file
Date: 2017-03-08 19:06:26
Message-ID: CAFj8pRA5s_PakuKExawAF724vVV3HJBTgqT7Z4yprij-34bm9w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi

2017-03-08 20:02 GMT+01:00 <jorsol(at)gmail(dot)com>:

> The following bug has been logged on the website:
>
> Bug reference: 14584
> Logged by: Jorge Solorzano
> Email address: jorsol(at)gmail(dot)com
> PostgreSQL version: 9.6.2
> Operating system: Ubuntu 16.04 4.8.0-39-generic
> Description:
>
> I'm trying to import a large XML file into a table, for others (smaller)
> xml, this works fine.
>
> DROP TABLE IF EXISTS posts;
> CREATE TABLE posts AS
> SELECT
> (xpath('@Id', x))[1]::text::integer "Id",
> (xpath('@PostTypeId', x))[1]::text::integer "PostTypeId",
> (xpath('@ParentId', x))[1]::text::integer "ParentId",
> (xpath('@AcceptedAnswerId', x))[1]::text::integer
> "AcceptedAnswerId",
> (xpath('@CreationDate', x))[1]::text::timestamp "CreationDate",
> (xpath('@Score', x))[1]::text::integer "Score",
> (xpath('@ViewCount', x))[1]::text::integer "ViewCount",
> (xpath('@Body', x))[1]::text "Body",
> (xpath('@OwnerUserId', x))[1]::text::integer "OwnerUserId",
> (xpath('@LastEditorUserId', x))[1]::text::integer
> "LastEditorUserId",
> (xpath('@LastEditDate', x))[1]::text::timestamp "LastEditDate",
> (xpath('@LastActivityDate', x))[1]::text::timestamp
> "LastActivityDate",
> (xpath('@Title', x))[1]::text "Title",
> (xpath('@Tags', x))[1]::text "Tags",
> (xpath('@AnswerCount', x))[1]::text::integer "AnswerCount",
> (xpath('@CommentCount', x))[1]::text::integer "CommentCount",
> (xpath('@FavoriteCount', x))[1]::text::integer "FavoriteCount",
> (xpath('@ClosedDate', x))[1]::text::timestamp "ClosedDate"
> FROM
> unnest(xpath('/posts/row', xml_import('Posts.xml'))) x
>
>
what means large XML file? Please, can you write test case?

Regards

Pavel

> This is what I get from the core dump:
>
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0 0x00007f3a0bcf9fb8 in ?? () from
> /usr/lib/x86_64-linux-gnu/libxml2.so.2
> (gdb) bt full
> #0 0x00007f3a0bcf9fb8 in ?? () from
> /usr/lib/x86_64-linux-gnu/libxml2.so.2
> No symbol table info available.
> #1 0x0000556dc268ba1c in xml_errorHandler (data=0x556dc2dba9b0,
> error=<optimized out>) at
> /build/postgresql-9.6-ZHxyhz/postgresql-9.6-9.6.2/build/../
> src/backend/utils/adt/xml.c:1661
> errFuncSaved = 0x7f3a0bcfa1b0 <xmlGenericErrorDefaultFunc>
> errCtxSaved = 0x0
> xmlerrcxt = 0x556dc2dba9b0
> ctxt = <optimized out>
> input = 0x556dc2dc44b0
> node = <optimized out>
> name = <optimized out>
> domain = <optimized out>
> level = <optimized out>
> errorBuf = 0x556dc2dbacc0
> __func__ = "xml_errorHandler"
> #2 0x00007f3a0bcfbfa4 in __xmlRaiseError () from
> /usr/lib/x86_64-linux-gnu/libxml2.so.2
> No symbol table info available.
> #3 0x00007f3a0bd00900 in ?? () from
> /usr/lib/x86_64-linux-gnu/libxml2.so.2
> No symbol table info available.
> #4 0x00007f3a0bd02f14 in ?? () from
> /usr/lib/x86_64-linux-gnu/libxml2.so.2
> No symbol table info available.
> #5 0x00007f3a0bd17338 in xmlParseContent () from
> /usr/lib/x86_64-linux-gnu/libxml2.so.2
> No symbol table info available.
> #6 0x00007f3a0bd17c13 in xmlParseElement () from
> /usr/lib/x86_64-linux-gnu/libxml2.so.2
> No symbol table info available.
> #7 0x00007f3a0bd1866a in xmlParseDocument () from
> /usr/lib/x86_64-linux-gnu/libxml2.so.2
> No symbol table info available.
> #8 0x00007f3a0bd1ffd9 in xmlCtxtReadMemory () from
> /usr/lib/x86_64-linux-gnu/libxml2.so.2
> No symbol table info available.
> #9 0x0000556dc2690a26 in xpath_internal
> (xpath_expr_text=xpath_expr_text(at)entry=0x556dc2d7dda0,
> data=data(at)entry=0x7f380fa77040, namespaces=namespaces(at)entry=
> 0x556dc2d7df90,
>
> res_nitems=res_nitems(at)entry=0x0, astate=astate(at)entry=0x556dc2dda740)
> at
> /build/postgresql-9.6-ZHxyhz/postgresql-9.6-9.6.2/build/../
> src/backend/utils/adt/xml.c:3842
> save_exception_stack = 0x7fffea7f8000
> save_context_stack = 0x0
> local_sigjmp_buf = {{__jmpbuf = {10, -4817151912512283653,
> 93929908723104, 979473840, 93929908972784, 979473840, -4817151912059298821,
> -1728720388456276997}, __mask_was_saved = 0,
> __saved_mask = {__val = {0, 0, 0, 93929908723600,
> 11806714016570382336, 8388608, 139887287250280, 139887287250280,
> 93929908097440, 140737127610384, 93929901717430, 139887287250280,
> 93929908890240, 140737127610416, 93929901471218, 142}}}}
> xmlerrcxt = 0x556dc2dba9b0
> ctxt = 0x556dc2dc2e80
> doc = 0x0
> xpathctx = 0x0
> xpathcomp = 0x0
> xpathobj = 0x0
> datastr = 0x7f380fa77044 "<?xml version=\"1.0\"
> encoding=\"utf-8\"?>\n<posts>\n <row Id=\"1\" PostTypeId=\"1\"
> AcceptedAnswerId=\"727273\" CreationDate=\"2009-07-15T06:27:46.723\"
> Score=\"155\" ViewCount=\"92736\" Body=\"&lt;p&gt;A Vista virtua"...
> len = 979473840
> xpath_len = 10
> string = 0x7f38becc5040 "<?xml version=\"1.0\"
> encoding=\"utf-8\"?>\n<posts>\n <row Id=\"1\" PostTypeId=\"1\"
> AcceptedAnswerId=\"727273\" CreationDate=\"2009-07-15T06:27:46.723\"
> Score=\"155\" ViewCount=\"92736\" Body=\"&lt;p&gt;A Vista virtua"...
> xpath_expr = 0x556dc2dbacf0 "/posts/row"
> i = <optimized out>
> ndim = <optimized out>
> ns_names_uris = 0x0
> ns_names_uris_nulls = 0x0
> ns_count = 0
> __func__ = "xpath_internal"
> #10 0x0000556dc26918a8 in xpath (fcinfo=<optimized out>) at
> /build/postgresql-9.6-ZHxyhz/postgresql-9.6-9.6.2/build/../
> src/backend/utils/adt/xml.c:3950
> xpath_expr_text = 0x556dc2d7dda0
> data = 0x7f380fa77040
> namespaces = 0x556dc2d7df90
> astate = 0x556dc2dda740
>
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jorge Solórzano 2017-03-08 19:17:37 Re: BUG #14584: Segmentation fault importing large XML file
Previous Message jorsol 2017-03-08 19:02:09 BUG #14584: Segmentation fault importing large XML file