{"action":"created","issue":{"url":"https://api.github.com/repos/apache/zeppelin/issues/1237","repository_url":"https://api.github.com/repos/apache/zeppelin","labels_url":"https://api.github.com/repos/apache/zeppelin/issues/1237/labels{/name}","comments_url":"https://api.github.com/repos/apache/zeppelin/issues/1237/comments","events_url":"https://api.github.com/repos/apache/zeppelin/issues/1237/events","html_url":"https://github.com/apache/zeppelin/pull/1237","id":168021639,"number":1237,"title":"ZEPPELIN-1242. Should set property SPARK_YARN_MODE and do login before creating any spark stuff","user":{"login":"zjffdu","id":164491,"avatar_url":"https://avatars.githubusercontent.com/u/164491?v=3","gravatar_id":"","url":"https://api.github.com/users/zjffdu","html_url":"https://github.com/zjffdu","followers_url":"https://api.github.com/users/zjffdu/followers","following_url":"https://api.github.com/users/zjffdu/following{/other_user}","gists_url":"https://api.github.com/users/zjffdu/gists{/gist_id}","starred_url":"https://api.github.com/users/zjffdu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zjffdu/subscriptions","organizations_url":"https://api.github.com/users/zjffdu/orgs","repos_url":"https://api.github.com/users/zjffdu/repos","events_url":"https://api.github.com/users/zjffdu/events{/privacy}","received_events_url":"https://api.github.com/users/zjffdu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-28T06:20:57Z","updated_at":"2016-07-28T06:53:09Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/zeppelin/pulls/1237","html_url":"https://github.com/apache/zeppelin/pull/1237","diff_url":"https://github.com/apache/zeppelin/pull/1237.diff","patch_url":"https://github.com/apache/zeppelin/pull/1237.patch"},"body":"### What is this PR for?\r\n\r\nWe run zeppelin on spark when spark authentication is turned on, but got the following exception\r\n```\r\n INFO [2016-07-28 00:35:32,845] ({pool-2-thread-2} Logging.scala[logInfo]:58) - Changing view acls to: zeppelin\r\n INFO [2016-07-28 00:35:32,846] ({pool-2-thread-2} Logging.scala[logInfo]:58) - Changing modify acls to: zeppelin\r\n INFO [2016-07-28 00:35:32,908] ({pool-1-thread-3} Logging.scala[logInfo]:58) - Changing view acls to: zeppelin\r\n INFO [2016-07-28 00:35:32,908] ({pool-1-thread-3} Logging.scala[logInfo]:58) - Changing modify acls to: zeppelin\r\nERROR [2016-07-28 00:35:32,909] ({pool-2-thread-2} Job.java[run]:189) - Job failed\r\njava.lang.IllegalArgumentException: Error: a secret key must be specified via the spark.authenticate.secret config\r\n        at org.apache.spark.SecurityManager.generateSecretKey(SecurityManager.scala:397)\r\n        at org.apache.spark.SecurityManager.<init>(SecurityManager.scala:219)\r\n        at org.apache.spark.repl.SparkIMain.<init>(SparkIMain.scala:118)\r\n        at org.apache.spark.repl.SparkILoop$SparkILoopInterpreter.<init>(SparkILoop.scala:187)\r\n        at org.apache.spark.repl.SparkILoop.createInterpreter(SparkILoop.scala:217)\r\n        at org.apache.zeppelin.spark.SparkInterpreter.open(SparkInterpreter.java:566)\r\n        at org.apache.zeppelin.interpreter.LazyOpenInterpreter.open(LazyOpenInterpreter.java:69)\r\n        at org.apache.zeppelin.interpreter.LazyOpenInterpreter.interpret(LazyOpenInterpreter.java:93)\r\n        at org.apache.zeppelin.interpreter.remote.RemoteInterpreterServer$InterpretJob.jobRun(RemoteInterpreterServer.java:341)\r\n        at org.apache.zeppelin.scheduler.Job.run(Job.java:176)\r\n        at org.apache.zeppelin.scheduler.FIFOScheduler$1.run(FIFOScheduler.java:139)\r\n        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\r\n        at java.util.concurrent.FutureTask.run(FutureTask.java:266)\r\n        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)\r\n        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)\r\n        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\r\n        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\r\n        at java.lang.Thread.run(Thread.java:745)\r\nERROR [2016-07-28 00:35:32,918] ({pool-1-thread-3} TThreadPoolServer.java[run]:296) - Error occurred during processing of message.\r\njava.lang.IllegalArgumentException: Error: a secret key must be specified via the spark.authenticate.secret config\r\n        at org.apache.spark.SecurityManager.generateSecretKey(SecurityManager.scala:397)\r\n        at org.apache.spark.SecurityManager.<init>(SecurityManager.scala:219)\r\n        at org.apache.spark.repl.SparkIMain.<init>(SparkIMain.scala:118)\r\n        at org.apache.spark.repl.SparkILoop$SparkILoopInterpreter.<init>(SparkILoop.scala:187)\r\n        at org.apache.spark.repl.SparkILoop.createInterpreter(SparkILoop.scala:217)\r\n        at org.apache.zeppelin.spark.SparkInterpreter.open(SparkInterpreter.java:566)\r\n        at org.apache.zeppelin.interpreter.LazyOpenInterpreter.open(LazyOpenInterpreter.java:69)\r\n        at org.apache.zeppelin.interpreter.LazyOpenInterpreter.getProgress(LazyOpenInterpreter.java:110)\r\n        at org.apache.zeppelin.interpreter.remote.RemoteInterpreterServer.getProgress(RemoteInterpreterServer.java:404)\r\n        at org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService$Processor$getProgress.getResult(RemoteInterpreterService.java:1509)\r\n        at org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService$Processor$getProgress.getResult(RemoteInterpreterService.java:1494)\r\n        at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)\r\n        at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)\r\n        at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:285)\r\n        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\r\n        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\r\n        at java.lang.Thread.run(Thread.java:745)\r\n```\r\nThe root cause is that we didn't set property SPARK_YARN_MODE just like spark-shell did. \r\n\r\nThe following code in Main.scala is what we miss in zeppelin spark interpreter. https://github.com/apache/spark/blob/branch-1.6/repl/scala-2.11/src/main/scala/org/apache/spark/repl/Main.scala\r\n```\r\n  def main(args: Array[String]) {\r\n    if (getMaster == \"yarn-client\") System.setProperty(\"SPARK_YARN_MODE\", \"true\")\r\n```\r\nBesides that, we need to do login before creating any spark stuff, otherwise will hit the classnotfound issue http://mail-archives.apache.org/mod_mbox/zeppelin-users/201606.mbox/%3CCAH-=KK2SzsXX5zvfnuoLbB1753Tm196_bcB83NzzooedSbLpRQ@mail.gmail.com%3E. The cause is that SecurityManager will add secretkey to credential, so before that we should do login, otherwise Executor can not connect to HttpFileServer on driver correctly due to the missing of secretkey. \r\n\r\n\r\n### What type of PR is it?\r\n[Bug Fix]\r\n\r\n\r\n### What is the Jira issue?\r\n* https://issues.apache.org/jira/browse/ZEPPELIN-1215\r\n\r\n### How should this be tested?\r\nTest it on secured cluster manually. \r\n\r\n\r\n\r\n### Questions:\r\n* Does the licenses files need update? No\r\n* Is there breaking changes for older versions? No\r\n* Does this needs documentation? No\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/apache/zeppelin/issues/comments/235814095","html_url":"https://github.com/apache/zeppelin/pull/1237#issuecomment-235814095","issue_url":"https://api.github.com/repos/apache/zeppelin/issues/1237","id":235814095,"user":{"login":"prabhjyotsingh","id":674497,"avatar_url":"https://avatars.githubusercontent.com/u/674497?v=3","gravatar_id":"","url":"https://api.github.com/users/prabhjyotsingh","html_url":"https://github.com/prabhjyotsingh","followers_url":"https://api.github.com/users/prabhjyotsingh/followers","following_url":"https://api.github.com/users/prabhjyotsingh/following{/other_user}","gists_url":"https://api.github.com/users/prabhjyotsingh/gists{/gist_id}","starred_url":"https://api.github.com/users/prabhjyotsingh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prabhjyotsingh/subscriptions","organizations_url":"https://api.github.com/users/prabhjyotsingh/orgs","repos_url":"https://api.github.com/users/prabhjyotsingh/repos","events_url":"https://api.github.com/users/prabhjyotsingh/events{/privacy}","received_events_url":"https://api.github.com/users/prabhjyotsingh/received_events","type":"User","site_admin":false},"created_at":"2016-07-28T06:53:09Z","updated_at":"2016-07-28T06:53:09Z","body":"LGTM. Re-trigger CI."}}
{"actor":{"display_login":"prabhjyotsingh"}}