Skip to content

panel.io.hold not working in threaded app #7590

Description

@TheoMathurin
Software Version Info
panel 1.5.5
bokeh 3.6.2

When automatic threading is enabled, using hold does not work and an error appears in the logs.

In foo.py:

import panel as pn
from panel.io import hold

@hold()
def increment(e):
    for obj in column_1:
        obj.object = str(e.new)

column_1 = pn.FlexBox(*['0']*100)
button = pn.widgets.Button(name='Increment', on_click=increment)

pn.Column(column_1, button).servable()

and

panel serve foo.py --num-threads 4

Stack traceback and/or browser JavaScript console output

ERROR: panel.io.document - Using the unlocked decorator when running inside a thread is not safe! Ensure you check that pn.state._current_thread matches the current thread id.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions