Forum: Building VoltDB Clients

Post: Adhoc / Bad file descriptor

Adhoc / Bad file descriptor
henning
Aug 7, 2010
Why is this failing?
import org.voltdb.*;
import org.voltdb.client.*;
//
public class Adhoc {
//
public static void main(String[] args) throws Exception {
//
VoltTable[] results = null;
//
org.voltdb.client.Client myApp;
myApp = ClientFactory.createClient();
myApp.createConnection("10.2.0.37", "program", "password");
//
try {
results = myApp.callProcedure("@AdHoc", "SELECT USERNAME FROM USER WHERE USERID=20").getResults();
}
catch (Exception e) {
e.printStackTrace();
}
for (VoltTable t: results) { System.out.println(t.toString()); }
}
}
I am getting
org.voltdb.client.ProcCallException: Bad file descriptor
at org.voltdb.client.ClientImpl.callProcedure(ClientImpl.java:148)
at Adhoc.main(Adhoc.java:15)
Exception in thread "main" java.lang.NullPointerException
at Adhoc.main(Adhoc.java:20)
if I use new String(), the same.
Henning, I can run this
rbetts
Aug 7, 2010
Henning,
I can run this client, modifying only the table and column in the SQL statement, against our voter example on voltdb-1.1 successfully. I get expected authentication error messages when I enable security and use invalid username/passwords and expected host not found error messages when I attempt to connect to an unknown host address. I see valid planner errors when I try to access an invalid table or column. So, that would seem to rule out the obvious user errors (no offense!).
My best guess is that the "Bad file descriptor" error indicates an attempted write to a closed socket. That implies unsuccessful authentication or something closing the channel between createConnection() and callProcedure(). Do you have security enabled in your project file? Presumably, other clients using this host and username/password function correctly?
*--Ryan.
No Security
henning
Aug 7, 2010
Ryan!
Thanks for the fast reply!
I had no security enabled and copied the client (twice over) from a working, non-ad-hoc Client.java. Not touching the connection lines.
I have security enabled now and get the same error. (Provided I really have it enabled but I think yes, added the nec stuff in project.xml and deployment.xml)
I am also getting this results with "SELECT NAME FROM PLAYER" hardcoded:
org.voltdb.client.ProcCallException: Stream closed
at org.voltdb.client.ClientImpl.callProcedure(ClientImpl.java:148)
at Adhoc.main(Adhoc.java:20)
Exception in thread "main" java.lang.NullPointerException
at Adhoc.main(Adhoc.java:25)
All other queries work just fine ...
One thing: I am working on Gentoo. With the CentOS package.
Generic Adhoc Client
henning
Aug 7, 2010
import org.voltdb.*;
import org.voltdb.client.*;
//
public class Adhoc {
//
public static void main(String[] args) throws Exception {
//
if(args.length < 1) {
System.out.printf("Needs query as command line parameter.
");
}
//
VoltTable[] results = null;
//
System.out.printf("Query: %s
", args[0]);
org.voltdb.client.Client myApp;
myApp = ClientFactory.createClient();
myApp.createConnection("10.2.0.37", "program", "password");
//
try {
results = myApp.callProcedure("@AdHoc", new String(args[0])).getResults();
}
catch (Exception e) {
e.printStackTrace();
}
for (VoltTable t: results) { System.out.println(t.toString()); }
}
}
I am getting, both with or w/o security:
org.voltdb.client.ProcCallException: Stream closed
at org.voltdb.client.ClientImpl.callProcedure(ClientImpl.java:148)
at Adhoc.main(Adhoc.java:20)
Exception in thread "main" java.lang.NullPointerException
at Adhoc.main(Adhoc.java:25)
Json
henning
Aug 7, 2010
Over JSON, the same:
http://10.2.0.37:8080/api/1.0/?Procedure=@AdHoc&Parameters=[%22SELECT+COUNT%28*%29+FROM+USERS+WHERE+USERID=20%22]
{"status":-3,"appstatus":-128,"statusstring":"Stream closed","appstatusstring":null,"exception":null,"results":[]}
I found this in the output:
185549 [PeriodicWork] ERROR ADHOCPLANNERTHREAD - Was forced to kill the planner process due to a timeout. It will be restarted if needed.
each time I am trying the query.
And in plannerlog tons of these, though not per query but per compile as it seems?
getting started at: Sat Aug 07 07:49:10 EDT 2010
catalog loaded
Error creating hsql: unexpected end of statement
getting started at: Sat Aug 07 07:59:11 EDT 2010
catalog loaded
Error creating hsql: unexpected end of statement
getting started at: Sat Aug 07 07:59:30 EDT 2010
catalog loaded
Error creating hsql: unexpected end of statement
getting started at: Sat Aug 07 08:11:02 EDT 2010
catalog loaded
Error creating hsql: unexpected end of statement
getting started at: Sat Aug 07 08:13:42 EDT 2010
catalog loaded
Error creating hsql: unexpected end of statement
Where should I look for more information?
Thanks!
Henning
"Error creating hsql:
rbetts
Aug 7, 2010
Over JSON, the same:
http://10.2.0.37:8080/api/1.0/?Procedure=@AdHoc&Parameters=[%22SELECT+COUNT%28*%29+FROM+USERS+WHERE+USERID=20%22]
{"status":-3,"appstatus":-128,"statusstring":"Stream closed","appstatusstring":null,"exception":null,"results":[]}
I found this in the output:
185549 [PeriodicWork] ERROR ADHOCPLANNERTHREAD - Was forced to kill the planner process due to a timeout. It will be restarted if needed.
each time I am trying the query.
And in plannerlog tons of these, though not per query but per compile as it seems?
getting started at: Sat Aug 07 07:49:10 EDT 2010
catalog loaded
Error creating hsql: unexpected end of statement
getting started at: Sat Aug 07 07:59:11 EDT 2010
catalog loaded
Error creating hsql: unexpected end of statement
getting started at: Sat Aug 07 07:59:30 EDT 2010
catalog loaded
Error creating hsql: unexpected end of statement
getting started at: Sat Aug 07 08:11:02 EDT 2010
catalog loaded
Error creating hsql: unexpected end of statement
getting started at: Sat Aug 07 08:13:42 EDT 2010
catalog loaded
Error creating hsql: unexpected end of statement
Where should I look for more information?
Thanks!
Henning


"Error creating hsql: unexpected end of statement"
Do you reproduce this after adding a semi-colon to terminate your SQL statement?
Error creating hsql: unexpected end of statement
henning
Aug 7, 2010
It's per statement it seems, I tested with tail -f and saw the writes to the log.
"org.voltdb.client.ProcCallException: Bad file descriptor" and the Stream error cause the exact same entry there.
Henning, We'll investigate
rbetts
Aug 7, 2010
It's per statement it seems, I tested with tail -f and saw the writes to the log.
"org.voltdb.client.ProcCallException: Bad file descriptor" and the Stream error cause the exact same entry there.


Henning,
We'll investigate this. It isn't immediately clear what the underlying error is.
*--Ryan.
Re: Error creating hsql: unexpected end of statement
izzy
Aug 10, 2010
Henning,
I've created ENG-694, which I'm hoping is the cause of at least some of your issues here. The 'Error creating hsql: unexpected end of statement' message is generated by the DDL parsing of the external planning process used to plan adhoc queries, and there are ways in VoltDB 1.1 where DDL statements could be parsed successfully by the VoltCompiler but cause the external adhoc planning process to fail. When it fails during DDL parsing, it generates the 'stream closed' errors that you've observed.
One thing I can't fit into this hypothesis is from above, where you state that:
> I am also getting this results with "SELECT NAME FROM PLAYER" hard-coded:
> [error text deleted]
> All other queries work just fine ...
Were the working queries also adhoc queries against the same DDL? ENG-694 would kill off the external planner on every adhoc query, so if some worked, then it's back to the drawing board here.
Thanks,
Mike