Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that events are not launched from the wrong thread #345

Merged
merged 4 commits into from
Mar 29, 2019

Conversation

philippjfr
Copy link
Member

@philippjfr philippjfr commented Mar 29, 2019

Fixes #344

@xavArtley Could you test this?

@xavArtley
Copy link
Collaborator

it fails on the firs call:

Exception in Tkinter callback
Traceback (most recent call last):
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\tkinter\__init__.py", line 1699, in __call__
    return self.func(*args)
  File "D:\CIVA_RP\civa-rep\src_python\civa_utils\bridgeJavaPython\dev\tk_app.py", line 34, in on_slider_change
    slider.value = float(event)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\param\parameterized.py", line 246, in _f
    return f(self, obj, val)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\param\__init__.py", line 614, in __set__
    super(Dynamic,self).__set__(obj,val)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\param\parameterized.py", line 246, in _f
    return f(self, obj, val)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\param\parameterized.py", line 775, in __set__
    obj.param._call_watcher(watcher, event)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\param\parameterized.py", line 1371, in _call_watcher
    watcher.fn(self_._update_event_type(watcher, event, self_.self_or_cls.param._TRIGGER))
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\panel\viewable.py", line 567, in param_change
    self._update_model(events, msg, root, model, doc, comm)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\panel\viewable.py", line 547, in _update_model
    model.update(**msg)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\bokeh\core\has_props.py", line 376, in update
    setattr(self, k, v)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\bokeh\core\has_props.py", line 280, in __setattr__
    super(HasProps, self).__setattr__(name, value)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\bokeh\core\property\descriptors.py", line 545, in __set__
    self._internal_set(obj, value, setter=setter)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\bokeh\core\property\descriptors.py", line 769, in _internal_set
    self._real_set(obj, old, value, hint=hint, setter=setter)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\bokeh\core\property\descriptors.py", line 838, in _real_set
    self._trigger(obj, old, value, hint=hint, setter=setter)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\bokeh\core\property\descriptors.py", line 915, in _trigger
    obj.trigger(self.name, old, value, hint, setter)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\bokeh\model.py", line 678, in trigger
    super(Model, self).trigger(attr, old, new, hint=hint, setter=setter)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\bokeh\util\callback_manager.py", line 161, in trigger
    self._document._notify_change(self, attr, old, new, hint, setter, invoke)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\bokeh\document\document.py", line 1004, in _notify_change
    self._trigger_on_change(event)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\bokeh\document\document.py", line 1099, in _trigger_on_change
    self._with_self_as_curdoc(invoke_callbacks)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\bokeh\document\document.py", line 1112, in _with_self_as_curdoc
    return f()
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\bokeh\document\document.py", line 1098, in invoke_callbacks
    cb(event)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\bokeh\document\document.py", line 668, in <lambda>
    self._callbacks[receiver] = lambda event: event.dispatch(receiver)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\bokeh\document\events.py", line 244, in dispatch
    super(ModelChangedEvent, self).dispatch(receiver)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\bokeh\document\events.py", line 126, in dispatch
    receiver._document_patched(self)
  File "D:\CIVA_RP\civa-rep\ProjetCIVA\ceaComponents\dev\python\lib\site-packages\bokeh\server\session.py", line 214, in _document_patched
    raise RuntimeError("_pending_writes should be non-None when we have a document lock, and we should have the lock when the document changes")
RuntimeError: _pending_writes should be non-None when we have a document lock, and we should have the lock when the document changes

@philippjfr
Copy link
Member Author

That's because I inverted the logic 🤦‍♂️

Pushing a fix now.

@philippjfr
Copy link
Member Author

Okay, fixed.

@xavArtley
Copy link
Collaborator

Yeah great it works

@codecov-io
Copy link

codecov-io commented Mar 29, 2019

Codecov Report

Merging #345 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #345      +/-   ##
==========================================
+ Coverage   86.92%   86.94%   +0.01%     
==========================================
  Files          88       88              
  Lines        7572     7583      +11     
==========================================
+ Hits         6582     6593      +11     
  Misses        990      990
Impacted Files Coverage Δ
panel/pane/holoviews.py 88.99% <100%> (ø) ⬆️
panel/viewable.py 84.19% <100%> (+0.29%) ⬆️
panel/pane/base.py 91.01% <100%> (ø) ⬆️
panel/io/state.py 89.28% <100%> (+2.92%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 85176e9...ec84ba5. Read the comment docs.

@philippjfr philippjfr merged commit fc0b7d8 into master Mar 29, 2019
@philippjfr philippjfr deleted the thread_event_block branch September 9, 2019 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants