Bokeh server is getting crashed after browser refresh

For the below Sample code, when refreshing the browser around 20 to 30 times, it shows 500 internal server error. It happens because of Server() method. any help on this will be grateful.
Uploaded the screen recording for the same.

python version: 3.8.0
bokeh version: 2.4.1

from bokeh.plotting import figure
from bokeh.models import Range1d
from bokeh.server.server import Server
from bokeh.application import Application
from bokeh.application.handlers.function import FunctionHandler
mercator_extent_x = dict(start=8577000, end=8585500, bounds=None)
mercator_extent_y = dict(start=3315000, end=3323000, bounds=None)

def test(curdoc):

    curdoc.clear()

    x_range = Range1d(**mercator_extent_x)
    y_range = Range1d(**mercator_extent_y)
    plot = figure(title='',
                  tools="pan,wheel_zoom",
                  x_range=x_range,
                  x_axis_type="mercator",
                  y_axis_type="mercator",
                  y_range=y_range,
                  width=700,
                  sizing_mode='stretch_width')  # create a figure

    curdoc.add_root(plot)

apps = {'/': Application(FunctionHandler(test))}
server = Server(apps, port=5007)
server.start()

@Kavita_Jain The code above just runs and exits immediately. There are a few ways it could be modified to actually run a server that can accept connections and server sessions, so I am not going to speculate about what your specific situation might be. To investigate, we need a complete Minimal Reproducible Example that can be run, as-is, to reproduce what you are seeing.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.