Bugs item #1676443, was opened at 2007-03-08 13:34
Message generated for change (Comment added) made by yingying
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=1676443&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: Pathfinder 0.16
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Ying Zhang (yingying)
Assigned to: Nobody/Anonymous (nobody)
Summary: XQ: Interleave of put and doc via mod. func. crashes Msever

Initial Comment:
(Discovered by Arthur van Bunningen, thanks!)

Wrap the built-in functions fn:put and fn:doc in to module functions (say, PUT 
and GET).  Then interleaving calls of PUT and GET crash Mserver.

$ cat twente.xq
module namespace cq = "utwente";

declare updating function cq:PUT($uri as xs:string, $doc as element())
{
  if (substring($uri, 1,4) = 'tmp/')
  then put($doc, $uri)
  else error('PUT: only relative URIs starting with tmp/ allowed')
};

declare function cq:GET($uri as xs:string)
{ doc($uri) };

$ more PUT*.xq
::::::::::::::
PUT.xq
::::::::::::::
import module namespace cq = "utwente" at "/ufs/zhang/twente.xq";

cq:PUT("tmp/test.xml",<bladieboe/>)
::::::::::::::
PUT1.xq
::::::::::::::
import module namespace cq = "utwente" at "/ufs/zhang/twente.xq";

cq:PUT("tmp/test1.xml",<bladieboe1/>)

$ more GET*.xq
::::::::::::::
GET.xq
::::::::::::::
import module namespace cq = "utwente" at "/ufs/zhang/twente.xq";

cq:GET("tmp/test.xml")
::::::::::::::
GET1.xq
::::::::::::::
import module namespace cq = "utwente" at "/ufs/zhang/twente.xq";

cq:GET("tmp/test1.xml")


Properties of this bug:

1. The following sequence crashes Mserver:

$ mapiclnt -lx PUT.xq

$ mapiclnt -lx GET.xq
<?xml version="1.0" encoding="utf-8"?>
<bladieboe/>

$ mapiclnt -lx PUT1.xq

$ mapiclnt -lx GET1.xq
MAPI  = [EMAIL PROTECTED]:50000
ACTION= read_line
QUERY = import module namespace cq = "utwente" at "/ufs/zhang/twente.xq";

        cq:GET("tmp/test1.xml")
ERROR = Connection terminated

2. Restart Mserver empties the "tmp" dir.

The second PUT above seems have succeeded, because the files are in "tmp" after 
Mserver crash:

[andorea:/net/andorea/export/scratch1/zhang/monet/stable/G.64.64.d.debug/var/MonetDB4/dbfarm/demo/tmp]
$ ls -l
total 8
-rw-rw-rw-  1 zhang ins 52 Mar  8 13:25 test.xml
-rw-rw-rw-  1 zhang ins 53 Mar  8 13:25 test1.xml

[andorea:/net/andorea/export/scratch1/zhang/monet/stable/G.64.64.d.debug/var/MonetDB4/dbfarm/demo/tmp]
$ cat test*
<?xml version="1.0" encoding="utf-8"?>
<bladieboe/>
<?xml version="1.0" encoding="utf-8"?>
<bladieboe1/>

Now restart Mserver and have a look at in the "tmp" dir:

[andorea:/net/andorea/export/scratch1/zhang/monet/stable/G.64.64.d.debug/var/MonetDB4/dbfarm/demo/tmp]
$ ls -l
total 0

3. Above crash happens only because fn:doc and fn:put are wrapped in module 
functions.  The following sequence works fine:

    $mapiclnt -lx
    xquery>put(<bla/>,"tmp/text.xml")
    more>xquery>doc("tmp/text.xml")
    more><?xml version="1.0" encoding="utf-8"?>
    <bla/>

    xquery>put(<bladiebloe/>,"tmp/text.xml")
    xquery>doc("tmp/text.xml")xml")
    more><?xml version="1.0" encoding="utf-8"?>
    <bladiebloe/>

    xquery>doc("tmp/text.xml")
    more><?xml version="1.0" encoding="utf-8"?>
    <bladiebloe/>

    xquery>

4. It works fine as long as PUT and GET are not interleaved:

$ mapiclnt -lx PUT.xq

$ mapiclnt -lx PUT1.xq
# you can do more PUT here

$ mapiclnt -lx GET1.xq
<?xml version="1.0" encoding="utf-8"?>
<bladieboe1/>

$ mapiclnt -lx GET.xq
<?xml version="1.0" encoding="utf-8"?>
<bladieboe/>

# you can do more GET here

Regards,

Jennie

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

>Comment By: Ying Zhang (yingying)
Date: 2007-03-08 15:09

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

Test added:
tests/BugTracker/Tests/interleave_PUT_GET_crashes_Mserver.SF-1676443

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

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

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to