Richard Xin created ZEPPELIN-2828:
-------------------------------------

             Summary: unhandled NullPointerException in PostgreSqlInterpreter 
when unable to connect
                 Key: ZEPPELIN-2828
                 URL: https://issues.apache.org/jira/browse/ZEPPELIN-2828
             Project: Zeppelin
          Issue Type: Bug
          Components: Interpreters
    Affects Versions: 0.7.2
         Environment: AWS EMR 



            Reporter: Richard Xin


Steps to reproduce:
1. add postges interpreter via Interpreter UI
2. use "jdbc:postgresql://[db_host]:5432/" as postgresql.url where the default 
value was "jdbc:postgresql://localhost:5432/"
3. create a new notebook:
%postgresql   (or %psql)
select * from test.batch_report; 

got NPE, and here is what in the log:

INFO [2017-08-03 20:22:53,610] ({pool-2-thread-2} 
SchedulerFactory.java[jobStarted]:131) - Job paragraph_1501783535283_1713771734 
started by scheduler 
org.apache.zeppelin.interpreter.remote.RemoteInterpretershared_session392982422
INFO [2017-08-03 20:22:53,611] ({pool-2-thread-2} Paragraph.java[jobRun]:362) - 
run paragraph 20170803-180535_552293631 using psql 
org.apache.zeppelin.interpreter.LazyOpenInterpreter@144aa9ed
INFO [2017-08-03 20:22:53,620] ({pool-2-thread-2} 
RemoteInterpreterManagedProcess.java[start]:126) - Run interpreter process 
[/usr/lib/zeppelin/bin/interpreter.sh, -d, 
/usr/lib/zeppelin/interpreter/postgresql, -p, 42610, -l, 
/usr/lib/zeppelin/local-repo/2CPQEJPGC]
INFO [2017-08-03 20:22:54,190] ({pool-2-thread-2} 
RemoteInterpreter.java[init]:221) - Create remote interpreter 
org.apache.zeppelin.postgresql.PostgreSqlInterpreter
INFO [2017-08-03 20:22:54,370] ({pool-2-thread-2} 
RemoteInterpreter.java[pushAngularObjectRegistryToRemote]:551) - Push local 
angular object registry from ZeppelinServer to remote interpreter group 
2CPQEJPGC:shared_process
WARN [2017-08-03 20:22:54,606] ({pool-2-thread-2} 
NotebookServer.java[afterStatusChange]:2058) - Job 20170803-180535_552293631 is 
finished, status: ERROR, exception: null, result: %text 
java.lang.NullPointerException
    at 
org.apache.zeppelin.postgresql.PostgreSqlInterpreter.executeSql(PostgreSqlInterpreter.java:202)
    at 
org.apache.zeppelin.postgresql.PostgreSqlInterpreter.interpret(PostgreSqlInterpreter.java:289)
    at 
org.apache.zeppelin.interpreter.LazyOpenInterpreter.interpret(LazyOpenInterpreter.java:97)
    at 
org.apache.zeppelin.interpreter.remote.RemoteInterpreterServer$InterpretJob.jobRun(RemoteInterpreterServer.java:498)
    at org.apache.zeppelin.scheduler.Job.run(Job.java:175)
    at org.apache.zeppelin.scheduler.FIFOScheduler$1.run(FIFOScheduler.java:139)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

INFO [2017-08-03 20:22:54,673] ({pool-2-thread-2} 
SchedulerFactory.java[jobFinished]:137) - Job 
paragraph_1501783535283_1713771734 finished by scheduler 
org.apache.zeppelin.interpreter.remote.RemoteInterpretershared_session392982422

I later worked around NPE by adding database name as part of the postgresql.url.

I believe this NPE exception is better to be handled and emit more 
user-friendly error message.




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to