You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@zeppelin.apache.org by linxi zeng <li...@gmail.com> on 2015/09/22 08:59:29 UTC

zeppelin NotebookServer broadcastAll may get web socket error when LIST_NOTES

hi, moon:
Recently, we often encounter a same problem when open some web url (ex.
localhost:8080) to access zeppelin server, there are no note show in the
web page, and refresh the web page did't work. Then we find the error info
in zeppelin logs:

--------------------------------------------------------------------------------------------------------------------------------
INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
NotebookServer.java[onMessage]:101) - RECEIVE << PING
INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
NotebookServer.java[onMessage]:101) - RECEIVE << PING
INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
NotebookServer.java[onMessage]:101) - RECEIVE << PING
INFO [2015-09-22 10:05:43,590] ({qtp489396160-1329}
NotebookServer.java[onOpen]:89) - New connection from xxx : 49725
INFO [2015-09-22 10:05:43,619] ({qtp489396160-1329}
NotebookServer.java[onMessage]:101) - RECEIVE << LIST_NOTES
ERROR [2015-09-22 10:05:43,620] ({qtp489396160-1329}
NotebookServer.java[broadcastAll]:270) - socket error
java.io.IOException: closedOut 1001:null
at
org.eclipse.jetty.websocket.WebSocketConnectionRFC6455$WSFrameConnection.sendMessage(WebSocketConnectionRFC6455.java:437)
at org.apache.zeppelin.socket.NotebookSocket.send(NotebookSocket.java:69)
at
org.apache.zeppelin.socket.NotebookServer.broadcastAll(NotebookServer.java:268)
at
org.apache.zeppelin.socket.NotebookServer.broadcastNoteList(NotebookServer.java:302)
at
org.apache.zeppelin.socket.NotebookServer.onMessage(NotebookServer.java:105)
at
org.apache.zeppelin.socket.NotebookSocket.onMessage(NotebookSocket.java:56)
at
org.eclipse.jetty.websocket.WebSocketConnectionRFC6455$WSFrameHandler.onFrame(WebSocketConnectionRFC6455.java:835)
at
org.eclipse.jetty.websocket.WebSocketParserRFC6455.parseNext(WebSocketParserRFC6455.java:349)
at
org.eclipse.jetty.websocket.WebSocketConnectionRFC6455.handle(WebSocketConnectionRFC6455.java:225)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:745)
INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
NotebookServer.java[onMessage]:101) - RECEIVE << PING
INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
NotebookServer.java[onMessage]:101) - RECEIVE << PING
INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
NotebookServer.java[onMessage]:101) - RECEIVE << PING
INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
NotebookServer.java[onMessage]:101) - RECEIVE << PING
-----------------------------------------------------------------------------------------------------------

in the NotebookServer.java we find that when we access the zeppelin web, it
will call broadcastNoteList(), and then broadcastNoteList will call
broadcastAll():
{noformat}
  private void broadcastAll(Message m) {
    synchronized (connectedSockets) {
      for (NotebookSocket conn : connectedSockets) {
        try {
          conn.send(serializeMessage(m));
        } catch (IOException e) {
          LOG.error("socket error", e);
        }
      }
    }
  }

------------------------------------------------------------------------------------------------------------------------
the broadcaseAll function will call conn.send(serializeMessage(m))  one by
one to send message, and if one conn has some problem say: closed or send
message timeout, it will block the other socket to get the message, so some
zeppelin web url can't show any note in home page.
I think it's better to:
(1)judge if the conn is open before call conn.send(serializeMessage(m));
(2)call conn.send(serializeMessage(m)) concurrently

Re: zeppelin NotebookServer broadcastAll may get web socket error when LIST_NOTES

Posted by linxi zeng <li...@gmail.com>.
and I think put the new conn to the first instead of the last position of
connetedSockets is a simple bug very useful change:

*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 2048cb9..5697c4b 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*

*@@ -89,7 +89,9 @@* public class NotebookServer extends WebSocketServlet
implements

     LOG.info("New connection from {} : {}",
conn.getRequest().getRemoteAddr(),

         conn.getRequest().getRemotePort());

     synchronized (connectedSockets) {

*-      connectedSockets.add(conn);*

*+      //connectedSockets.add(conn);*

*+      //put the new conn to the first position of connectedSockets*

*+      connectedSockets.add(0, conn);*

     }

   }

2015-09-22 15:07 GMT+08:00 linxi zeng <li...@gmail.com>:

> this problem is reported in:
> https://issues.apache.org/jira/browse/ZEPPELIN-312
>
> 2015-09-22 15:05 GMT+08:00 linxi zeng <li...@gmail.com>:
>
>> and the problem can reproduce by:
>>
>> *diff --git
>> a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java
>> b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java*
>>
>> *index aceea45..35c3696 100644*
>>
>> *---
>> a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java*
>>
>> *+++
>> b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java*
>>
>> *@@ -66,6 +66,11 @@* public class NotebookSocket implements
>> WebSocket.OnTextMessage{
>>
>>    }
>>
>>
>>
>>    public void send(String serializeMessage) throws IOException {
>>
>> *+    try {*
>>
>> *+      Thread.sleep(30000);*
>>
>> *+    } catch (InterruptedException e) {*
>>
>> *+      e.printStackTrace();*
>>
>> *+    }*
>>
>>      connection.sendMessage(serializeMessage);
>>
>>    }
>>
>> 2015-09-22 14:59 GMT+08:00 linxi zeng <li...@gmail.com>:
>>
>>> hi, moon:
>>> Recently, we often encounter a same problem when open some web url (ex.
>>> localhost:8080) to access zeppelin server, there are no note show in the
>>> web page, and refresh the web page did't work. Then we find the error info
>>> in zeppelin logs:
>>>
>>>
>>> --------------------------------------------------------------------------------------------------------------------------------
>>> INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
>>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>>> INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
>>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>>> INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
>>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>>> INFO [2015-09-22 10:05:43,590] ({qtp489396160-1329}
>>> NotebookServer.java[onOpen]:89) - New connection from xxx : 49725
>>> INFO [2015-09-22 10:05:43,619] ({qtp489396160-1329}
>>> NotebookServer.java[onMessage]:101) - RECEIVE << LIST_NOTES
>>> ERROR [2015-09-22 10:05:43,620] ({qtp489396160-1329}
>>> NotebookServer.java[broadcastAll]:270) - socket error
>>> java.io.IOException: closedOut 1001:null
>>> at
>>> org.eclipse.jetty.websocket.WebSocketConnectionRFC6455$WSFrameConnection.sendMessage(WebSocketConnectionRFC6455.java:437)
>>> at org.apache.zeppelin.socket.NotebookSocket.send(NotebookSocket.java:69)
>>> at
>>> org.apache.zeppelin.socket.NotebookServer.broadcastAll(NotebookServer.java:268)
>>> at
>>> org.apache.zeppelin.socket.NotebookServer.broadcastNoteList(NotebookServer.java:302)
>>> at
>>> org.apache.zeppelin.socket.NotebookServer.onMessage(NotebookServer.java:105)
>>> at
>>> org.apache.zeppelin.socket.NotebookSocket.onMessage(NotebookSocket.java:56)
>>> at
>>> org.eclipse.jetty.websocket.WebSocketConnectionRFC6455$WSFrameHandler.onFrame(WebSocketConnectionRFC6455.java:835)
>>> at
>>> org.eclipse.jetty.websocket.WebSocketParserRFC6455.parseNext(WebSocketParserRFC6455.java:349)
>>> at
>>> org.eclipse.jetty.websocket.WebSocketConnectionRFC6455.handle(WebSocketConnectionRFC6455.java:225)
>>> at
>>> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)
>>> at
>>> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
>>> at
>>> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
>>> at
>>> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
>>> at java.lang.Thread.run(Thread.java:745)
>>> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
>>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>>> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
>>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>>> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
>>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>>> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
>>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>>>
>>> -----------------------------------------------------------------------------------------------------------
>>>
>>> in the NotebookServer.java we find that when we access the zeppelin web,
>>> it will call broadcastNoteList(), and then broadcastNoteList will call
>>> broadcastAll():
>>> {noformat}
>>>   private void broadcastAll(Message m) {
>>>     synchronized (connectedSockets) {
>>>       for (NotebookSocket conn : connectedSockets) {
>>>         try {
>>>           conn.send(serializeMessage(m));
>>>         } catch (IOException e) {
>>>           LOG.error("socket error", e);
>>>         }
>>>       }
>>>     }
>>>   }
>>>
>>>
>>> ------------------------------------------------------------------------------------------------------------------------
>>> the broadcaseAll function will call conn.send(serializeMessage(m))  one
>>> by one to send message, and if one conn has some problem say: closed or
>>> send message timeout, it will block the other socket to get the message, so
>>> some zeppelin web url can't show any note in home page.
>>> I think it's better to:
>>> (1)judge if the conn is open before call conn.send(serializeMessage(m));
>>> (2)call conn.send(serializeMessage(m)) concurrently
>>>
>>
>>
>

Re: zeppelin NotebookServer broadcastAll may get web socket error when LIST_NOTES

Posted by linxi zeng <li...@gmail.com>.
and I think put the new conn to the first instead of the last position of
connetedSockets is a simple bug very useful change:

*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 2048cb9..5697c4b 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*

*@@ -89,7 +89,9 @@* public class NotebookServer extends WebSocketServlet
implements

     LOG.info("New connection from {} : {}",
conn.getRequest().getRemoteAddr(),

         conn.getRequest().getRemotePort());

     synchronized (connectedSockets) {

*-      connectedSockets.add(conn);*

*+      //connectedSockets.add(conn);*

*+      //put the new conn to the first position of connectedSockets*

*+      connectedSockets.add(0, conn);*

     }

   }

2015-09-22 15:07 GMT+08:00 linxi zeng <li...@gmail.com>:

> this problem is reported in:
> https://issues.apache.org/jira/browse/ZEPPELIN-312
>
> 2015-09-22 15:05 GMT+08:00 linxi zeng <li...@gmail.com>:
>
>> and the problem can reproduce by:
>>
>> *diff --git
>> a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java
>> b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java*
>>
>> *index aceea45..35c3696 100644*
>>
>> *---
>> a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java*
>>
>> *+++
>> b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java*
>>
>> *@@ -66,6 +66,11 @@* public class NotebookSocket implements
>> WebSocket.OnTextMessage{
>>
>>    }
>>
>>
>>
>>    public void send(String serializeMessage) throws IOException {
>>
>> *+    try {*
>>
>> *+      Thread.sleep(30000);*
>>
>> *+    } catch (InterruptedException e) {*
>>
>> *+      e.printStackTrace();*
>>
>> *+    }*
>>
>>      connection.sendMessage(serializeMessage);
>>
>>    }
>>
>> 2015-09-22 14:59 GMT+08:00 linxi zeng <li...@gmail.com>:
>>
>>> hi, moon:
>>> Recently, we often encounter a same problem when open some web url (ex.
>>> localhost:8080) to access zeppelin server, there are no note show in the
>>> web page, and refresh the web page did't work. Then we find the error info
>>> in zeppelin logs:
>>>
>>>
>>> --------------------------------------------------------------------------------------------------------------------------------
>>> INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
>>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>>> INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
>>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>>> INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
>>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>>> INFO [2015-09-22 10:05:43,590] ({qtp489396160-1329}
>>> NotebookServer.java[onOpen]:89) - New connection from xxx : 49725
>>> INFO [2015-09-22 10:05:43,619] ({qtp489396160-1329}
>>> NotebookServer.java[onMessage]:101) - RECEIVE << LIST_NOTES
>>> ERROR [2015-09-22 10:05:43,620] ({qtp489396160-1329}
>>> NotebookServer.java[broadcastAll]:270) - socket error
>>> java.io.IOException: closedOut 1001:null
>>> at
>>> org.eclipse.jetty.websocket.WebSocketConnectionRFC6455$WSFrameConnection.sendMessage(WebSocketConnectionRFC6455.java:437)
>>> at org.apache.zeppelin.socket.NotebookSocket.send(NotebookSocket.java:69)
>>> at
>>> org.apache.zeppelin.socket.NotebookServer.broadcastAll(NotebookServer.java:268)
>>> at
>>> org.apache.zeppelin.socket.NotebookServer.broadcastNoteList(NotebookServer.java:302)
>>> at
>>> org.apache.zeppelin.socket.NotebookServer.onMessage(NotebookServer.java:105)
>>> at
>>> org.apache.zeppelin.socket.NotebookSocket.onMessage(NotebookSocket.java:56)
>>> at
>>> org.eclipse.jetty.websocket.WebSocketConnectionRFC6455$WSFrameHandler.onFrame(WebSocketConnectionRFC6455.java:835)
>>> at
>>> org.eclipse.jetty.websocket.WebSocketParserRFC6455.parseNext(WebSocketParserRFC6455.java:349)
>>> at
>>> org.eclipse.jetty.websocket.WebSocketConnectionRFC6455.handle(WebSocketConnectionRFC6455.java:225)
>>> at
>>> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)
>>> at
>>> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
>>> at
>>> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
>>> at
>>> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
>>> at java.lang.Thread.run(Thread.java:745)
>>> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
>>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>>> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
>>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>>> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
>>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>>> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
>>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>>>
>>> -----------------------------------------------------------------------------------------------------------
>>>
>>> in the NotebookServer.java we find that when we access the zeppelin web,
>>> it will call broadcastNoteList(), and then broadcastNoteList will call
>>> broadcastAll():
>>> {noformat}
>>>   private void broadcastAll(Message m) {
>>>     synchronized (connectedSockets) {
>>>       for (NotebookSocket conn : connectedSockets) {
>>>         try {
>>>           conn.send(serializeMessage(m));
>>>         } catch (IOException e) {
>>>           LOG.error("socket error", e);
>>>         }
>>>       }
>>>     }
>>>   }
>>>
>>>
>>> ------------------------------------------------------------------------------------------------------------------------
>>> the broadcaseAll function will call conn.send(serializeMessage(m))  one
>>> by one to send message, and if one conn has some problem say: closed or
>>> send message timeout, it will block the other socket to get the message, so
>>> some zeppelin web url can't show any note in home page.
>>> I think it's better to:
>>> (1)judge if the conn is open before call conn.send(serializeMessage(m));
>>> (2)call conn.send(serializeMessage(m)) concurrently
>>>
>>
>>
>

Re: zeppelin NotebookServer broadcastAll may get web socket error when LIST_NOTES

Posted by linxi zeng <li...@gmail.com>.
this problem is reported in:
https://issues.apache.org/jira/browse/ZEPPELIN-312

2015-09-22 15:05 GMT+08:00 linxi zeng <li...@gmail.com>:

> and the problem can reproduce by:
>
> *diff --git
> a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java
> b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java*
>
> *index aceea45..35c3696 100644*
>
> *---
> a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java*
>
> *+++
> b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java*
>
> *@@ -66,6 +66,11 @@* public class NotebookSocket implements
> WebSocket.OnTextMessage{
>
>    }
>
>
>
>    public void send(String serializeMessage) throws IOException {
>
> *+    try {*
>
> *+      Thread.sleep(30000);*
>
> *+    } catch (InterruptedException e) {*
>
> *+      e.printStackTrace();*
>
> *+    }*
>
>      connection.sendMessage(serializeMessage);
>
>    }
>
> 2015-09-22 14:59 GMT+08:00 linxi zeng <li...@gmail.com>:
>
>> hi, moon:
>> Recently, we often encounter a same problem when open some web url (ex.
>> localhost:8080) to access zeppelin server, there are no note show in the
>> web page, and refresh the web page did't work. Then we find the error info
>> in zeppelin logs:
>>
>>
>> --------------------------------------------------------------------------------------------------------------------------------
>> INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>> INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>> INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>> INFO [2015-09-22 10:05:43,590] ({qtp489396160-1329}
>> NotebookServer.java[onOpen]:89) - New connection from xxx : 49725
>> INFO [2015-09-22 10:05:43,619] ({qtp489396160-1329}
>> NotebookServer.java[onMessage]:101) - RECEIVE << LIST_NOTES
>> ERROR [2015-09-22 10:05:43,620] ({qtp489396160-1329}
>> NotebookServer.java[broadcastAll]:270) - socket error
>> java.io.IOException: closedOut 1001:null
>> at
>> org.eclipse.jetty.websocket.WebSocketConnectionRFC6455$WSFrameConnection.sendMessage(WebSocketConnectionRFC6455.java:437)
>> at org.apache.zeppelin.socket.NotebookSocket.send(NotebookSocket.java:69)
>> at
>> org.apache.zeppelin.socket.NotebookServer.broadcastAll(NotebookServer.java:268)
>> at
>> org.apache.zeppelin.socket.NotebookServer.broadcastNoteList(NotebookServer.java:302)
>> at
>> org.apache.zeppelin.socket.NotebookServer.onMessage(NotebookServer.java:105)
>> at
>> org.apache.zeppelin.socket.NotebookSocket.onMessage(NotebookSocket.java:56)
>> at
>> org.eclipse.jetty.websocket.WebSocketConnectionRFC6455$WSFrameHandler.onFrame(WebSocketConnectionRFC6455.java:835)
>> at
>> org.eclipse.jetty.websocket.WebSocketParserRFC6455.parseNext(WebSocketParserRFC6455.java:349)
>> at
>> org.eclipse.jetty.websocket.WebSocketConnectionRFC6455.handle(WebSocketConnectionRFC6455.java:225)
>> at
>> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)
>> at
>> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
>> at
>> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
>> at
>> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
>> at java.lang.Thread.run(Thread.java:745)
>> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>>
>> -----------------------------------------------------------------------------------------------------------
>>
>> in the NotebookServer.java we find that when we access the zeppelin web,
>> it will call broadcastNoteList(), and then broadcastNoteList will call
>> broadcastAll():
>> {noformat}
>>   private void broadcastAll(Message m) {
>>     synchronized (connectedSockets) {
>>       for (NotebookSocket conn : connectedSockets) {
>>         try {
>>           conn.send(serializeMessage(m));
>>         } catch (IOException e) {
>>           LOG.error("socket error", e);
>>         }
>>       }
>>     }
>>   }
>>
>>
>> ------------------------------------------------------------------------------------------------------------------------
>> the broadcaseAll function will call conn.send(serializeMessage(m))  one
>> by one to send message, and if one conn has some problem say: closed or
>> send message timeout, it will block the other socket to get the message, so
>> some zeppelin web url can't show any note in home page.
>> I think it's better to:
>> (1)judge if the conn is open before call conn.send(serializeMessage(m));
>> (2)call conn.send(serializeMessage(m)) concurrently
>>
>
>

Re: zeppelin NotebookServer broadcastAll may get web socket error when LIST_NOTES

Posted by linxi zeng <li...@gmail.com>.
this problem is reported in:
https://issues.apache.org/jira/browse/ZEPPELIN-312

2015-09-22 15:05 GMT+08:00 linxi zeng <li...@gmail.com>:

> and the problem can reproduce by:
>
> *diff --git
> a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java
> b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java*
>
> *index aceea45..35c3696 100644*
>
> *---
> a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java*
>
> *+++
> b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java*
>
> *@@ -66,6 +66,11 @@* public class NotebookSocket implements
> WebSocket.OnTextMessage{
>
>    }
>
>
>
>    public void send(String serializeMessage) throws IOException {
>
> *+    try {*
>
> *+      Thread.sleep(30000);*
>
> *+    } catch (InterruptedException e) {*
>
> *+      e.printStackTrace();*
>
> *+    }*
>
>      connection.sendMessage(serializeMessage);
>
>    }
>
> 2015-09-22 14:59 GMT+08:00 linxi zeng <li...@gmail.com>:
>
>> hi, moon:
>> Recently, we often encounter a same problem when open some web url (ex.
>> localhost:8080) to access zeppelin server, there are no note show in the
>> web page, and refresh the web page did't work. Then we find the error info
>> in zeppelin logs:
>>
>>
>> --------------------------------------------------------------------------------------------------------------------------------
>> INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>> INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>> INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>> INFO [2015-09-22 10:05:43,590] ({qtp489396160-1329}
>> NotebookServer.java[onOpen]:89) - New connection from xxx : 49725
>> INFO [2015-09-22 10:05:43,619] ({qtp489396160-1329}
>> NotebookServer.java[onMessage]:101) - RECEIVE << LIST_NOTES
>> ERROR [2015-09-22 10:05:43,620] ({qtp489396160-1329}
>> NotebookServer.java[broadcastAll]:270) - socket error
>> java.io.IOException: closedOut 1001:null
>> at
>> org.eclipse.jetty.websocket.WebSocketConnectionRFC6455$WSFrameConnection.sendMessage(WebSocketConnectionRFC6455.java:437)
>> at org.apache.zeppelin.socket.NotebookSocket.send(NotebookSocket.java:69)
>> at
>> org.apache.zeppelin.socket.NotebookServer.broadcastAll(NotebookServer.java:268)
>> at
>> org.apache.zeppelin.socket.NotebookServer.broadcastNoteList(NotebookServer.java:302)
>> at
>> org.apache.zeppelin.socket.NotebookServer.onMessage(NotebookServer.java:105)
>> at
>> org.apache.zeppelin.socket.NotebookSocket.onMessage(NotebookSocket.java:56)
>> at
>> org.eclipse.jetty.websocket.WebSocketConnectionRFC6455$WSFrameHandler.onFrame(WebSocketConnectionRFC6455.java:835)
>> at
>> org.eclipse.jetty.websocket.WebSocketParserRFC6455.parseNext(WebSocketParserRFC6455.java:349)
>> at
>> org.eclipse.jetty.websocket.WebSocketConnectionRFC6455.handle(WebSocketConnectionRFC6455.java:225)
>> at
>> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)
>> at
>> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
>> at
>> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
>> at
>> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
>> at java.lang.Thread.run(Thread.java:745)
>> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
>> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>>
>> -----------------------------------------------------------------------------------------------------------
>>
>> in the NotebookServer.java we find that when we access the zeppelin web,
>> it will call broadcastNoteList(), and then broadcastNoteList will call
>> broadcastAll():
>> {noformat}
>>   private void broadcastAll(Message m) {
>>     synchronized (connectedSockets) {
>>       for (NotebookSocket conn : connectedSockets) {
>>         try {
>>           conn.send(serializeMessage(m));
>>         } catch (IOException e) {
>>           LOG.error("socket error", e);
>>         }
>>       }
>>     }
>>   }
>>
>>
>> ------------------------------------------------------------------------------------------------------------------------
>> the broadcaseAll function will call conn.send(serializeMessage(m))  one
>> by one to send message, and if one conn has some problem say: closed or
>> send message timeout, it will block the other socket to get the message, so
>> some zeppelin web url can't show any note in home page.
>> I think it's better to:
>> (1)judge if the conn is open before call conn.send(serializeMessage(m));
>> (2)call conn.send(serializeMessage(m)) concurrently
>>
>
>

Re: zeppelin NotebookServer broadcastAll may get web socket error when LIST_NOTES

Posted by linxi zeng <li...@gmail.com>.
and the problem can reproduce by:

*diff --git
a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java
b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java*

*index aceea45..35c3696 100644*

*---
a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java*

*+++
b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java*

*@@ -66,6 +66,11 @@* public class NotebookSocket implements
WebSocket.OnTextMessage{

   }



   public void send(String serializeMessage) throws IOException {

*+    try {*

*+      Thread.sleep(30000);*

*+    } catch (InterruptedException e) {*

*+      e.printStackTrace();*

*+    }*

     connection.sendMessage(serializeMessage);

   }

2015-09-22 14:59 GMT+08:00 linxi zeng <li...@gmail.com>:

> hi, moon:
> Recently, we often encounter a same problem when open some web url (ex.
> localhost:8080) to access zeppelin server, there are no note show in the
> web page, and refresh the web page did't work. Then we find the error info
> in zeppelin logs:
>
>
> --------------------------------------------------------------------------------------------------------------------------------
> INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
> NotebookServer.java[onMessage]:101) - RECEIVE << PING
> INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
> NotebookServer.java[onMessage]:101) - RECEIVE << PING
> INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
> NotebookServer.java[onMessage]:101) - RECEIVE << PING
> INFO [2015-09-22 10:05:43,590] ({qtp489396160-1329}
> NotebookServer.java[onOpen]:89) - New connection from xxx : 49725
> INFO [2015-09-22 10:05:43,619] ({qtp489396160-1329}
> NotebookServer.java[onMessage]:101) - RECEIVE << LIST_NOTES
> ERROR [2015-09-22 10:05:43,620] ({qtp489396160-1329}
> NotebookServer.java[broadcastAll]:270) - socket error
> java.io.IOException: closedOut 1001:null
> at
> org.eclipse.jetty.websocket.WebSocketConnectionRFC6455$WSFrameConnection.sendMessage(WebSocketConnectionRFC6455.java:437)
> at org.apache.zeppelin.socket.NotebookSocket.send(NotebookSocket.java:69)
> at
> org.apache.zeppelin.socket.NotebookServer.broadcastAll(NotebookServer.java:268)
> at
> org.apache.zeppelin.socket.NotebookServer.broadcastNoteList(NotebookServer.java:302)
> at
> org.apache.zeppelin.socket.NotebookServer.onMessage(NotebookServer.java:105)
> at
> org.apache.zeppelin.socket.NotebookSocket.onMessage(NotebookSocket.java:56)
> at
> org.eclipse.jetty.websocket.WebSocketConnectionRFC6455$WSFrameHandler.onFrame(WebSocketConnectionRFC6455.java:835)
> at
> org.eclipse.jetty.websocket.WebSocketParserRFC6455.parseNext(WebSocketParserRFC6455.java:349)
> at
> org.eclipse.jetty.websocket.WebSocketConnectionRFC6455.handle(WebSocketConnectionRFC6455.java:225)
> at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)
> at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
> at
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
> at
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
> at java.lang.Thread.run(Thread.java:745)
> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
> NotebookServer.java[onMessage]:101) - RECEIVE << PING
> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
> NotebookServer.java[onMessage]:101) - RECEIVE << PING
> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
> NotebookServer.java[onMessage]:101) - RECEIVE << PING
> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>
> -----------------------------------------------------------------------------------------------------------
>
> in the NotebookServer.java we find that when we access the zeppelin web,
> it will call broadcastNoteList(), and then broadcastNoteList will call
> broadcastAll():
> {noformat}
>   private void broadcastAll(Message m) {
>     synchronized (connectedSockets) {
>       for (NotebookSocket conn : connectedSockets) {
>         try {
>           conn.send(serializeMessage(m));
>         } catch (IOException e) {
>           LOG.error("socket error", e);
>         }
>       }
>     }
>   }
>
>
> ------------------------------------------------------------------------------------------------------------------------
> the broadcaseAll function will call conn.send(serializeMessage(m))  one by
> one to send message, and if one conn has some problem say: closed or send
> message timeout, it will block the other socket to get the message, so some
> zeppelin web url can't show any note in home page.
> I think it's better to:
> (1)judge if the conn is open before call conn.send(serializeMessage(m));
> (2)call conn.send(serializeMessage(m)) concurrently
>

Re: zeppelin NotebookServer broadcastAll may get web socket error when LIST_NOTES

Posted by linxi zeng <li...@gmail.com>.
and the problem can reproduce by:

*diff --git
a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java
b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java*

*index aceea45..35c3696 100644*

*---
a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java*

*+++
b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookSocket.java*

*@@ -66,6 +66,11 @@* public class NotebookSocket implements
WebSocket.OnTextMessage{

   }



   public void send(String serializeMessage) throws IOException {

*+    try {*

*+      Thread.sleep(30000);*

*+    } catch (InterruptedException e) {*

*+      e.printStackTrace();*

*+    }*

     connection.sendMessage(serializeMessage);

   }

2015-09-22 14:59 GMT+08:00 linxi zeng <li...@gmail.com>:

> hi, moon:
> Recently, we often encounter a same problem when open some web url (ex.
> localhost:8080) to access zeppelin server, there are no note show in the
> web page, and refresh the web page did't work. Then we find the error info
> in zeppelin logs:
>
>
> --------------------------------------------------------------------------------------------------------------------------------
> INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
> NotebookServer.java[onMessage]:101) - RECEIVE << PING
> INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
> NotebookServer.java[onMessage]:101) - RECEIVE << PING
> INFO [2015-09-22 10:05:43,360] ({qtp489396160-1328}
> NotebookServer.java[onMessage]:101) - RECEIVE << PING
> INFO [2015-09-22 10:05:43,590] ({qtp489396160-1329}
> NotebookServer.java[onOpen]:89) - New connection from xxx : 49725
> INFO [2015-09-22 10:05:43,619] ({qtp489396160-1329}
> NotebookServer.java[onMessage]:101) - RECEIVE << LIST_NOTES
> ERROR [2015-09-22 10:05:43,620] ({qtp489396160-1329}
> NotebookServer.java[broadcastAll]:270) - socket error
> java.io.IOException: closedOut 1001:null
> at
> org.eclipse.jetty.websocket.WebSocketConnectionRFC6455$WSFrameConnection.sendMessage(WebSocketConnectionRFC6455.java:437)
> at org.apache.zeppelin.socket.NotebookSocket.send(NotebookSocket.java:69)
> at
> org.apache.zeppelin.socket.NotebookServer.broadcastAll(NotebookServer.java:268)
> at
> org.apache.zeppelin.socket.NotebookServer.broadcastNoteList(NotebookServer.java:302)
> at
> org.apache.zeppelin.socket.NotebookServer.onMessage(NotebookServer.java:105)
> at
> org.apache.zeppelin.socket.NotebookSocket.onMessage(NotebookSocket.java:56)
> at
> org.eclipse.jetty.websocket.WebSocketConnectionRFC6455$WSFrameHandler.onFrame(WebSocketConnectionRFC6455.java:835)
> at
> org.eclipse.jetty.websocket.WebSocketParserRFC6455.parseNext(WebSocketParserRFC6455.java:349)
> at
> org.eclipse.jetty.websocket.WebSocketConnectionRFC6455.handle(WebSocketConnectionRFC6455.java:225)
> at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)
> at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
> at
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
> at
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
> at java.lang.Thread.run(Thread.java:745)
> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
> NotebookServer.java[onMessage]:101) - RECEIVE << PING
> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
> NotebookServer.java[onMessage]:101) - RECEIVE << PING
> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
> NotebookServer.java[onMessage]:101) - RECEIVE << PING
> INFO [2015-09-22 10:05:43,698] ({qtp489396160-1328}
> NotebookServer.java[onMessage]:101) - RECEIVE << PING
>
> -----------------------------------------------------------------------------------------------------------
>
> in the NotebookServer.java we find that when we access the zeppelin web,
> it will call broadcastNoteList(), and then broadcastNoteList will call
> broadcastAll():
> {noformat}
>   private void broadcastAll(Message m) {
>     synchronized (connectedSockets) {
>       for (NotebookSocket conn : connectedSockets) {
>         try {
>           conn.send(serializeMessage(m));
>         } catch (IOException e) {
>           LOG.error("socket error", e);
>         }
>       }
>     }
>   }
>
>
> ------------------------------------------------------------------------------------------------------------------------
> the broadcaseAll function will call conn.send(serializeMessage(m))  one by
> one to send message, and if one conn has some problem say: closed or send
> message timeout, it will block the other socket to get the message, so some
> zeppelin web url can't show any note in home page.
> I think it's better to:
> (1)judge if the conn is open before call conn.send(serializeMessage(m));
> (2)call conn.send(serializeMessage(m)) concurrently
>