client:query freeze

Monday, 29 February 2016 · 6 messages · last reply 1 Mar 2016
SP
Strasser Pablo29 Feb 2016 20:14 #
Hi, Thanks for your great software. Using basex 8.4. I found the following strange behaviour in client:query call. Calling a repository function which use client:query to call another repository function freeze the basex server if done on the server. The only way to stop the server is with a kill -9. However using the standalone client it work normally. Trying to reproduce this problem I managed to get a similar problem using 2 repository test and test2. Where the first repo use a function of the second. Do you have some idea how to investigate this problem? Is it a bug? Code of test:
module namespace m = 'http://strasser-family.ch/test';
declare variable $m:c := client:connect('localhost', 1984, 'admin',
'admin');

declare function m:test(){
client:query($m:c, "import module namespace m =
'http://strasser-family.ch/test2';m:test()")
};
Code of test2: module namespace m = 'http://strasser-family.ch/test2';
declare function m:test()
{
         <dummy/>
};
usage code:
import module namespace m = 'http://strasser-family.ch/test';
m:test()
Have a nice evening. Pablo
CG
Christian Grün1 Mar 2016 10:39 #
Hi Pablo, I installed your two modules in the repository, I started a BaseX server, and I run your query as follows:
Quoted text · Strasser Pablo · 1 line
>basexclient -v -Uadmin -Padmin example.xq
<dummy/> Query "x.xq" executed in 5.87 ms. Everything works fine.. Could you possibly give me some more information on how to reproduce the deadlock you described? Christian
Quoted text · Strasser Pablo · 19 lines
> Code of test2: > > module namespace m = 'http://strasser-family.ch/test2'; > > declare function m:test() > { > <dummy/> > }; > > usage code: > > import module namespace m = 'http://strasser-family.ch/test'; > m:test() > > Have a nice evening. > > Pablo > >
CG
Christian Grünin reply to Strasser Pablo, 29 Feb 2016, 20:141 Mar 2016 11:26 #
Hi Pablo, A little addition: It is indeed possible to create deadlocks with the Client Module when using updating queries. I have added an example in our documentation [1]. In short: You should avoid addressing localhost:1984 if you are running the calling query in the same instance. Hope this helps, Christian [1] http://docs.basex.org/wiki/Client_Module
Quoted text · Strasser Pablo · 50 lines
On Mon, Feb 29, 2016 at 8:14 PM, Strasser Pablo <strasserpablo at bluewin.ch> wrote: > Hi, > > Thanks for your great software. > Using basex 8.4. > I found the following strange behaviour in client:query call. > Calling a repository function which use client:query to call another > repository function freeze the basex server if done on the server. > The only way to stop the server is with a kill -9. > However using the standalone client it work normally. > > Trying to reproduce this problem I managed to get a similar problem using 2 > repository test and test2. > Where the first repo use a function of the second. > > Do you have some idea how to investigate this problem? > Is it a bug? > > Code of test: > > module namespace m = 'http://strasser-family.ch/test'; > declare variable $m:c := client:connect('localhost', 1984, 'admin', > 'admin'); > > declare function m:test(){ > client:query($m:c, "import module namespace m = > 'http://strasser-family.ch/test2';m:test()") > }; > > > Code of test2: > > module namespace m = 'http://strasser-family.ch/test2'; > > declare function m:test() > { > <dummy/> > }; > > usage code: > > import module namespace m = 'http://strasser-family.ch/test'; > m:test() > > Have a nice evening. > > Pablo > >
SP
Strasser Pablo1 Mar 2016 14:25 #
Hi Christian, Thanks for the informations. I retried the toy example and it worked this time, may had some previous try messing up. For deadlock, is it possible to create deadlock by using updating queries in different call to client:query or are all query independent. Moreover is it correct to use updating client queries on localhost on non-updating function. I was mainly using the client as an alternative to redirect to allow to mix updating and non updating function for basexclient call. Trying to find another example which crash I come up with the following. This time I tested it on two machines.
module namespace m = 'http://strasser-family.ch/test';
declare variable $m:c := client:connect('localhost', 1984, 'admin',
'admin');

declare %updating function m:update()
{
db:replace('dummy','dummy',<result>{doc('/nonexistant/non')}</result>)
};

declare function m:test()
{
         client:query($m:c,"import module namespace
m='http://strasser-family.ch/test'; m:update()")
};
If I call the m:test() function I receive with basex: ubuntu@basex:~/Volume/Working/Exo$ echo "import module namespace m = 'http://strasser-family.ch/test';m:test()" | basex - Stopped at /home/ubuntu/Volume/repo/http-strasser-family.ch-test-1.0/test/test.xq, 11/14: [FODC0002] Resource '/nonexistant/non' does not exist. ubuntu@basex:~/Volume/Working/Exo$ and with basexclient: ubuntu@basex:~/Volume/Working/Exo$ echo "import module namespace m = 'http://strasser-family.ch/test';m:test()" | basexclient -U admin -P admin - deadlock. Note that slightly changing the doc call to for example 'nonexistant' will work. For my application I found a way around it. Have a nice Day, Pablo
Quoted text · Christian Grün · 66 lines
On 01. 03. 16 11:26, Christian Grün wrote: > Hi Pablo, > > A little addition: It is indeed possible to create deadlocks with the > Client Module when using updating queries. I have added an example in > our documentation [1]. In short: You should avoid addressing > localhost:1984 if you are running the calling query in the same > instance. > > Hope this helps, > Christian > > [1] http://docs.basex.org/wiki/Client_Module > > > > On Mon, Feb 29, 2016 at 8:14 PM, Strasser Pablo > <strasserpablo at bluewin.ch> wrote: >> Hi, >> >> Thanks for your great software. >> Using basex 8.4. >> I found the following strange behaviour in client:query call. >> Calling a repository function which use client:query to call another >> repository function freeze the basex server if done on the server. >> The only way to stop the server is with a kill -9. >> However using the standalone client it work normally. >> >> Trying to reproduce this problem I managed to get a similar problem using 2 >> repository test and test2. >> Where the first repo use a function of the second. >> >> Do you have some idea how to investigate this problem? >> Is it a bug? >> >> Code of test: >> >> module namespace m = 'http://strasser-family.ch/test'; >> declare variable $m:c := client:connect('localhost', 1984, 'admin', >> 'admin'); >> >> declare function m:test(){ >> client:query($m:c, "import module namespace m = >> 'http://strasser-family.ch/test2';m:test()") >> }; >> >> >> Code of test2: >> >> module namespace m = 'http://strasser-family.ch/test2'; >> >> declare function m:test() >> { >> <dummy/> >> }; >> >> usage code: >> >> import module namespace m = 'http://strasser-family.ch/test'; >> m:test() >> >> Have a nice evening. >> >> Pablo >> >>
CG
Christian Grün1 Mar 2016 14:28 #
Hi Pablo, Yes, it is possible to create deadlocks with the Client Module. We generally advise against addressing local database server instances with the Client Module, as long as the invoking queries is not run from a completely different context. Hope this helps, Christian
Quoted text · Strasser Pablo · 128 lines
On Tue, Mar 1, 2016 at 2:25 PM, Strasser Pablo <strasserpablo at bluewin.ch> wrote: > Hi Christian, > > Thanks for the informations. I retried the toy example and it worked this > time, may had some previous try messing up. > For deadlock, is it possible to create deadlock by using updating queries in > different call to client:query or are all query independent. > Moreover is it correct to use updating client queries on localhost on > non-updating function. > I was mainly using the client as an alternative to redirect to allow to mix > updating and non updating function for basexclient call. > Trying to find another example which crash I come up with the following. > This time I tested it on two machines. > > > module namespace m = 'http://strasser-family.ch/test'; > declare variable $m:c := client:connect('localhost', 1984, 'admin', > 'admin'); > > declare %updating function m:update() > { > db:replace('dummy','dummy',<result>{doc('/nonexistant/non')}</result>) > }; > > declare function m:test() > { > client:query($m:c,"import module namespace > m='http://strasser-family.ch/test'; m:update()") > }; > > If I call the m:test() function I receive with basex: > > ubuntu@basex:~/Volume/Working/Exo$ echo "import module namespace m = > 'http://strasser-family.ch/test';m:test()" | basex - > Stopped at > /home/ubuntu/Volume/repo/http-strasser-family.ch-test-1.0/test/test.xq, > 11/14: > [FODC0002] Resource '/nonexistant/non' does not exist. > ubuntu@basex:~/Volume/Working/Exo$ > > and with basexclient: > > ubuntu@basex:~/Volume/Working/Exo$ echo "import module namespace m = > 'http://strasser-family.ch/test';m:test()" | basexclient -U admin -P admin > - > > deadlock. > > Note that slightly changing the doc call to for example 'nonexistant' will > work. > > For my application I found a way around it. > > Have a nice Day, > > Pablo > > > On 01. 03. 16 11:26, Christian Grün wrote: >> >> Hi Pablo, >> >> A little addition: It is indeed possible to create deadlocks with the >> Client Module when using updating queries. I have added an example in >> our documentation [1]. In short: You should avoid addressing >> localhost:1984 if you are running the calling query in the same >> instance. >> >> Hope this helps, >> Christian >> >> [1] http://docs.basex.org/wiki/Client_Module >> >> >> >> On Mon, Feb 29, 2016 at 8:14 PM, Strasser Pablo >> <strasserpablo at bluewin.ch> wrote: >>> >>> Hi, >>> >>> Thanks for your great software. >>> Using basex 8.4. >>> I found the following strange behaviour in client:query call. >>> Calling a repository function which use client:query to call another >>> repository function freeze the basex server if done on the server. >>> The only way to stop the server is with a kill -9. >>> However using the standalone client it work normally. >>> >>> Trying to reproduce this problem I managed to get a similar problem using >>> 2 >>> repository test and test2. >>> Where the first repo use a function of the second. >>> >>> Do you have some idea how to investigate this problem? >>> Is it a bug? >>> >>> Code of test: >>> >>> module namespace m = 'http://strasser-family.ch/test'; >>> declare variable $m:c := client:connect('localhost', 1984, 'admin', >>> 'admin'); >>> >>> declare function m:test(){ >>> client:query($m:c, "import module namespace m = >>> 'http://strasser-family.ch/test2';m:test()") >>> }; >>> >>> >>> Code of test2: >>> >>> module namespace m = 'http://strasser-family.ch/test2'; >>> >>> declare function m:test() >>> { >>> <dummy/> >>> }; >>> >>> usage code: >>> >>> import module namespace m = 'http://strasser-family.ch/test'; >>> m:test() >>> >>> Have a nice evening. >>> >>> Pablo >>> >>> >
SP
Strasser Pablo1 Mar 2016 17:29 #
Hi Christian, Thanks, Creating a new vm and make all client module call on the original machine solved it. Have a nice day, Pablo
Quoted text · Christian Grün · 138 lines
On 01. 03. 16 14:28, Christian Grün wrote: > Hi Pablo, > > Yes, it is possible to create deadlocks with the Client Module. We > generally advise against addressing local database server instances > with the Client Module, as long as the invoking queries is not run > from a completely different context. > > Hope this helps, > Christian > > > > On Tue, Mar 1, 2016 at 2:25 PM, Strasser Pablo <strasserpablo at bluewin.ch> wrote: >> Hi Christian, >> >> Thanks for the informations. I retried the toy example and it worked this >> time, may had some previous try messing up. >> For deadlock, is it possible to create deadlock by using updating queries in >> different call to client:query or are all query independent. >> Moreover is it correct to use updating client queries on localhost on >> non-updating function. >> I was mainly using the client as an alternative to redirect to allow to mix >> updating and non updating function for basexclient call. >> Trying to find another example which crash I come up with the following. >> This time I tested it on two machines. >> >> >> module namespace m = 'http://strasser-family.ch/test'; >> declare variable $m:c := client:connect('localhost', 1984, 'admin', >> 'admin'); >> >> declare %updating function m:update() >> { >> db:replace('dummy','dummy',<result>{doc('/nonexistant/non')}</result>) >> }; >> >> declare function m:test() >> { >> client:query($m:c,"import module namespace >> m='http://strasser-family.ch/test'; m:update()") >> }; >> >> If I call the m:test() function I receive with basex: >> >> ubuntu@basex:~/Volume/Working/Exo$ echo "import module namespace m = >> 'http://strasser-family.ch/test';m:test()" | basex - >> Stopped at >> /home/ubuntu/Volume/repo/http-strasser-family.ch-test-1.0/test/test.xq, >> 11/14: >> [FODC0002] Resource '/nonexistant/non' does not exist. >> ubuntu@basex:~/Volume/Working/Exo$ >> >> and with basexclient: >> >> ubuntu@basex:~/Volume/Working/Exo$ echo "import module namespace m = >> 'http://strasser-family.ch/test';m:test()" | basexclient -U admin -P admin >> - >> >> deadlock. >> >> Note that slightly changing the doc call to for example 'nonexistant' will >> work. >> >> For my application I found a way around it. >> >> Have a nice Day, >> >> Pablo >> >> >> On 01. 03. 16 11:26, Christian Grün wrote: >>> Hi Pablo, >>> >>> A little addition: It is indeed possible to create deadlocks with the >>> Client Module when using updating queries. I have added an example in >>> our documentation [1]. In short: You should avoid addressing >>> localhost:1984 if you are running the calling query in the same >>> instance. >>> >>> Hope this helps, >>> Christian >>> >>> [1] http://docs.basex.org/wiki/Client_Module >>> >>> >>> >>> On Mon, Feb 29, 2016 at 8:14 PM, Strasser Pablo >>> <strasserpablo at bluewin.ch> wrote: >>>> Hi, >>>> >>>> Thanks for your great software. >>>> Using basex 8.4. >>>> I found the following strange behaviour in client:query call. >>>> Calling a repository function which use client:query to call another >>>> repository function freeze the basex server if done on the server. >>>> The only way to stop the server is with a kill -9. >>>> However using the standalone client it work normally. >>>> >>>> Trying to reproduce this problem I managed to get a similar problem using >>>> 2 >>>> repository test and test2. >>>> Where the first repo use a function of the second. >>>> >>>> Do you have some idea how to investigate this problem? >>>> Is it a bug? >>>> >>>> Code of test: >>>> >>>> module namespace m = 'http://strasser-family.ch/test'; >>>> declare variable $m:c := client:connect('localhost', 1984, 'admin', >>>> 'admin'); >>>> >>>> declare function m:test(){ >>>> client:query($m:c, "import module namespace m = >>>> 'http://strasser-family.ch/test2';m:test()") >>>> }; >>>> >>>> >>>> Code of test2: >>>> >>>> module namespace m = 'http://strasser-family.ch/test2'; >>>> >>>> declare function m:test() >>>> { >>>> <dummy/> >>>> }; >>>> >>>> usage code: >>>> >>>> import module namespace m = 'http://strasser-family.ch/test'; >>>> m:test() >>>> >>>> Have a nice evening. >>>> >>>> Pablo >>>> >>>>

⚡Generated with XQuery