hudon/spike

zmq.core.error.ZMQError: Operation cannot be accomplished in current state

Opened this issue · 1 comments

When working on this bug, first note that I changed a lot from the original file to get it to work with their code.

The original numbers given encountered this case in network.py:

else: # otherwise we're in case 2 (pre is decoded)
assert transform.shape ==
(post.array_size, post.neurons_num, dim_pre)

I changed them so they didn't any longer.

See code diff for more details. The current version runs fine and outputs reasonable numbers with their code. I suspect this error is just caused by the fact that running network.run is not safe to run multiple times.

On branch test-cleanup run:

/usr/bin/python2 /home/robert/spike/test/nengo_tests/test_cleanup.py /home/robert/spike/test/../src

or make test to see the error:

Traceback (most recent call last):
File "/home/robert/spike/test/nengo_tests/test_cleanup.py", line 64, in
test_cleanup()
File "/home/robert/spike/test/nengo_tests/test_cleanup.py", line 48, in test_cleanup
net.run(0.001)
File "/home/robert/spike/test/../src/nef_theano/network.py", line 500, in run
conn.send(str(time))
File "socket.pyx", line 559, in zmq.core.socket.Socket.send (zmq/core/socket.c:5715)
File "socket.pyx", line 606, in zmq.core.socket.Socket.send (zmq/core/socket.c:5487)
File "socket.pyx", line 168, in zmq.core.socket._send_copy (zmq/core/socket.c:2079)
zmq.core.error.ZMQError: Operation cannot be accomplished in current state

This test basically just tests whether we can use the run function multiple times. For us, this doesn't completely make sense, because after we complete the run function, we exit out of our other processes, so we can't just tell them to run a little more later.

If we want to support this feature, we can easily add some synchronization stuff inside the processes to just block after you do the complete the run, and wait for the next call to run, but this presents a conceptual problem of when to exit the process.

In order to support this, we would need to add something to the external interface that does something like net.close(); and before this you can do run as many times as you want, but if you don't call close, the process will hang forever. Perhaps we should ask terry if he wants this?