☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Locking problem with two threads using add_next_tick_callback

Community Support
foobarbecue
foobarbecue

Hey guys, I’ve got a holoviews / bokeh / tornado app that works well until I have multiple users. Then I get a RuntimeError from the bokeh server:

_pending_writes should be non-None when we have a document lock, and we should have the lock when the document changes

Source code is here: GitHub - foobarbecue/ultrahelicorder: Attempt to create a better live seismic data display .

There are just two short files: slurp.py has the data collection thread and running serve.py starts the server. There’s a demo running at http://sei.sm:8121 and the first person to look at it will see seismic data but the second will get a 500 error.

I think it might be because I’m adding a next tick callback for each user in rapid succession. I was hoping that adding @without_document_lock as explained here would solve it, but no such luck.

Any idea what I’m doing wrong?

edit: I just remembered you’ll have to remove 'apply_xrange': False, 'apply_yrange': True, – these are options I added in my own fork of holoviews.

⌁   Link to post
foobarbecue
foobarbecue

I realized that the event that caused the error was coming from apply_theme() – something about changing the font from 12 point to 10 point. I commented out line 194 in bokeh\themes\theme.py and the problem went away. Maybe apply_theme doesn’t respect the lock or something?

Now I have a new problem: whenever a user closes their browser window, the server stops streaming data to the other clients.

⌁   Link to post
Bryan
Bryan

Entirely possible. The kind of usage you are doing is fairly far outside the envelope of typical usage (“Shiny for Python”) which means it has not necessarily been considered for active support (i.e., put under CI test). This seems like it might have a simple solution, though, and the information you have collected is fairly specific, so a GH issue about locking theme application would be appropriate.

whenever a user closes their browser window, the server stops streaming data to the other clients.

Definitely not anything I could speculate without getting in to really details and specifics of your code. I will try to take a look when I can but it may be this weekend or later.

⌁   Link to post
foobarbecue
foobarbecue

I didn’t know about Shiny, looks cool! I just need a few more good reasons to learn R…

Thanks for trying to find the time to look at it. I will probably also post that GH issue about apply_theme & locking this weekend… maybe I will find the time to write a test case for it.

⌁   Link to post

End of archived discussion · Replies are disabled