Possible bug in BaseX interpreter, might be the introspection module ?
Monday, 6 January 2014 · 5 messages · last reply 11 Jan 2014
JM
jean-marc Mercier6 Jan 2014 19:15 #
Hello,
I have a quite strange behavior, that might be a bug in the introspection module. I am just describing it, and will work a bit to produce a reproductible code if you don't have a quick clue about the problem.
I created a map of string to functions, called $common:MapIntrospecting, generated by the introspection module.
The following code works perfectly (you can't run it, but believe me :)
declare variable $map :=
map:entry("Alimentation:nodes#1",Alimentation:nodes#1);
declare variable $nodes := a big node...
let $fun_1 := map:get($map,"Alimentation:nodes#1")
let $fun_2 := map:get($common:MapIntrospecting,"Alimentation:nodes#1")
return $fun_2($nodes)And now, the following code (I just cut the useless first line) produces a spurious and ferocious exception
let $fun_2 := map:get($common:MapIntrospecting,"Alimentation:nodes#1")
return $fun_2($nodes)Any clue ?
Improper use? Potential bug? Your feedback is welcome:
Contact: basex-talk at mailman.uni-konstanz.de
Version: BaseX 7.8 beta 132460f
Java: Oracle Corporation, 1.7.0_45
OS: Windows 7, amd64
Stack Trace:
java.lang.ClassCastException: org.basex.query.value.type.AtomType cannot be
cast to org.basex.query.value.type.FuncType
at org.basex.query.func.InlineFunc.item(InlineFunc.java:261)
at org.basex.query.func.InlineFunc.value(InlineFunc.java:280)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154)
at org.basex.query.func.FuncCall.value(FuncCall.java:52)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203)
at org.basex.query.func.FuncCall.invoke(FuncCall.java:96)
at org.basex.query.func.FuncCall.value(FuncCall.java:52)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154)
at org.basex.query.func.FuncCall.value(FuncCall.java:52)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154)
at org.basex.query.func.FuncCall.value(FuncCall.java:52)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203)
at org.basex.query.func.FuncCall.invoke(FuncCall.java:96)
at org.basex.query.func.FuncCall.value(FuncCall.java:52)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203)
at org.basex.query.func.FuncCall.invoke(FuncCall.java:96)
at org.basex.query.func.FuncCall.value(FuncCall.java:52)
at org.basex.query.var.StaticVar.value(StaticVar.java:129)
at org.basex.query.var.StaticVarRef.value(StaticVarRef.java:58)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154)
at org.basex.query.func.FuncCall.value(FuncCall.java:52)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.expr.List.value(List.java:133)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203)
at org.basex.query.func.FuncCall.invoke(FuncCall.java:96)
at org.basex.query.func.FuncCall.value(FuncCall.java:52)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.value.item.FuncItem.invValue(FuncItem.java:130)
at org.basex.query.func.FuncCall.invoke(FuncCall.java:96)
at org.basex.query.func.FuncCall.value(FuncCall.java:52)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.MainModule.value(MainModule.java:79)
at org.basex.query.QueryContext.value(QueryContext.java:323)
at org.basex.query.QueryContext.iter(QueryContext.java:309)
at org.basex.query.QueryProcessor.iter(QueryProcessor.java:81)
at org.basex.core.cmd.AQuery.query(AQuery.java:89)
at org.basex.core.cmd.XQuery.run(XQuery.java:22)
at org.basex.core.Command.run(Command.java:329)
at org.basex.core.Command.execute(Command.java:94)
at org.basex.server.LocalSession.execute(LocalSession.java:121)
at org.basex.server.Session.execute(Session.java:37)
at org.basex.core.Main.execute(Main.java:146)
at org.basex.BaseX.<init>(BaseX.java:119)
at org.basex.BaseX.main(BaseX.java:38)JM
jean-marc Mercier6 Jan 2014 19:20 #
Note : casewhere, I checked that this issue does not depend upon the values of
INLINELIMIT and TAILCALL.
2014/1/6 jean-marc Mercier <jeanmarc.mercier at gmail.com>Quoted text · jean-marc Mercier · 93 lines
> Hello, > > I have a quite strange behavior, that might be a bug in the introspection > module. I am just describing it, and will work a bit to produce a > reproductible code if you don't have a quick clue about the problem. > > I created a map of string to functions, called $common:MapIntrospecting, > generated by the introspection module. > > The following code works perfectly (you can't run it, but believe me :) > > declare variable $map := > map:entry("Alimentation:nodes#1",Alimentation:nodes#1); > declare variable $nodes := a big node... > > let $fun_1 := map:get($map,"Alimentation:nodes#1") > let $fun_2 := map:get($common:MapIntrospecting,"Alimentation:nodes#1") > return $fun_2($nodes) > > And now, the following code (I just cut the useless first line) produces a > spurious and ferocious exception > > let $fun_2 := map:get($common:MapIntrospecting,"Alimentation:nodes#1") > return $fun_2($nodes) > > Any clue ? > > Improper use? Potential bug? Your feedback is welcome: > Contact: basex-talk at mailman.uni-konstanz.de > Version: BaseX 7.8 beta 132460f > Java: Oracle Corporation, 1.7.0_45 > OS: Windows 7, amd64 > Stack Trace: > java.lang.ClassCastException: org.basex.query.value.type.AtomType cannot > be cast to org.basex.query.value.type.FuncType > at org.basex.query.func.InlineFunc.item(InlineFunc.java:261) > at org.basex.query.func.InlineFunc.value(InlineFunc.java:280) > at org.basex.query.QueryContext.value(QueryContext.java:366) > at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154) > at org.basex.query.func.FuncCall.value(FuncCall.java:52) > at org.basex.query.QueryContext.value(QueryContext.java:366) > at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203) > at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) > at org.basex.query.func.FuncCall.value(FuncCall.java:52) > at org.basex.query.QueryContext.value(QueryContext.java:366) > at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154) > at org.basex.query.func.FuncCall.value(FuncCall.java:52) > at org.basex.query.QueryContext.value(QueryContext.java:366) > at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154) > at org.basex.query.func.FuncCall.value(FuncCall.java:52) > at org.basex.query.QueryContext.value(QueryContext.java:366) > at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203) > at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) > at org.basex.query.func.FuncCall.value(FuncCall.java:52) > at org.basex.query.QueryContext.value(QueryContext.java:366) > at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203) > at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) > at org.basex.query.func.FuncCall.value(FuncCall.java:52) > at org.basex.query.var.StaticVar.value(StaticVar.java:129) > at org.basex.query.var.StaticVarRef.value(StaticVarRef.java:58) > at org.basex.query.QueryContext.value(QueryContext.java:366) > at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154) > at org.basex.query.func.FuncCall.value(FuncCall.java:52) > at org.basex.query.QueryContext.value(QueryContext.java:366) > at org.basex.query.expr.List.value(List.java:133) > at org.basex.query.QueryContext.value(QueryContext.java:366) > at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203) > at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) > at org.basex.query.func.FuncCall.value(FuncCall.java:52) > at org.basex.query.QueryContext.value(QueryContext.java:366) > at org.basex.query.value.item.FuncItem.invValue(FuncItem.java:130) > at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) > at org.basex.query.func.FuncCall.value(FuncCall.java:52) > at org.basex.query.QueryContext.value(QueryContext.java:366) > at org.basex.query.MainModule.value(MainModule.java:79) > at org.basex.query.QueryContext.value(QueryContext.java:323) > at org.basex.query.QueryContext.iter(QueryContext.java:309) > at org.basex.query.QueryProcessor.iter(QueryProcessor.java:81) > at org.basex.core.cmd.AQuery.query(AQuery.java:89) > at org.basex.core.cmd.XQuery.run(XQuery.java:22) > at org.basex.core.Command.run(Command.java:329) > at org.basex.core.Command.execute(Command.java:94) > at org.basex.server.LocalSession.execute(LocalSession.java:121) > at org.basex.server.Session.execute(Session.java:37) > at org.basex.core.Main.execute(Main.java:146) > at org.basex.BaseX.<init>(BaseX.java:119) > at org.basex.BaseX.main(BaseX.java:38) > > > > > >
JM
jean-marc Mercier10 Jan 2014 04:36 #
Hi all,
it seems that this bug is linked to the introspection module. I isolated a code that produces on my config a exception, see at end of mail. Note :
- It seems to be a regression, as this code worked finely with the 3/12 version of BaseX.
- It took me a whole day to isolate this exception. This "overhead" is due to the JAVA catch / raising exception BaseX mechanism, letting the user blind with its XQUERY code. As bugs are becoming harder and harder to spot, maybe we should think about a way, or a tool, to easen trace / debug while the interpreter raises a JAVA exception ?
Cheers
declare function local:map_inspect_functions() { map:new(for $fun in
inspect:functions() return map:entry(local:name-function($fun),$fun)) };
declare function
local:name-function($fun){fn:data(inspect:function($fun)/@name)};
declare function local:get_void() { function(){ () }};
declare variable $local:MapIntrospecting := local:map_inspect_functions();
let $fun_2 := map:get($local:MapIntrospecting,"local:get_void")
return count($fun_2())Improper use? Potential bug? Your feedback is welcome:
Contact: basex-talk at mailman.uni-konstanz.de
Version: BaseX 7.8 beta 132460f
Java: Oracle Corporation, 1.7.0_45
OS: Windows 7, amd64
Stack Trace:
java.lang.ClassCastException: org.basex.query.value.type.AtomType cannot be
cast to org.basex.query.value.type.FuncType
at org.basex.query.func.InlineFunc.item(InlineFunc.java:261)
at org.basex.query.func.InlineFunc.value(InlineFunc.java:280)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203)
at org.basex.query.func.FuncCall.invoke(FuncCall.java:96)
at org.basex.query.func.FuncCall.value(FuncCall.java:52)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.value.item.FuncItem.invValue(FuncItem.java:130)
at org.basex.query.func.FuncCall.invoke(FuncCall.java:96)
at org.basex.query.func.FuncCall.value(FuncCall.java:52)
at org.basex.query.func.FuncCall.iter(FuncCall.java:57)
at org.basex.query.QueryContext.iter(QueryContext.java:355)
at org.basex.query.func.FNAggr.item(FNAggr.java:36)
at org.basex.query.expr.ParseExpr.iter(ParseExpr.java:46)
at org.basex.query.MainModule.iter(MainModule.java:96)
at org.basex.query.QueryContext.iter(QueryContext.java:309)
at org.basex.query.QueryProcessor.iter(QueryProcessor.java:81)
at org.basex.core.cmd.AQuery.query(AQuery.java:89)
at org.basex.core.cmd.XQuery.run(XQuery.java:22)
at org.basex.core.Command.run(Command.java:329)
at org.basex.core.Command.execute(Command.java:94)
at org.basex.server.LocalSession.execute(LocalSession.java:121)
at org.basex.server.Session.execute(Session.java:37)
at org.basex.core.Main.execute(Main.java:146)
at org.basex.BaseX.<init>(BaseX.java:119)
at org.basex.BaseX.main(BaseX.java:38)2014/1/6 jean-marc Mercier <jeanmarc.mercier at gmail.com>
Quoted text · jean-marc Mercier · 100 lines
> Note : casewhere, I checked that this issue does not depend upon the > values of INLINELIMIT and TAILCALL. > > > 2014/1/6 jean-marc Mercier <jeanmarc.mercier at gmail.com> > >> Hello, >> >> I have a quite strange behavior, that might be a bug in the introspection >> module. I am just describing it, and will work a bit to produce a >> reproductible code if you don't have a quick clue about the problem. >> >> I created a map of string to functions, called $common:MapIntrospecting, >> generated by the introspection module. >> >> The following code works perfectly (you can't run it, but believe me :) >> >> declare variable $map := >> map:entry("Alimentation:nodes#1",Alimentation:nodes#1); >> declare variable $nodes := a big node... >> >> let $fun_1 := map:get($map,"Alimentation:nodes#1") >> let $fun_2 := map:get($common:MapIntrospecting,"Alimentation:nodes#1") >> return $fun_2($nodes) >> >> And now, the following code (I just cut the useless first line) produces >> a spurious and ferocious exception >> >> let $fun_2 := map:get($common:MapIntrospecting,"Alimentation:nodes#1") >> return $fun_2($nodes) >> >> Any clue ? >> >> Improper use? Potential bug? Your feedback is welcome: >> Contact: basex-talk at mailman.uni-konstanz.de >> Version: BaseX 7.8 beta 132460f >> Java: Oracle Corporation, 1.7.0_45 >> OS: Windows 7, amd64 >> Stack Trace: >> java.lang.ClassCastException: org.basex.query.value.type.AtomType cannot >> be cast to org.basex.query.value.type.FuncType >> at org.basex.query.func.InlineFunc.item(InlineFunc.java:261) >> at org.basex.query.func.InlineFunc.value(InlineFunc.java:280) >> at org.basex.query.QueryContext.value(QueryContext.java:366) >> at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154) >> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >> at org.basex.query.QueryContext.value(QueryContext.java:366) >> at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203) >> at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) >> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >> at org.basex.query.QueryContext.value(QueryContext.java:366) >> at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154) >> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >> at org.basex.query.QueryContext.value(QueryContext.java:366) >> at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154) >> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >> at org.basex.query.QueryContext.value(QueryContext.java:366) >> at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203) >> at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) >> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >> at org.basex.query.QueryContext.value(QueryContext.java:366) >> at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203) >> at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) >> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >> at org.basex.query.var.StaticVar.value(StaticVar.java:129) >> at org.basex.query.var.StaticVarRef.value(StaticVarRef.java:58) >> at org.basex.query.QueryContext.value(QueryContext.java:366) >> at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154) >> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >> at org.basex.query.QueryContext.value(QueryContext.java:366) >> at org.basex.query.expr.List.value(List.java:133) >> at org.basex.query.QueryContext.value(QueryContext.java:366) >> at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203) >> at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) >> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >> at org.basex.query.QueryContext.value(QueryContext.java:366) >> at org.basex.query.value.item.FuncItem.invValue(FuncItem.java:130) >> at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) >> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >> at org.basex.query.QueryContext.value(QueryContext.java:366) >> at org.basex.query.MainModule.value(MainModule.java:79) >> at org.basex.query.QueryContext.value(QueryContext.java:323) >> at org.basex.query.QueryContext.iter(QueryContext.java:309) >> at org.basex.query.QueryProcessor.iter(QueryProcessor.java:81) >> at org.basex.core.cmd.AQuery.query(AQuery.java:89) >> at org.basex.core.cmd.XQuery.run(XQuery.java:22) >> at org.basex.core.Command.run(Command.java:329) >> at org.basex.core.Command.execute(Command.java:94) >> at org.basex.server.LocalSession.execute(LocalSession.java:121) >> at org.basex.server.Session.execute(Session.java:37) >> at org.basex.core.Main.execute(Main.java:146) >> at org.basex.BaseX.<init>(BaseX.java:119) >> at org.basex.BaseX.main(BaseX.java:38) >> >> >> >> >> >> >
JM
jean-marc Mercier11 Jan 2014 09:30 #
Hi all,
Due to this issue, I am pulling back to the BaseX beta 6aeaebf (that is not showing this issue), waiting for a fix.
Cheers,
Jean-Marc
2014/1/10 jean-marc Mercier <jeanmarc.mercier at gmail.com>
Quoted text · jean-marc Mercier · 169 lines
> Hi all, > > it seems that this bug is linked to the introspection module. I isolated a > code that produces on my config a exception, see at end of mail. > Note : > - It seems to be a regression, as this code worked finely with the 3/12 > version of BaseX. > - It took me a whole day to isolate this exception. This "overhead" is due > to the JAVA catch / raising exception BaseX mechanism, letting the user > blind with its XQUERY code. As bugs are becoming harder and harder to spot, > maybe we should think about a way, or a tool, to easen trace / debug while > the interpreter raises a JAVA exception ? > > Cheers > > > declare function local:map_inspect_functions() { map:new(for $fun in > inspect:functions() return map:entry(local:name-function($fun),$fun)) }; > declare function > local:name-function($fun){fn:data(inspect:function($fun)/@name)}; > declare function local:get_void() { function(){ () }}; > declare variable $local:MapIntrospecting := local:map_inspect_functions(); > let $fun_2 := map:get($local:MapIntrospecting,"local:get_void") > return count($fun_2()) > > Improper use? Potential bug? Your feedback is welcome: > Contact: basex-talk at mailman.uni-konstanz.de > Version: BaseX 7.8 beta 132460f > Java: Oracle Corporation, 1.7.0_45 > OS: Windows 7, amd64 > Stack Trace: > java.lang.ClassCastException: org.basex.query.value.type.AtomType cannot > be cast to org.basex.query.value.type.FuncType > at org.basex.query.func.InlineFunc.item(InlineFunc.java:261) > at org.basex.query.func.InlineFunc.value(InlineFunc.java:280) > at org.basex.query.QueryContext.value(QueryContext.java:366) > at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203) > at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) > at org.basex.query.func.FuncCall.value(FuncCall.java:52) > at org.basex.query.QueryContext.value(QueryContext.java:366) > at org.basex.query.value.item.FuncItem.invValue(FuncItem.java:130) > at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) > at org.basex.query.func.FuncCall.value(FuncCall.java:52) > at org.basex.query.func.FuncCall.iter(FuncCall.java:57) > at org.basex.query.QueryContext.iter(QueryContext.java:355) > at org.basex.query.func.FNAggr.item(FNAggr.java:36) > at org.basex.query.expr.ParseExpr.iter(ParseExpr.java:46) > at org.basex.query.MainModule.iter(MainModule.java:96) > at org.basex.query.QueryContext.iter(QueryContext.java:309) > at org.basex.query.QueryProcessor.iter(QueryProcessor.java:81) > at org.basex.core.cmd.AQuery.query(AQuery.java:89) > at org.basex.core.cmd.XQuery.run(XQuery.java:22) > at org.basex.core.Command.run(Command.java:329) > at org.basex.core.Command.execute(Command.java:94) > at org.basex.server.LocalSession.execute(LocalSession.java:121) > at org.basex.server.Session.execute(Session.java:37) > at org.basex.core.Main.execute(Main.java:146) > at org.basex.BaseX.<init>(BaseX.java:119) > at org.basex.BaseX.main(BaseX.java:38) > > > > > 2014/1/6 jean-marc Mercier <jeanmarc.mercier at gmail.com> > >> Note : casewhere, I checked that this issue does not depend upon the >> values of INLINELIMIT and TAILCALL. >> >> >> 2014/1/6 jean-marc Mercier <jeanmarc.mercier at gmail.com> >> >>> Hello, >>> >>> I have a quite strange behavior, that might be a bug in the >>> introspection module. I am just describing it, and will work a bit to >>> produce a reproductible code if you don't have a quick clue about the >>> problem. >>> >>> I created a map of string to functions, called $common:MapIntrospecting, >>> generated by the introspection module. >>> >>> The following code works perfectly (you can't run it, but believe me :) >>> >>> declare variable $map := >>> map:entry("Alimentation:nodes#1",Alimentation:nodes#1); >>> declare variable $nodes := a big node... >>> >>> let $fun_1 := map:get($map,"Alimentation:nodes#1") >>> let $fun_2 := map:get($common:MapIntrospecting,"Alimentation:nodes#1") >>> return $fun_2($nodes) >>> >>> And now, the following code (I just cut the useless first line) produces >>> a spurious and ferocious exception >>> >>> let $fun_2 := map:get($common:MapIntrospecting,"Alimentation:nodes#1") >>> return $fun_2($nodes) >>> >>> Any clue ? >>> >>> Improper use? Potential bug? Your feedback is welcome: >>> Contact: basex-talk at mailman.uni-konstanz.de >>> Version: BaseX 7.8 beta 132460f >>> Java: Oracle Corporation, 1.7.0_45 >>> OS: Windows 7, amd64 >>> Stack Trace: >>> java.lang.ClassCastException: org.basex.query.value.type.AtomType cannot >>> be cast to org.basex.query.value.type.FuncType >>> at org.basex.query.func.InlineFunc.item(InlineFunc.java:261) >>> at org.basex.query.func.InlineFunc.value(InlineFunc.java:280) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at >>> org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154) >>> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203) >>> at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) >>> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154) >>> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at >>> org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154) >>> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203) >>> at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) >>> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203) >>> at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) >>> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >>> at org.basex.query.var.StaticVar.value(StaticVar.java:129) >>> at org.basex.query.var.StaticVarRef.value(StaticVarRef.java:58) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154) >>> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at org.basex.query.expr.List.value(List.java:133) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203) >>> at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) >>> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at org.basex.query.value.item.FuncItem.invValue(FuncItem.java:130) >>> at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) >>> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at org.basex.query.MainModule.value(MainModule.java:79) >>> at org.basex.query.QueryContext.value(QueryContext.java:323) >>> at org.basex.query.QueryContext.iter(QueryContext.java:309) >>> at org.basex.query.QueryProcessor.iter(QueryProcessor.java:81) >>> at org.basex.core.cmd.AQuery.query(AQuery.java:89) >>> at org.basex.core.cmd.XQuery.run(XQuery.java:22) >>> at org.basex.core.Command.run(Command.java:329) >>> at org.basex.core.Command.execute(Command.java:94) >>> at org.basex.server.LocalSession.execute(LocalSession.java:121) >>> at org.basex.server.Session.execute(Session.java:37) >>> at org.basex.core.Main.execute(Main.java:146) >>> at org.basex.BaseX.<init>(BaseX.java:119) >>> at org.basex.BaseX.main(BaseX.java:38) >>> >>> >>> >>> >>> >>> >> >
CG
Hi Jean-Marc,
I’ve further simplified your example to the following query:
declare function local:f() { function() { () } };
inspect:functions()()We’ll let you know as soon as this bug is fixed [1].
Christian
[1] https://github.com/BaseXdb/basex/issues/839
Quoted text · jean-marc Mercier · 173 lines
On Fri, Jan 10, 2014 at 4:36 AM, jean-marc Mercier <jeanmarc.mercier at gmail.com> wrote: > Hi all, > > it seems that this bug is linked to the introspection module. I isolated a > code that produces on my config a exception, see at end of mail. > Note : > - It seems to be a regression, as this code worked finely with the 3/12 > version of BaseX. > - It took me a whole day to isolate this exception. This "overhead" is due > to the JAVA catch / raising exception BaseX mechanism, letting the user > blind with its XQUERY code. As bugs are becoming harder and harder to spot, > maybe we should think about a way, or a tool, to easen trace / debug while > the interpreter raises a JAVA exception ? > > Cheers > > > declare function local:map_inspect_functions() { map:new(for $fun in > inspect:functions() return map:entry(local:name-function($fun),$fun)) }; > declare function > local:name-function($fun){fn:data(inspect:function($fun)/@name)}; > declare function local:get_void() { function(){ () }}; > declare variable $local:MapIntrospecting := local:map_inspect_functions(); > let $fun_2 := map:get($local:MapIntrospecting,"local:get_void") > return count($fun_2()) > > Improper use? Potential bug? Your feedback is welcome: > Contact: basex-talk at mailman.uni-konstanz.de > Version: BaseX 7.8 beta 132460f > Java: Oracle Corporation, 1.7.0_45 > OS: Windows 7, amd64 > Stack Trace: > java.lang.ClassCastException: org.basex.query.value.type.AtomType cannot be > cast to org.basex.query.value.type.FuncType > at org.basex.query.func.InlineFunc.item(InlineFunc.java:261) > at org.basex.query.func.InlineFunc.value(InlineFunc.java:280) > at org.basex.query.QueryContext.value(QueryContext.java:366) > at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203) > at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) > at org.basex.query.func.FuncCall.value(FuncCall.java:52) > at org.basex.query.QueryContext.value(QueryContext.java:366) > at org.basex.query.value.item.FuncItem.invValue(FuncItem.java:130) > at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) > at org.basex.query.func.FuncCall.value(FuncCall.java:52) > at org.basex.query.func.FuncCall.iter(FuncCall.java:57) > at org.basex.query.QueryContext.iter(QueryContext.java:355) > at org.basex.query.func.FNAggr.item(FNAggr.java:36) > at org.basex.query.expr.ParseExpr.iter(ParseExpr.java:46) > at org.basex.query.MainModule.iter(MainModule.java:96) > at org.basex.query.QueryContext.iter(QueryContext.java:309) > at org.basex.query.QueryProcessor.iter(QueryProcessor.java:81) > at org.basex.core.cmd.AQuery.query(AQuery.java:89) > at org.basex.core.cmd.XQuery.run(XQuery.java:22) > at org.basex.core.Command.run(Command.java:329) > at org.basex.core.Command.execute(Command.java:94) > at org.basex.server.LocalSession.execute(LocalSession.java:121) > at org.basex.server.Session.execute(Session.java:37) > at org.basex.core.Main.execute(Main.java:146) > at org.basex.BaseX.<init>(BaseX.java:119) > at org.basex.BaseX.main(BaseX.java:38) > > > > > 2014/1/6 jean-marc Mercier <jeanmarc.mercier at gmail.com> >> >> Note : casewhere, I checked that this issue does not depend upon the >> values of INLINELIMIT and TAILCALL. >> >> >> 2014/1/6 jean-marc Mercier <jeanmarc.mercier at gmail.com> >>> >>> Hello, >>> >>> I have a quite strange behavior, that might be a bug in the introspection >>> module. I am just describing it, and will work a bit to produce a >>> reproductible code if you don't have a quick clue about the problem. >>> >>> I created a map of string to functions, called $common:MapIntrospecting, >>> generated by the introspection module. >>> >>> The following code works perfectly (you can't run it, but believe me :) >>> >>> declare variable $map := >>> map:entry("Alimentation:nodes#1",Alimentation:nodes#1); >>> declare variable $nodes := a big node... >>> >>> let $fun_1 := map:get($map,"Alimentation:nodes#1") >>> let $fun_2 := map:get($common:MapIntrospecting,"Alimentation:nodes#1") >>> return $fun_2($nodes) >>> >>> And now, the following code (I just cut the useless first line) produces >>> a spurious and ferocious exception >>> >>> let $fun_2 := map:get($common:MapIntrospecting,"Alimentation:nodes#1") >>> return $fun_2($nodes) >>> >>> Any clue ? >>> >>> Improper use? Potential bug? Your feedback is welcome: >>> Contact: basex-talk at mailman.uni-konstanz.de >>> Version: BaseX 7.8 beta 132460f >>> Java: Oracle Corporation, 1.7.0_45 >>> OS: Windows 7, amd64 >>> Stack Trace: >>> java.lang.ClassCastException: org.basex.query.value.type.AtomType cannot >>> be cast to org.basex.query.value.type.FuncType >>> at org.basex.query.func.InlineFunc.item(InlineFunc.java:261) >>> at org.basex.query.func.InlineFunc.value(InlineFunc.java:280) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154) >>> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203) >>> at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) >>> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154) >>> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154) >>> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203) >>> at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) >>> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203) >>> at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) >>> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >>> at org.basex.query.var.StaticVar.value(StaticVar.java:129) >>> at org.basex.query.var.StaticVarRef.value(StaticVarRef.java:58) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154) >>> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at org.basex.query.expr.List.value(List.java:133) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203) >>> at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) >>> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at org.basex.query.value.item.FuncItem.invValue(FuncItem.java:130) >>> at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) >>> at org.basex.query.func.FuncCall.value(FuncCall.java:52) >>> at org.basex.query.QueryContext.value(QueryContext.java:366) >>> at org.basex.query.MainModule.value(MainModule.java:79) >>> at org.basex.query.QueryContext.value(QueryContext.java:323) >>> at org.basex.query.QueryContext.iter(QueryContext.java:309) >>> at org.basex.query.QueryProcessor.iter(QueryProcessor.java:81) >>> at org.basex.core.cmd.AQuery.query(AQuery.java:89) >>> at org.basex.core.cmd.XQuery.run(XQuery.java:22) >>> at org.basex.core.Command.run(Command.java:329) >>> at org.basex.core.Command.execute(Command.java:94) >>> at org.basex.server.LocalSession.execute(LocalSession.java:121) >>> at org.basex.server.Session.execute(Session.java:37) >>> at org.basex.core.Main.execute(Main.java:146) >>> at org.basex.BaseX.<init>(BaseX.java:119) >>> at org.basex.BaseX.main(BaseX.java:38) >>> >>> >>> >>> >>> >> > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
Written for BaseX 7.7. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery