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

GUI stops updating #763

Open
jgosmann opened this issue Jun 8, 2016 · 29 comments
Open

GUI stops updating #763

jgosmann opened this issue Jun 8, 2016 · 29 comments
Labels
Milestone

Comments

@jgosmann
Copy link
Collaborator

jgosmann commented Jun 8, 2016

with the following exception on the command line:

Starting nengo server at http://localhost:8080
ERROR:root:Error processing: u'{"act":"pos","uid":"gate","x":0.09051165512586382,"y":0.8777296829823005}'
Traceback (most recent call last):
  File "/Volumes/Home/blubb/Library/Python/2.7/lib/python/site-packages/nengo_gui-0.2.1.dev0-py2.7.egg/nengo_gui/guibackend.py", line 252, in _handle_ws_msg
    component.message(msg.data)
  File "/Volumes/Home/blubb/Library/Python/2.7/lib/python/site-packages/nengo_gui-0.2.1.dev0-py2.7.egg/nengo_gui/components/netgraph.py", line 413, in message
    act = nengo_gui.user_action.create_action(action, self, **info)
  File "/Volumes/Home/blubb/Library/Python/2.7/lib/python/site-packages/nengo_gui-0.2.1.dev0-py2.7.egg/nengo_gui/user_action.py", line 16, in create_action
    return Pos(net_graph, **kwargs)
  File "/Volumes/Home/blubb/Library/Python/2.7/lib/python/site-packages/nengo_gui-0.2.1.dev0-py2.7.egg/nengo_gui/user_action.py", line 215, in __init__
    self.x, self.y = self.obj_config.pos
TypeError: 'NoneType' object is not iterable

(note that this is on the server-refactor branch, #673, but it doesn't seem to be related to those changes to me)

@jgosmann jgosmann added the bug label Jun 8, 2016
@jgosmann jgosmann added this to the 0.3 release milestone Jun 8, 2016
@jgosmann
Copy link
Collaborator Author

jgosmann commented Jun 8, 2016

Let me know if anyone manages to reproduce this reliably ... it happened to me quite often trying to build a model, but I'm not managing to reproduce it on purpose.

@PLindes
Copy link

PLindes commented Jun 8, 2016

Further console output examples

ERROR:root:Error processing: '{"act":"pos","uid":"model.b","x":0.6997759832742082,"y":0.2873048265533181}'
Traceback (most recent call last):
  File "c:\users\plind\documents\github\nengo_gui\nengo_gui\guibackend.py", line 252, in _handle_ws_msg
    component.message(msg.data)
  File "c:\users\plind\documents\github\nengo_gui\nengo_gui\components\netgraph.py", line 413, in message
    act = nengo_gui.user_action.create_action(action, self, **info)
  File "c:\users\plind\documents\github\nengo_gui\nengo_gui\user_action.py", line 16, in create_action
    return Pos(net_graph, **kwargs)
  File "c:\users\plind\documents\github\nengo_gui\nengo_gui\user_action.py", line 215, in __init__
    self.x, self.y = self.obj_config.pos
TypeError: 'NoneType' object is not iterable
Exception in thread Thread-72:
Traceback (most recent call last):
  File "C:\Users\plind\Anaconda3\lib\threading.py", line 914, in _bootstrap_inner
    self.run()
  File "C:\Users\plind\Anaconda3\lib\threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "c:\users\plind\documents\github\nengo_gui\nengo_gui\page.py", line 496, in runner
    self.build()
  File "c:\users\plind\documents\github\nengo_gui\nengo_gui\page.py", line 439, in build
    c.add_nengo_objects(self)
  File "c:\users\plind\documents\github\nengo_gui\nengo_gui\components\sim_control.py", line 52, in add_nengo_objects
    with page.model:
AttributeError: __exit__

ERROR:root:Error processing: '{"act":"pan","x":0,"y":0}'
Traceback (most recent call last):
  File "c:\users\plind\documents\github\nengo_gui\nengo_gui\guibackend.py", line 252, in _handle_ws_msg
    component.message(msg.data)
  File "c:\users\plind\documents\github\nengo_gui\nengo_gui\components\netgraph.py", line 411, in message
    getattr(self, 'act_' + action)(**info)
  File "c:\users\plind\documents\github\nengo_gui\nengo_gui\components\netgraph.py", line 464, in act_pan
    self.page.config[self.page.model].pos = x, y
  File "c:\users\plind\documents\github\nengo\nengo\config.py", line 280, in __getitem__
    "configures('%(name)s') first." % {'name': key.__class__.__name__})
nengo.exceptions.ConfigError: Type 'NoneType' is not set up for configuration. Call configures('NoneType') first.

@jgosmann
Copy link
Collaborator Author

jgosmann commented Jun 8, 2016

It seems it is required to move objects around, but still can't reproduce it reliably.

@jgosmann
Copy link
Collaborator Author

jgosmann commented Jun 8, 2016

@PLindes Are you using the master or the server-refactor branch (of nengo_gui)?

@Seanny123
Copy link
Collaborator

I posted that issue. He's using the server-refactor branch.

@bmorcos
Copy link
Contributor

bmorcos commented Jun 8, 2016

Is this related to Issue #759 ?

@jgosmann
Copy link
Collaborator Author

jgosmann commented Jun 8, 2016

Don't think so

@jgosmann
Copy link
Collaborator Author

jgosmann commented Jun 8, 2016

This is not related to the server refactoring. It also happens on master with a slightly different backtrace:

Starting nengo server at http://localhost:8080
Error processing: "{"act":"pos","uid":"af","x":0.6514770681424664,"y":0.23993920886809286}"
Traceback (most recent call last):
  File "/Volumes/Home/blubb/Documents/projects/uni/nengo_gui/nengo_gui/server.py", line 136, in ws_viz_component
    component.message(msg)
  File "/Volumes/Home/blubb/Documents/projects/uni/nengo_gui/nengo_gui/components/netgraph.py", line 413, in message
    act = nengo_gui.user_action.create_action(action, self, **info)
  File "/Volumes/Home/blubb/Documents/projects/uni/nengo_gui/nengo_gui/user_action.py", line 16, in create_action
    return Pos(net_graph, **kwargs)
  File "/Volumes/Home/blubb/Documents/projects/uni/nengo_gui/nengo_gui/user_action.py", line 215, in __init__
    self.x, self.y = self.obj_config.pos
TypeError: 'NoneType' object is not iterable

@jgosmann
Copy link
Collaborator Author

jgosmann commented Jun 8, 2016

I am finally able to consistently reproduce this with one model file I have (not sure if it work for any). In the model file the following steps are required:

  1. Create an ensemble assigned to a name that is not yet in the .cfg file.
  2. Create a connection from an existing node (maybe another ensemble works too?) to that created ensemble. (It won't work without this step)
  3. Drag and drop the ensemble.

I can go back in versions and still reproduce this in version 0.1.3, probably even older versions (wanted to document this before testing further).

@jgosmann
Copy link
Collaborator Author

jgosmann commented Jun 8, 2016

ok, I think, I've got a rough idea what's going on. To understand that, we need to look at how the position is stored on the Python side: Each Nengo object is assigned a uid (think of it as a name), this uid is mapped to the actual Nengo object, that actual Nengo object (or it's memory address) is used to map to the position parameter in the config.

When the ensemble is initially created, everything gets assigned and mapped properly. But when the code is edited than somehow the Nengo object changes (it's memory address will be different), probably due to the recompilation. The uid mapping is updated accordingly, but not the config with the position. So the new Nengo object due to recompilation will have a position config of None causing the problem.

@jgosmann
Copy link
Collaborator Author

jgosmann commented Jun 8, 2016

A potential quick fix might be to set the pos default to (0, 0) instead of None. However, we should definitely look for a proper fix because I assume that there is a deeper underlying issue that needs to be fixed and would otherwise get back to us.

@jgosmann
Copy link
Collaborator Author

jgosmann commented Jun 8, 2016

Personally, I am not familiar enough with the code base yet to propose what a proper fix would be right now. I have to figure out in detail, how stuff gets updated and objects get related to each other on compilation.

@Seanny123
Copy link
Collaborator

With these details, I can take a shot at the bug. Alternatively, if you want to do some reading, the Flow Docs might help. Do you know where to find those?

@jgosmann
Copy link
Collaborator Author

jgosmann commented Jun 8, 2016

I don't think there is enough details in the Flow Docs. Feel free to take a shot at fixing the bug. I'm probably also looking further into it until I go to dinner.

@jgosmann
Copy link
Collaborator Author

jgosmann commented Jun 8, 2016

Though #767 might make it a bit tedious.

@jgosmann
Copy link
Collaborator Author

jgosmann commented Jun 8, 2016

Actually the problem might be not so much that the config is not updated for the new object id, but that it is completely reloaded anyways? Where there any changes to when the config gets written to disk?

@jgosmann
Copy link
Collaborator Author

jgosmann commented Jun 8, 2016

We don't have anything in Nengo right now to copy the config of an object, do we? (@tbekolay?)

@Seanny123
Copy link
Collaborator

Where there any changes to when the config gets written to disk?

Changes to what?

@jgosmann
Copy link
Collaborator Author

jgosmann commented Jun 8, 2016

Changes to what?

to when the config gets written to disk
(at the moment it seems to be on save and I assume in regular intervals? maybe it was on every recompilation at some point?)

@tbekolay
Copy link
Member

tbekolay commented Jun 8, 2016

copy the config of an object

I have a branch where it is (I believe) possible to pickle configs, as I needed it to parallelize some model. It might be somewhat out of date though. https://github.com/nengo/nengo/compare/pickle-config

@Seanny123
Copy link
Collaborator

This is actually probably related to another error some of the users were getting where if they ignored this error long enough there ends up being too many files open which causes another error.

@jgosmann
Copy link
Collaborator Author

jgosmann commented Jun 8, 2016

Not sure. How would this be related?

On June 8, 2016 6:17:18 PM EDT, Sean Aubin notifications@github.com wrote:

This is actually probably related to another error some of the users
were getting where if they ignored this error long enough there ends up
being too many files open which causes another error.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#763 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.

@Seanny123
Copy link
Collaborator

It's just a hunch. I think the problem we're experiencing has to do with
the threads not correctly managing the config and the config files.

On Wed, Jun 8, 2016 at 6:52 PM, Jan Gosmann notifications@github.com
wrote:

Not sure. How would this be related?

On June 8, 2016 6:17:18 PM EDT, Sean Aubin notifications@github.com
wrote:

This is actually probably related to another error some of the users
were getting where if they ignored this error long enough there ends up
being too many files open which causes another error.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#763 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#763 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AB1HafoGIWeiWFeMTrexQHao-Ceqpwu5ks5qJ0e1gaJpZM4Iw-jv
.

@Seanny123
Copy link
Collaborator

@jgosmann how did you isolate the bug to the fact that the config is being changed in the wrong way while the code is being written?

@Seanny123
Copy link
Collaborator

Seanny123 commented Jun 10, 2016

New reduced steps:

  • make an object
  • make another object
  • create a compilation error and then remove it
  • move the newest object

Example resulting config:

_viz_ace_editor = nengo_gui.components.AceEditor()
_viz_net_graph = nengo_gui.components.NetGraph()
_viz_sim_control = nengo_gui.components.SimControl()
_viz_config[_viz_sim_control].kept_time = 4.0
_viz_config[_viz_sim_control].shown_time = 0.5
_viz_config[ee].pos=(0.6007556675062973, 0.20113636363636414)
_viz_config[ee].size=(0.33333333333333337, 0.14285714285714285)
_viz_config[model].pos=(0, 0)
_viz_config[model].size=(1.0, 1.0)
_viz_config[model].expanded=True
_viz_config[model].has_layout=True

@Seanny123
Copy link
Collaborator

Seanny123 commented Jun 13, 2016

New reduced steps.

  1. Make a nengo network with an object
  2. Hit enter to go to a newline
  3. Move the object

I've narrowed down the bug to _reload_update_item not taking all parameters into account, but my solution isn't working... Will finish tomorrow.

@jgosmann
Copy link
Collaborator Author

This issue is a major annoyance for me right now. 👿
I'm constantly running into it and I even lost some work due to it.

@tcstewar
Copy link
Collaborator

This issue is a major annoyance for me right now. 👿
I'm constantly running into it and I even lost some work due to it.

grrr. I'm looking into it now, and at the very least here's a quick PR that tosses in an exception handler that should mean that everything doesn't fall apart when this exception happens: #842

@jgosmann
Copy link
Collaborator Author

Thank you, @tcstewar! 🙇 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

6 participants