Bugs item #1744590, was opened at 2007-06-28 06:34
Message generated for change (Settings changed) made by boncz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=1744590&group_id=56967

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: PF/runtime
Group: (zombie: Pathfinder 0.18)
>Status: Closed
>Resolution: Wont Fix
Priority: 4
Private: No
Submitted By: Jeremy Volkman (jvolkman)
Assigned to: Peter Boncz (boncz)
Summary: XQ: segfault in descendant step

Initial Comment:
Attached is a sample XML document and a query that causes MonetDB to segfault 
at the following location:

PFll_descendant (result=0xafdf6b10, iter_bat=0x819c100, ctx_bat=0x8c5c5c0, 
pre_size=0x8877840, cand_bat=0x0, _one_iter=0xafdf6b60 "", 
    _one_ctx=0xafdf6b70 "\001", _min_iter=0xafdf6b80, _max_iter=0xafdf6b90, 
_no_iter_order=0xafdf6ba0 "\001", _kind_test=0xafdf6bb0 "\200")
    at ll_staircasejoin.mx:299
299                             *(oid*)dst              = 
*(oid*)BUNtail(iter_bat,iter);

Steps to reproduce:

1. Extract archive.
2. shred_doc(<path-to-test.xml>,"test.xml");
3. MapiClient -l x test.xq



----------------------------------------------------------------------

Comment By: Stefan Manegold (stmane)
Date: 2008-01-22 15:36

Message:
Logged In: YES 
user_id=572415
Originator: NO

The segfault occurs when filling a (exceptionally huge)
intermediate-result-BAT, that has been memory-mapped with holes larged than
disk capacity, reaces/exceed disk capacity.

The only(?) way to prevent this, would be to restrict memory-mapped files
to available disk capacity (which of course might change between creating
the memory-mapped file and filling it ...)


----------------------------------------------------------------------

Comment By: Jeremy Volkman (jvolkman)
Date: 2007-07-12 13:55

Message:
Logged In: YES 
user_id=1702210
Originator: YES

Stefan,

Thanks for the follow up. The query I submitted was a result of me playing
around with MonetDB/XQuery (which is blazingly fast given a valid query).
It was indeed a mistake (I was going for ".//c" as you suggested), but as
you said an invalid/inexecutable query should not crash the server. I
suppose I should have pointed out the insanity of the query with the report
-- sorry about that. :)

-Jeremy

----------------------------------------------------------------------

Comment By: Stefan Manegold (stmane)
Date: 2007-07-12 11:15

Message:
Logged In: YES 
user_id=572415
Originator: NO

Jeremy,

the segfault is due to an intermediate result of 10000*100000 = 1G
elements, i.e., 8GB/16GB (32/64 bit system), that apparently cannot be
allocated/memory-mapped.

Well, indeed, we should not crash/segfault, but give a proper error
message in that case --- investigating...

However, a closer look at your query reveals the reason for such huge
intermediate result, and rises the question, whether the query is indeed
hwat you intended:

<result>
{
count(collection("test.xml")//b[count(//c) > 2])
                                ^^^^^^^^^^^^^^
}
</result>

Due to the asolute path (//c), "count(//c) > 2" is independant/invariant
of the context!??
Unfortunately, Pathfinder does (can?) not (yet?) recognize such invariant
and factor it our of the loop of context nodes.
Hence, normal bulk-processing in MonetDB/XQuery evaluates the //c
(yielding 100000 elements) for all 10000 //b elements in bulk
("loop-lifted"), yielding an intermediate result of 10000 * 100000 = 1G
elements as mentioned above.

In case you actually wanted to count all c elements below each b element,
replacing count(//c) by count(.//c) works just fine:

<result>
{
count(collection("test.xml")//b[count(.//c) > 2])
                                      ^
}
</result>


Stefan


----------------------------------------------------------------------

Comment By: Peter Boncz (boncz)
Date: 2007-07-03 12:06

Message:
Logged In: YES 
user_id=591107
Originator: NO

renamed with XQ: convention; recategorized into Pathfinder

----------------------------------------------------------------------

Comment By: Peter Boncz (boncz)
Date: 2007-07-03 12:03

Message:
Logged In: YES 
user_id=591107
Originator: NO

I will have a look at this one

----------------------------------------------------------------------

Comment By: Jeremy Volkman (jvolkman)
Date: 2007-06-28 06:37

Message:
Logged In: YES 
user_id=1702210
Originator: YES

The host system is Ubuntu Linux 7.04 on an Intel Pentium M w/ 2GiB RAM

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=1744590&group_id=56967

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to