websocket periodically closes

We are running a bokeh server using this command:

nohup {EDGE_HOME}/thirdParty/Anaconda3/bin/bokeh serve pangia-vis --port 5100 --keep-alive 10000 --host '*' &> {EDGE_HOME}/edge_ui/bokeh.log &

It works fine for a while, approximately a day or so, before it unexpectedly stops responding. Here is the output from our log file:

2018-01-03 22:04:47,696 200 GET /pangia-vis?r=pangia-vis/data/6385dcf0180011304a1cc3b47512c6a6.tsv (127.0.0.1) 17.70ms

2018-01-03 22:04:49,867 WebSocket connection opened

2018-01-03 22:04:49,868 ServerConnection created

2018-01-03 22:05:13,278 WebSocket connection closed: code=1001, reason=None

2018-01-03 22:05:24,960 Error running application handler <bokeh.application.handlers.directory.DirectoryHandler object at 0x2aaac3e56fd0>: ‘NoneType’ object is not iterable

File “main.py”, line 38, in :

get_params = sorted(get_params) Traceback (most recent call last):

File “/panfs/biopan01/edge_prod/thirdParty/Anaconda3/lib/python3.5/site-packages/bokeh/application/handlers/code_runner.py”, line 81, in run

exec(self._code, module.dict)

File “/panfs/biopan01/edge_prod/thirdParty/pangia/pangia-vis/main.py”, line 38, in

get_params = sorted(get_params)

TypeError: ‘NoneType’ object is not iterable

It seems that the WebSocket closes and so the session data is lost. I can’t find any reason for why this happens; viewing the same plot that worked before will encounter the closed WebSocket later on. Once we restart the bokeh server everything is fine. Is it a version issue with on of the python libraries?

Is there some way to query the WebSocket status? If so, I could run it inside a supervisor daemon and have it restart the server if the websocket is closed.

$ ./pip list | grep -i ‘jinja|numpy|six|requests|tornado|pyyaml|dateutil|bokeh’

bokeh (0.12.4)

Jinja2 (2.8)

numpy (1.11.1)

numpydoc (0.6.0)

python-dateutil (2.5.3)

PyYAML (3.11)

requests (2.10.0)

six (1.10.0)

sockjs-tornado (1.0.3)

tornado (4.3)

CentOS Linux release 7.2.1511 (Core)

relevant snippet from main.py

import pandas as pd

import numpy as np

import sys

from os.path import dirname, join, isfile

from bokeh.plotting import curdoc, figure

from bokeh.layouts import row, layout, widgetbox, column

from bokeh.models import ColumnDataSource, HoverTool, Div, FactorRange, Range1d, TapTool, CustomJS

from bokeh.models.widgets import Button, Slider, Select, TextInput, RadioButtonGroup, DataTable, TableColumn, NumberFormatter

from bokeh.models.callbacks import CustomJS

from bokeh.palettes import RdYlBu11

default cutoffs for dot-plot display

def_val_patho = 0 #display mode: 0 -> pathogen only, 1 -> all

def_val_min_len = 50 #Minimum linear length [0-500] step=1

def_val_min_cov = 0.1 #Minimum linear coverage [0-1] step=0.01

def_val_max_r_raw = 100 #Minimum reads [0-500] step=1

def_val_max_r_rsnb = 100 #Minimum reads [0-100] step=1

def_val_min_score = 0.5 #Minimum score [0-1] step=0.1

get pangia result tsv

args = curdoc().session_context.request.arguments

r_file = “”

if len(sys.argv) > 1:

r_file = sys.argv[1]

sys.stderr.write("[INFO] "+r_file)

if isfile(r_file):

sys.stderr.write("[INFO] Input file by sys argv: " + r_file)

else:

sys.stderr.write("[ERROR] Input file by sys argv: not found.")

raise

if not r_file:

try:

get_params = args.get(‘r’)

get_params = sorted(get_params)

``

Hi,

By default, sessions time out after a period of inactivity. Perhaps this is what you are seeing? The intervals to check are configurable:

  https://bokeh.pydata.org/en/latest/docs/reference/command/subcommands/serve.html#session-expiration-options

Thanks,

Bryan

···

On Jan 4, 2018, at 11:43, [email protected] wrote:

We are running a bokeh server using this command:
nohup \{EDGE\_HOME\}/thirdParty/Anaconda3/bin/bokeh serve pangia\-vis \-\-port 5100 \-\-keep\-alive 10000 \-\-host &#39;\*&#39; &amp;&gt; {EDGE_HOME}/edge_ui/bokeh.log &

It works fine for a while, approximately a day or so, before it unexpectedly stops responding. Here is the output from our log file:
2018-01-03 22:04:47,696 200 GET /pangia-vis?r=pangia-vis/data/6385dcf0180011304a1cc3b47512c6a6.tsv (127.0.0.1) 17.70ms
2018-01-03 22:04:49,867 WebSocket connection opened
2018-01-03 22:04:49,868 ServerConnection created
2018-01-03 22:05:13,278 WebSocket connection closed: code=1001, reason=None
2018-01-03 22:05:24,960 Error running application handler <bokeh.application.handlers.directory.DirectoryHandler object at 0x2aaac3e56fd0>: 'NoneType' object is not iterable
File "main.py", line 38, in <module>:
get_params = sorted(get_params) Traceback (most recent call last):
  File "/panfs/biopan01/edge_prod/thirdParty/Anaconda3/lib/python3.5/site-packages/bokeh/application/handlers/code_runner.py", line 81, in run
    exec(self._code, module.__dict__)
  File "/panfs/biopan01/edge_prod/thirdParty/pangia/pangia-vis/main.py", line 38, in <module>
    get_params = sorted(get_params)
TypeError: 'NoneType' object is not iterable

It seems that the WebSocket closes and so the session data is lost. I can't find any reason for why this happens; viewing the same plot that worked before will encounter the closed WebSocket later on. Once we restart the bokeh server everything is fine. Is it a version issue with on of the python libraries?

Is there some way to query the WebSocket status? If so, I could run it inside a supervisor daemon and have it restart the server if the websocket is closed.

$ ./pip list | grep -i 'jinja\|numpy\|six\|requests\|tornado\|pyyaml\|dateutil\|bokeh'
bokeh (0.12.4)
Jinja2 (2.8)
numpy (1.11.1)
numpydoc (0.6.0)
python-dateutil (2.5.3)
PyYAML (3.11)
requests (2.10.0)
six (1.10.0)
sockjs-tornado (1.0.3)
tornado (4.3)

CentOS Linux release 7.2.1511 (Core)

relevant snippet from main.py
import pandas as pd
import numpy as np
import sys

from os.path import dirname, join, isfile
from bokeh.plotting import curdoc, figure
from bokeh.layouts import row, layout, widgetbox, column
from bokeh.models import ColumnDataSource, HoverTool, Div, FactorRange, Range1d, TapTool, CustomJS
from bokeh.models.widgets import Button, Slider, Select, TextInput, RadioButtonGroup, DataTable, TableColumn, NumberFormatter
from bokeh.models.callbacks import CustomJS
from bokeh.palettes import RdYlBu11

# default cutoffs for dot-plot display
def_val_patho = 0 #display mode: 0 -> pathogen only, 1 -> all
def_val_min_len = 50 #Minimum linear length [0-500] step=1
def_val_min_cov = 0.1 #Minimum linear coverage [0-1] step=0.01
def_val_max_r_raw = 100 #Minimum reads [0-500] step=1
def_val_max_r_rsnb = 100 #Minimum reads [0-100] step=1
def_val_min_score = 0.5 #Minimum score [0-1] step=0.1

# get pangia result tsv
args = curdoc().session_context.request.arguments
r_file = ""

if len(sys.argv) > 1:
    r_file = sys.argv[1]
    sys.stderr.write("[INFO] "+r_file)
    if isfile(r_file):
        sys.stderr.write("[INFO] Input file by sys argv: " + r_file)
    else:
        sys.stderr.write("[ERROR] Input file by sys argv: not found.")
        raise

if not r_file:
    try:
        get_params = args.get('r')
        get_params = sorted(get_params)

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/581b9c44-5744-42fb-9045-2ec4783101cc%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

I don’t think the session has expired, the error occurs immediately after clicking the link that makes the call to the bokeh server. Plus, it only happens some of the time.

···

On Thursday, January 4, 2018 at 10:46:54 AM UTC-7, Bryan Van de ven wrote:

Hi,

By default, sessions time out after a period of inactivity. Perhaps this is what you are seeing? The intervals to check are configurable:

    [https://bokeh.pydata.org/en/latest/docs/reference/command/subcommands/serve.html#session-expiration-options](https://bokeh.pydata.org/en/latest/docs/reference/command/subcommands/serve.html#session-expiration-options)

Thanks,

Bryan

On Jan 4, 2018, at 11:43, [email protected] wrote:

We are running a bokeh server using this command:

nohup {EDGE_HOME}/thirdParty/Anaconda3/bin/bokeh serve pangia-vis --port 5100 --keep-alive 10000 --host '*' &> {EDGE_HOME}/edge_ui/bokeh.log &

It works fine for a while, approximately a day or so, before it unexpectedly stops responding. Here is the output from our log file:

2018-01-03 22:04:47,696 200 GET /pangia-vis?r=pangia-vis/data/6385dcf0180011304a1cc3b47512c6a6.tsv (127.0.0.1) 17.70ms

2018-01-03 22:04:49,867 WebSocket connection opened

2018-01-03 22:04:49,868 ServerConnection created

2018-01-03 22:05:13,278 WebSocket connection closed: code=1001, reason=None

2018-01-03 22:05:24,960 Error running application handler <bokeh.application.handlers.directory.DirectoryHandler object at 0x2aaac3e56fd0>: ‘NoneType’ object is not iterable

File “main.py”, line 38, in :

get_params = sorted(get_params) Traceback (most recent call last):

File “/panfs/biopan01/edge_prod/thirdParty/Anaconda3/lib/python3.5/site-packages/bokeh/application/handlers/code_runner.py”, line 81, in run

exec(self._code, module.__dict__)

File “/panfs/biopan01/edge_prod/thirdParty/pangia/pangia-vis/main.py”, line 38, in

get_params = sorted(get_params)

TypeError: ‘NoneType’ object is not iterable

It seems that the WebSocket closes and so the session data is lost. I can’t find any reason for why this happens; viewing the same plot that worked before will encounter the closed WebSocket later on. Once we restart the bokeh server everything is fine. Is it a version issue with on of the python libraries?

Is there some way to query the WebSocket status? If so, I could run it inside a supervisor daemon and have it restart the server if the websocket is closed.

$ ./pip list | grep -i ‘jinja|numpy|six|requests|tornado|pyyaml|dateutil|bokeh’

bokeh (0.12.4)

Jinja2 (2.8)

numpy (1.11.1)

numpydoc (0.6.0)

python-dateutil (2.5.3)

PyYAML (3.11)

requests (2.10.0)

six (1.10.0)

sockjs-tornado (1.0.3)

tornado (4.3)

CentOS Linux release 7.2.1511 (Core)

relevant snippet from main.py

import pandas as pd

import numpy as np

import sys

from os.path import dirname, join, isfile

from bokeh.plotting import curdoc, figure

from bokeh.layouts import row, layout, widgetbox, column

from bokeh.models import ColumnDataSource, HoverTool, Div, FactorRange, Range1d, TapTool, CustomJS

from bokeh.models.widgets import Button, Slider, Select, TextInput, RadioButtonGroup, DataTable, TableColumn, NumberFormatter

from bokeh.models.callbacks import CustomJS

from bokeh.palettes import RdYlBu11

default cutoffs for dot-plot display

def_val_patho = 0 #display mode: 0 -> pathogen only, 1 -> all

def_val_min_len = 50 #Minimum linear length [0-500] step=1

def_val_min_cov = 0.1 #Minimum linear coverage [0-1] step=0.01

def_val_max_r_raw = 100 #Minimum reads [0-500] step=1

def_val_max_r_rsnb = 100 #Minimum reads [0-100] step=1

def_val_min_score = 0.5 #Minimum score [0-1] step=0.1

get pangia result tsv

args = curdoc().session_context.request.arguments

r_file = “”

if len(sys.argv) > 1:

r_file = sys.argv[1]
sys.stderr.write("[INFO] "+r_file)
if isfile(r_file):
    sys.stderr.write("[INFO] Input file by sys argv: " + r_file)
else:
    sys.stderr.write("[ERROR] Input file by sys argv: not found.")
    raise

if not r_file:

try:
    get_params = args.get('r')
    get_params = sorted(get_params)


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/581b9c44-5744-42fb-9045-2ec4783101cc%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi,

Unfortunately I can't really speculate without more information. The only thing that comes to mind is if you happen to be using older versions of Safari, there was an upstream bug in WebKit that caused web socket connections to fail:

  https://bugs.webkit.org/show_bug.cgi?id=170463

In that case there is no remediation except to upgrade Safari. Otherwise, I would say the best next step would be to make a GitHub issue that includes:

* a complete minimal code example to try and reproduce the issue
* detailed information about browsers, OS, package versions, etc.

Thanks,

Bryan

···

On Jan 4, 2018, at 12:22, [email protected] wrote:

I don't think the session has expired, the error occurs immediately after clicking the link that makes the call to the bokeh server. Plus, it only happens some of the time.

On Thursday, January 4, 2018 at 10:46:54 AM UTC-7, Bryan Van de ven wrote:
Hi,

By default, sessions time out after a period of inactivity. Perhaps this is what you are seeing? The intervals to check are configurable:

        https://bokeh.pydata.org/en/latest/docs/reference/command/subcommands/serve.html#session-expiration-options

Thanks,

Bryan

> On Jan 4, 2018, at 11:43, [email protected] wrote:
>
> We are running a bokeh server using this command:
> nohup \{EDGE\_HOME\}/thirdParty/Anaconda3/bin/bokeh serve pangia\-vis \-\-port 5100 \-\-keep\-alive 10000 \-\-host &#39;\*&#39; &amp;&gt; {EDGE_HOME}/edge_ui/bokeh.log &
>
> It works fine for a while, approximately a day or so, before it unexpectedly stops responding. Here is the output from our log file:
> 2018-01-03 22:04:47,696 200 GET /pangia-vis?r=pangia-vis/data/6385dcf0180011304a1cc3b47512c6a6.tsv (127.0.0.1) 17.70ms
> 2018-01-03 22:04:49,867 WebSocket connection opened
> 2018-01-03 22:04:49,868 ServerConnection created
> 2018-01-03 22:05:13,278 WebSocket connection closed: code=1001, reason=None
> 2018-01-03 22:05:24,960 Error running application handler <bokeh.application.handlers.directory.DirectoryHandler object at 0x2aaac3e56fd0>: 'NoneType' object is not iterable
> File "main.py", line 38, in <module>:
> get_params = sorted(get_params) Traceback (most recent call last):
> File "/panfs/biopan01/edge_prod/thirdParty/Anaconda3/lib/python3.5/site-packages/bokeh/application/handlers/code_runner.py", line 81, in run
> exec(self._code, module.__dict__)
> File "/panfs/biopan01/edge_prod/thirdParty/pangia/pangia-vis/main.py", line 38, in <module>
> get_params = sorted(get_params)
> TypeError: 'NoneType' object is not iterable
>
> It seems that the WebSocket closes and so the session data is lost. I can't find any reason for why this happens; viewing the same plot that worked before will encounter the closed WebSocket later on. Once we restart the bokeh server everything is fine. Is it a version issue with on of the python libraries?
>
> Is there some way to query the WebSocket status? If so, I could run it inside a supervisor daemon and have it restart the server if the websocket is closed.
>
> $ ./pip list | grep -i 'jinja\|numpy\|six\|requests\|tornado\|pyyaml\|dateutil\|bokeh'
> bokeh (0.12.4)
> Jinja2 (2.8)
> numpy (1.11.1)
> numpydoc (0.6.0)
> python-dateutil (2.5.3)
> PyYAML (3.11)
> requests (2.10.0)
> six (1.10.0)
> sockjs-tornado (1.0.3)
> tornado (4.3)
>
> CentOS Linux release 7.2.1511 (Core)
>
> relevant snippet from main.py
> import pandas as pd
> import numpy as np
> import sys
>
> from os.path import dirname, join, isfile
> from bokeh.plotting import curdoc, figure
> from bokeh.layouts import row, layout, widgetbox, column
> from bokeh.models import ColumnDataSource, HoverTool, Div, FactorRange, Range1d, TapTool, CustomJS
> from bokeh.models.widgets import Button, Slider, Select, TextInput, RadioButtonGroup, DataTable, TableColumn, NumberFormatter
> from bokeh.models.callbacks import CustomJS
> from bokeh.palettes import RdYlBu11
>
> # default cutoffs for dot-plot display
> def_val_patho = 0 #display mode: 0 -> pathogen only, 1 -> all
> def_val_min_len = 50 #Minimum linear length [0-500] step=1
> def_val_min_cov = 0.1 #Minimum linear coverage [0-1] step=0.01
> def_val_max_r_raw = 100 #Minimum reads [0-500] step=1
> def_val_max_r_rsnb = 100 #Minimum reads [0-100] step=1
> def_val_min_score = 0.5 #Minimum score [0-1] step=0.1
>
> # get pangia result tsv
> args = curdoc().session_context.request.arguments
> r_file = ""
>
> if len(sys.argv) > 1:
> r_file = sys.argv[1]
> sys.stderr.write("[INFO] "+r_file)
> if isfile(r_file):
> sys.stderr.write("[INFO] Input file by sys argv: " + r_file)
> else:
> sys.stderr.write("[ERROR] Input file by sys argv: not found.")
> raise
>
> if not r_file:
> try:
> get_params = args.get('r')
> get_params = sorted(get_params)
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/581b9c44-5744-42fb-9045-2ec4783101cc%40continuum.io.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5c105b1d-1e6b-450b-b7de-04361642d04b%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hmmm, I don’t know if someone is using Safari. I guess that is one possibility.

Is there some way to query the WebSocket API? If so, I can use supervisor to restart the server when the WebSocket is closed.

For example, I see in my log the following message:

2018-01-03 12:06:46,631 101 GET /pangia-vis/ws?bokeh-protocol-version=1.0&bokeh-session-id=O5sby6rVDhenFwCpBFl3aR2Iy5NRcXfeZeBg38alpynC&r=pangia-vis/data/test.tsv (128.165.108.18) 0.90ms

Which opens the WebSocket. Is there an endpoint I can query to get the WebSocket status to see if it’s open or closed?

···

On Thursday, January 4, 2018 at 11:30:58 AM UTC-7, Bryan Van de ven wrote:

Hi,

Unfortunately I can’t really speculate without more information. The only thing that comes to mind is if you happen to be using older versions of Safari, there was an upstream bug in WebKit that caused web socket connections to fail:

    [https://bugs.webkit.org/show_bug.cgi?id=170463](https://bugs.webkit.org/show_bug.cgi?id=170463)

In that case there is no remediation except to upgrade Safari. Otherwise, I would say the best next step would be to make a GitHub issue that includes:

  • a complete minimal code example to try and reproduce the issue

  • detailed information about browsers, OS, package versions, etc.

Thanks,

Bryan

On Jan 4, 2018, at 12:22, [email protected] wrote:

I don’t think the session has expired, the error occurs immediately after clicking the link that makes the call to the bokeh server. Plus, it only happens some of the time.

On Thursday, January 4, 2018 at 10:46:54 AM UTC-7, Bryan Van de ven wrote:

Hi,

By default, sessions time out after a period of inactivity. Perhaps this is what you are seeing? The intervals to check are configurable:

    [https://bokeh.pydata.org/en/latest/docs/reference/command/subcommands/serve.html#session-expiration-options](https://bokeh.pydata.org/en/latest/docs/reference/command/subcommands/serve.html#session-expiration-options)

Thanks,

Bryan

On Jan 4, 2018, at 11:43, [email protected] wrote:

We are running a bokeh server using this command:
nohup {EDGE_HOME}/thirdParty/Anaconda3/bin/bokeh serve pangia-vis --port 5100 --keep-alive 10000 --host '*' &> {EDGE_HOME}/edge_ui/bokeh.log &

It works fine for a while, approximately a day or so, before it unexpectedly stops responding. Here is the output from our log file:
2018-01-03 22:04:47,696 200 GET /pangia-vis?r=pangia-vis/data/6385dcf0180011304a1cc3b47512c6a6.tsv (127.0.0.1) 17.70ms
2018-01-03 22:04:49,867 WebSocket connection opened
2018-01-03 22:04:49,868 ServerConnection created
2018-01-03 22:05:13,278 WebSocket connection closed: code=1001, reason=None
2018-01-03 22:05:24,960 Error running application handler <bokeh.application.handlers.directory.DirectoryHandler object at 0x2aaac3e56fd0>: ‘NoneType’ object is not iterable
File “main.py”, line 38, in :
get_params = sorted(get_params) Traceback (most recent call last):
File “/panfs/biopan01/edge_prod/thirdParty/Anaconda3/lib/python3.5/site-packages/bokeh/application/handlers/code_runner.py”, line 81, in run
exec(self._code, module.dict)
File “/panfs/biopan01/edge_prod/thirdParty/pangia/pangia-vis/main.py”, line 38, in
get_params = sorted(get_params)
TypeError: ‘NoneType’ object is not iterable

It seems that the WebSocket closes and so the session data is lost. I can’t find any reason for why this happens; viewing the same plot that worked before will encounter the closed WebSocket later on. Once we restart the bokeh server everything is fine. Is it a version issue with on of the python libraries?

Is there some way to query the WebSocket status? If so, I could run it inside a supervisor daemon and have it restart the server if the websocket is closed.

$ ./pip list | grep -i ‘jinja|numpy|six|requests|tornado|pyyaml|dateutil|bokeh’
bokeh (0.12.4)
Jinja2 (2.8)
numpy (1.11.1)
numpydoc (0.6.0)
python-dateutil (2.5.3)
PyYAML (3.11)
requests (2.10.0)
six (1.10.0)
sockjs-tornado (1.0.3)
tornado (4.3)

CentOS Linux release 7.2.1511 (Core)

relevant snippet from main.py
import pandas as pd
import numpy as np
import sys

from os.path import dirname, join, isfile
from bokeh.plotting import curdoc, figure
from bokeh.layouts import row, layout, widgetbox, column
from bokeh.models import ColumnDataSource, HoverTool, Div, FactorRange, Range1d, TapTool, CustomJS
from bokeh.models.widgets import Button, Slider, Select, TextInput, RadioButtonGroup, DataTable, TableColumn, NumberFormatter
from bokeh.models.callbacks import CustomJS
from bokeh.palettes import RdYlBu11

default cutoffs for dot-plot display

def_val_patho = 0 #display mode: 0 -> pathogen only, 1 -> all
def_val_min_len = 50 #Minimum linear length [0-500] step=1
def_val_min_cov = 0.1 #Minimum linear coverage [0-1] step=0.01
def_val_max_r_raw = 100 #Minimum reads [0-500] step=1
def_val_max_r_rsnb = 100 #Minimum reads [0-100] step=1
def_val_min_score = 0.5 #Minimum score [0-1] step=0.1

get pangia result tsv

args = curdoc().session_context.request.arguments
r_file = “”

if len(sys.argv) > 1:
r_file = sys.argv[1]
sys.stderr.write("[INFO] “+r_file)
if isfile(r_file):
sys.stderr.write(”[INFO] Input file by sys argv: " + r_file)
else:
sys.stderr.write("[ERROR] Input file by sys argv: not found.")
raise

if not r_file:
try:
get_params = args.get(‘r’)
get_params = sorted(get_params)


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/581b9c44-5744-42fb-9045-2ec4783101cc%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5c105b1d-1e6b-450b-b7de-04361642d04b%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Bryan,

I’ll try setting --unused-session-lifetime, it’s possible that for some reason our server is taking a long time to respond after the websocket is opened. By increasing it, you increase the time the bokeh server waits to delete the session when there’s no activity? Also, there’s --check-unused-sessions. That’s how often it checks for unused sessions? So, how do those to parameters interact? When there’s a period of inactivity, does it wait check-unused-sessions milliseconds to determine if the session should be deleted?

Thanks again!

Mark

···

On Thursday, January 4, 2018 at 11:30:58 AM UTC-7, Bryan Van de ven wrote:

Hi,

Unfortunately I can’t really speculate without more information. The only thing that comes to mind is if you happen to be using older versions of Safari, there was an upstream bug in WebKit that caused web socket connections to fail:

    [https://bugs.webkit.org/show_bug.cgi?id=170463](https://bugs.webkit.org/show_bug.cgi?id=170463)

In that case there is no remediation except to upgrade Safari. Otherwise, I would say the best next step would be to make a GitHub issue that includes:

  • a complete minimal code example to try and reproduce the issue

  • detailed information about browsers, OS, package versions, etc.

Thanks,

Bryan

On Jan 4, 2018, at 12:22, [email protected] wrote:

I don’t think the session has expired, the error occurs immediately after clicking the link that makes the call to the bokeh server. Plus, it only happens some of the time.

On Thursday, January 4, 2018 at 10:46:54 AM UTC-7, Bryan Van de ven wrote:

Hi,

By default, sessions time out after a period of inactivity. Perhaps this is what you are seeing? The intervals to check are configurable:

    [https://bokeh.pydata.org/en/latest/docs/reference/command/subcommands/serve.html#session-expiration-options](https://bokeh.pydata.org/en/latest/docs/reference/command/subcommands/serve.html#session-expiration-options)

Thanks,

Bryan

On Jan 4, 2018, at 11:43, [email protected] wrote:

We are running a bokeh server using this command:
nohup {EDGE_HOME}/thirdParty/Anaconda3/bin/bokeh serve pangia-vis --port 5100 --keep-alive 10000 --host '*' &> {EDGE_HOME}/edge_ui/bokeh.log &

It works fine for a while, approximately a day or so, before it unexpectedly stops responding. Here is the output from our log file:
2018-01-03 22:04:47,696 200 GET /pangia-vis?r=pangia-vis/data/6385dcf0180011304a1cc3b47512c6a6.tsv (127.0.0.1) 17.70ms
2018-01-03 22:04:49,867 WebSocket connection opened
2018-01-03 22:04:49,868 ServerConnection created
2018-01-03 22:05:13,278 WebSocket connection closed: code=1001, reason=None
2018-01-03 22:05:24,960 Error running application handler <bokeh.application.handlers.directory.DirectoryHandler object at 0x2aaac3e56fd0>: ‘NoneType’ object is not iterable
File “main.py”, line 38, in :
get_params = sorted(get_params) Traceback (most recent call last):
File “/panfs/biopan01/edge_prod/thirdParty/Anaconda3/lib/python3.5/site-packages/bokeh/application/handlers/code_runner.py”, line 81, in run
exec(self._code, module.dict)
File “/panfs/biopan01/edge_prod/thirdParty/pangia/pangia-vis/main.py”, line 38, in
get_params = sorted(get_params)
TypeError: ‘NoneType’ object is not iterable

It seems that the WebSocket closes and so the session data is lost. I can’t find any reason for why this happens; viewing the same plot that worked before will encounter the closed WebSocket later on. Once we restart the bokeh server everything is fine. Is it a version issue with on of the python libraries?

Is there some way to query the WebSocket status? If so, I could run it inside a supervisor daemon and have it restart the server if the websocket is closed.

$ ./pip list | grep -i ‘jinja|numpy|six|requests|tornado|pyyaml|dateutil|bokeh’
bokeh (0.12.4)
Jinja2 (2.8)
numpy (1.11.1)
numpydoc (0.6.0)
python-dateutil (2.5.3)
PyYAML (3.11)
requests (2.10.0)
six (1.10.0)
sockjs-tornado (1.0.3)
tornado (4.3)

CentOS Linux release 7.2.1511 (Core)

relevant snippet from main.py
import pandas as pd
import numpy as np
import sys

from os.path import dirname, join, isfile
from bokeh.plotting import curdoc, figure
from bokeh.layouts import row, layout, widgetbox, column
from bokeh.models import ColumnDataSource, HoverTool, Div, FactorRange, Range1d, TapTool, CustomJS
from bokeh.models.widgets import Button, Slider, Select, TextInput, RadioButtonGroup, DataTable, TableColumn, NumberFormatter
from bokeh.models.callbacks import CustomJS
from bokeh.palettes import RdYlBu11

default cutoffs for dot-plot display

def_val_patho = 0 #display mode: 0 -> pathogen only, 1 -> all
def_val_min_len = 50 #Minimum linear length [0-500] step=1
def_val_min_cov = 0.1 #Minimum linear coverage [0-1] step=0.01
def_val_max_r_raw = 100 #Minimum reads [0-500] step=1
def_val_max_r_rsnb = 100 #Minimum reads [0-100] step=1
def_val_min_score = 0.5 #Minimum score [0-1] step=0.1

get pangia result tsv

args = curdoc().session_context.request.arguments
r_file = “”

if len(sys.argv) > 1:
r_file = sys.argv[1]
sys.stderr.write("[INFO] “+r_file)
if isfile(r_file):
sys.stderr.write(”[INFO] Input file by sys argv: " + r_file)
else:
sys.stderr.write("[ERROR] Input file by sys argv: not found.")
raise

if not r_file:
try:
get_params = args.get(‘r’)
get_params = sorted(get_params)


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/581b9c44-5744-42fb-9045-2ec4783101cc%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5c105b1d-1e6b-450b-b7de-04361642d04b%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi,

The Bokeh server has an internal periodic callback running to check (every "check-unused-sessions" seconds) to check for any session that have not had activity for "unused-session-lifetime" seconds at that point. As one example if you set the session lifetime to 10 seconds but set the check time to four hours, it's entirely possible for a session to last nearly four hours past its last point of activity (if it happened right before a check time).

Thanks,

Bryan

···

On Jan 5, 2018, at 10:18, [email protected] wrote:

Hi Bryan,

I'll try setting --unused-session-lifetime, it's possible that for some reason our server is taking a long time to respond after the websocket is opened. By increasing it, you increase the time the bokeh server waits to delete the session when there's no activity? Also, there's --check-unused-sessions. That's how often it checks for unused sessions? So, how do those to parameters interact? When there's a period of inactivity, does it wait check-unused-sessions milliseconds to determine if the session should be deleted?
Thanks again!
Mark

On Thursday, January 4, 2018 at 11:30:58 AM UTC-7, Bryan Van de ven wrote:
Hi,

Unfortunately I can't really speculate without more information. The only thing that comes to mind is if you happen to be using older versions of Safari, there was an upstream bug in WebKit that caused web socket connections to fail:

        https://bugs.webkit.org/show_bug.cgi?id=170463

In that case there is no remediation except to upgrade Safari. Otherwise, I would say the best next step would be to make a GitHub issue that includes:

* a complete minimal code example to try and reproduce the issue
* detailed information about browsers, OS, package versions, etc.

Thanks,

Bryan

> On Jan 4, 2018, at 12:22, [email protected] wrote:
>
> I don't think the session has expired, the error occurs immediately after clicking the link that makes the call to the bokeh server. Plus, it only happens some of the time.
>
> On Thursday, January 4, 2018 at 10:46:54 AM UTC-7, Bryan Van de ven wrote:
> Hi,
>
> By default, sessions time out after a period of inactivity. Perhaps this is what you are seeing? The intervals to check are configurable:
>
> https://bokeh.pydata.org/en/latest/docs/reference/command/subcommands/serve.html#session-expiration-options
>
> Thanks,
>
> Bryan
>
> > On Jan 4, 2018, at 11:43, [email protected] wrote:
> >
> > We are running a bokeh server using this command:
> > nohup \{EDGE\_HOME\}/thirdParty/Anaconda3/bin/bokeh serve pangia\-vis \-\-port 5100 \-\-keep\-alive 10000 \-\-host &#39;\*&#39; &amp;&gt; {EDGE_HOME}/edge_ui/bokeh.log &
> >
> > It works fine for a while, approximately a day or so, before it unexpectedly stops responding. Here is the output from our log file:
> > 2018-01-03 22:04:47,696 200 GET /pangia-vis?r=pangia-vis/data/6385dcf0180011304a1cc3b47512c6a6.tsv (127.0.0.1) 17.70ms
> > 2018-01-03 22:04:49,867 WebSocket connection opened
> > 2018-01-03 22:04:49,868 ServerConnection created
> > 2018-01-03 22:05:13,278 WebSocket connection closed: code=1001, reason=None
> > 2018-01-03 22:05:24,960 Error running application handler <bokeh.application.handlers.directory.DirectoryHandler object at 0x2aaac3e56fd0>: 'NoneType' object is not iterable
> > File "main.py", line 38, in <module>:
> > get_params = sorted(get_params) Traceback (most recent call last):
> > File "/panfs/biopan01/edge_prod/thirdParty/Anaconda3/lib/python3.5/site-packages/bokeh/application/handlers/code_runner.py", line 81, in run
> > exec(self._code, module.__dict__)
> > File "/panfs/biopan01/edge_prod/thirdParty/pangia/pangia-vis/main.py", line 38, in <module>
> > get_params = sorted(get_params)
> > TypeError: 'NoneType' object is not iterable
> >
> > It seems that the WebSocket closes and so the session data is lost. I can't find any reason for why this happens; viewing the same plot that worked before will encounter the closed WebSocket later on. Once we restart the bokeh server everything is fine. Is it a version issue with on of the python libraries?
> >
> > Is there some way to query the WebSocket status? If so, I could run it inside a supervisor daemon and have it restart the server if the websocket is closed.
> >
> > $ ./pip list | grep -i 'jinja\|numpy\|six\|requests\|tornado\|pyyaml\|dateutil\|bokeh'
> > bokeh (0.12.4)
> > Jinja2 (2.8)
> > numpy (1.11.1)
> > numpydoc (0.6.0)
> > python-dateutil (2.5.3)
> > PyYAML (3.11)
> > requests (2.10.0)
> > six (1.10.0)
> > sockjs-tornado (1.0.3)
> > tornado (4.3)
> >
> > CentOS Linux release 7.2.1511 (Core)
> >
> > relevant snippet from main.py
> > import pandas as pd
> > import numpy as np
> > import sys
> >
> > from os.path import dirname, join, isfile
> > from bokeh.plotting import curdoc, figure
> > from bokeh.layouts import row, layout, widgetbox, column
> > from bokeh.models import ColumnDataSource, HoverTool, Div, FactorRange, Range1d, TapTool, CustomJS
> > from bokeh.models.widgets import Button, Slider, Select, TextInput, RadioButtonGroup, DataTable, TableColumn, NumberFormatter
> > from bokeh.models.callbacks import CustomJS
> > from bokeh.palettes import RdYlBu11
> >
> > # default cutoffs for dot-plot display
> > def_val_patho = 0 #display mode: 0 -> pathogen only, 1 -> all
> > def_val_min_len = 50 #Minimum linear length [0-500] step=1
> > def_val_min_cov = 0.1 #Minimum linear coverage [0-1] step=0.01
> > def_val_max_r_raw = 100 #Minimum reads [0-500] step=1
> > def_val_max_r_rsnb = 100 #Minimum reads [0-100] step=1
> > def_val_min_score = 0.5 #Minimum score [0-1] step=0.1
> >
> > # get pangia result tsv
> > args = curdoc().session_context.request.arguments
> > r_file = ""
> >
> > if len(sys.argv) > 1:
> > r_file = sys.argv[1]
> > sys.stderr.write("[INFO] "+r_file)
> > if isfile(r_file):
> > sys.stderr.write("[INFO] Input file by sys argv: " + r_file)
> > else:
> > sys.stderr.write("[ERROR] Input file by sys argv: not found.")
> > raise
> >
> > if not r_file:
> > try:
> > get_params = args.get('r')
> > get_params = sorted(get_params)
> >
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> > To post to this group, send email to [email protected].
> > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/581b9c44-5744-42fb-9045-2ec4783101cc%40continuum.io.
> > For more options, visit https://groups.google.com/a/continuum.io/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5c105b1d-1e6b-450b-b7de-04361642d04b%40continuum.io.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5991bf45-19ba-4f0d-9a07-bd7c7f62e811%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.