zeppelin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mina...@apache.org
Subject zeppelin git commit: [ZEPPELIN- 1298] Log instead of throwing trace for ping messages
Date Tue, 09 Aug 2016 00:56:25 GMT
Repository: zeppelin
Updated Branches:
  refs/heads/branch-0.6 a6d501a91 -> 4274208f9


[ZEPPELIN- 1298] Log instead of throwing trace for ping messages

When non authenticated user in non-anonymous mode tries to send any websocket api message
it results in throwing a traceback. However on PING message we don't need to show the whole
traceback and we can just log in order not to pollute the logs file.

Hot Fix

* [x] - log and return on PING

[Zeppelin-1298](https://issues.apache.org/jira/browse/ZEPPELIN-1298)

Follow the steps in issue and shouldn't get repeating traceback.

* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no

Author: Khalid Huseynov <khalidhnv@gmail.com>

Closes #1293 from khalidhuseynov/hotfix/zeppelin-1298 and squashes the following commits:

ff7812a [Khalid Huseynov] warn if non-empty invalid ticket
6da7bd4 [Khalid Huseynov] log in debug mode all invalid ticket cases
c1160a7 [Khalid Huseynov] don't throw exception on ping

(cherry picked from commit 36a7e38ffd6af614ad770a6e23ec1fd98a90c809)
Signed-off-by: Mina Lee <minalee@apache.org>

Conflicts:
	zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/4274208f
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/4274208f
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/4274208f

Branch: refs/heads/branch-0.6
Commit: 4274208f9c3bf4760a6b68f4fddc8a9a7e54f489
Parents: a6d501a
Author: Khalid Huseynov <khalidhnv@gmail.com>
Authored: Mon Aug 8 08:18:10 2016 +0400
Committer: Mina Lee <minalee@apache.org>
Committed: Tue Aug 9 09:56:06 2016 +0900

----------------------------------------------------------------------
 .../org/apache/zeppelin/socket/NotebookServer.java    | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/4274208f/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
index c9ac312..bed5d57 100644
--- a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
+++ b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
@@ -29,6 +29,7 @@ import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import com.google.gson.reflect.TypeToken;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.zeppelin.conf.ZeppelinConfiguration;
 import org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars;
 import org.apache.zeppelin.display.AngularObject;
@@ -113,8 +114,17 @@ public class NotebookServer extends WebSocketServlet implements
       }
       
       String ticket = TicketContainer.instance.getTicket(messagereceived.principal);
-      if (ticket != null && !ticket.equals(messagereceived.ticket))
-        throw new Exception("Invalid ticket " + messagereceived.ticket + " != " + ticket);
+      if (ticket != null && !ticket.equals(messagereceived.ticket)){
+        /* not to pollute logs, log instead of exception */
+        if (StringUtils.isEmpty(messagereceived.ticket)) {
+          LOG.debug("{} message: invalid ticket {} != {}", messagereceived.op,
+              messagereceived.ticket, ticket);
+        } else {
+          LOG.warn("{} message: invalid ticket {} != {}", messagereceived.op,
+              messagereceived.ticket, ticket);
+        }
+        return;
+      }
 
       ZeppelinConfiguration conf = ZeppelinConfiguration.create();
       boolean allowAnonymous = conf.


Mime
View raw message