Are my panel callbacks running concurrently?

I have a long-running callback that is calling out to an API server (using requests library). I can click on the various other widgets on my app while this 30-40 second callback is running. It seems like when I do this some of my global variables can get corrupted.

I have not set up threading or async or anything in my panel serve command. Could I still have some sort of concurrent callback execution happening anyway? Or, can I definitely eliminate concurrent execution as the cause of the problem?

Thanks,

No I don’t think it’s running concurrently, but hard to confirm without a minimal reproducible example.

Yeah, that’s not straightforward when there are multiple moving pieces and a timing issue. The only other clue I have are a bunch of messages that say “ignore this message”

Here are a few lines of it…


2024-03-14 14:45:12,215 Dropping a patch because it contains a previously known reference (id='p1303'). Most of the time this is harmless and usually a result of updating a model on one side of a communications channel while it was being removed on the other end.
2024-03-14 14:45:12,215 Dropping a patch because it contains a previously known reference (id='p1421'). Most of the time this is harmless and usually a result of updating a model on one side of a communications channel while it was being removed on the other end.
2024-03-14 14:45:12,216 Dropping a patch because it contains a previously known reference (id='p1421'). Most of the time this is harmless and usually a result of updating a model on one side of a communications channel while it was being removed on the other end.
2024-03-14 14:45:12,216 Dropping a patch because it contains a previously known reference (id='p1421'). Most of the time this is harmless and usually a result of updating a model on one side of a communications channel while it was being removed on the other end.
2024-03-14 14:45:12,217 Dropping a patch because it contains a previously known reference (id='p1421'). Most of the time this is harmless and usually a result of updating a model on one side of a communications channel while it was being removed on the other end.
2024-03-14 14:45:12,218 Dropping a patch because it contains a previously known reference (id='p1422'). Most of the time this is harmless and usually a result of updating a model on one side of a communications channel while it was being removed on the other end.
2024-03-14 14:45:12,218 Dropping a patch because it contains a previously known reference (id='p1422'). Most of the time this is harmless and usually a result of updating a model on one side of a communications channel while it was being removed on the other end.

If I’m not mistaken, that should be fixed in Fixes for layout caching and sizing by philippjfr · Pull Request #6446 · holoviz/panel · GitHub

I recommend trying to pull latest Panel main and seeing if it works!
pip install git+https://github.com/holoviz/panel.git@main

I ended up taking my callback and making it more low level (with param.watch_values) so that I could audit which values were changing in what order and exactly at what point the problem was happening – and along the way of that refactoring the bug went away!

1 Like