Repository navigation
Worker Redesign - #704
Worker Redesign#704
Conversation
|
Running into the following error in distributed.worker - ERROR - 'NoneType' object has no attribute 'setsockopt'
Traceback (most recent call last):
File "/home/mrocklin/workspace/distributed/distributed/worker.py", line 1157, in gather_dep
stream = yield future
File "/home/mrocklin/Software/anaconda/lib/python3.5/site-packages/tornado/gen.py", line 1015, in run
value = future.result()
File "/home/mrocklin/Software/anaconda/lib/python3.5/site-packages/tornado/concurrent.py", line 237, in result
raise_exc_info(self._exc_info)
File "<string>", line 3, in raise_exc_info
File "/home/mrocklin/Software/anaconda/lib/python3.5/site-packages/tornado/gen.py", line 1024, in run
yielded = self.gen.send(value)
File "/home/mrocklin/workspace/distributed/distributed/core.py", line 327, in connect
set_tcp_timeout(stream)
File "/home/mrocklin/workspace/distributed/distributed/core.py", line 224, in set_tcp_timeout
sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
AttributeError: 'NoneType' object has no attribute 'setsockopt' |
This was necessary with zict.File and Python 2
|
No, I hadn't. That explains it :-) |
| yield gen.with_timeout(timedelta(seconds=1), | ||
| [close(stream) for stream in self._listen_streams]) | ||
| for stream in self._listen_streams: | ||
| stream.close() |
There was a problem hiding this comment.
@pitrou any thoughts on why this would cause more file descriptors to be left dangling?
The test distributed/tests/test_client.py::test_open_close_many_workers[Nanny-10-20] is now failing when we create and close many Nannys.
There was a problem hiding this comment.
The problem persists. It also persists if you remove the calls to close(stream) entirely and just call stream.close().
There was a problem hiding this comment.
It may be that closing the stream is confusing another coroutine which is using the stream at the same time. My question is: why did you want to add this?
There was a problem hiding this comment.
In distributed/tests/test_stress.py::test_stress_scatter_death we close workers during computation. We were finding that connections to killed workers were becoming non-responsive but still remained open. The living worker trying to gather data from the dead worker would wait for a very long time on a living but ineffective stream.
There was a problem hiding this comment.
I think I've identified the change that caused the issue.
| @@ -0,0 +1,83 @@ | |||
|
|
|||
There was a problem hiding this comment.
Is it deliberate to have test_worker and test_worker2?
There was a problem hiding this comment.
It was convenient to start, but I'll merge them now.
| MAX_BUFFER_SIZE = get_total_physical_memory() | ||
|
|
||
|
|
||
| CommunicationErrors = (StreamClosedError, socket.error, IOError, RPCClosed) |
There was a problem hiding this comment.
@pitrou do you see any problems with doing this?
There was a problem hiding this comment.
I don't think so, but you can use EnvironmentError to merge some of these together (apparently RPCClosed derives from IOError).
Still, a question: when is RPCClosed supposedly raised? It looks more like a programmer error (calling a method on a rpc object that's been closed explicitly)?
There was a problem hiding this comment.
Now using EnvironmentError.
There was a problem hiding this comment.
RPCClosed ends up being convenient. I don't now recall the original motivation. I suspect that it was difficult to always ensure that the system hadn't closed down in between every yield point and using exceptions was simpler.
This helps us to consistently except several types that can arise when a stream fails.
|
@pitrou if you get a chance I could use some help tracking down a failure in If you try this test a few times (I tend to run it in a loop) you'll eventually land in a pdb statement. We seem to be waiting on a message that never finishes. Useful things to look at include the following:
Sometimes the remote stream appears to be in a bad state. Calling Anyway, if you have some time to give this a shot I'd appreciate any thoughts you might come up with. I've been trying things here for a long while without much success. |
|
I've tried it out. I even got into a case where the socket was still believed to be connected: Yet the connection didn't appear anymore in |
|
I stand corrected: the connection does appear in And the netstat output shows there's some data in the recv queue on the other end (i.e. on the worker being gathered from): |
|
I would recommend applying the following patch: https://gist.github.com/pitrou/f9a19e3b162213ca70169c28582e65e2 |
|
You should have permissions to push directly to this branch
…On Wed, Nov 30, 2016 at 10:02 AM, Antoine Pitrou ***@***.***> wrote:
I would recommend applying the following patch: https://gist.github.com/
pitrou/f9a19e3b162213ca70169c28582e65e2
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#704 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AASszBCehgn5Zc9Qm8sIiZen9CCpcD8bks5rDY_qgaJpZM4K8qcF>
.
|
|
Ok, I'll try to. |
|
@pitrou any other comments on this PR? I'm tempted to merge this soon. |
|
I just pushed minor style cleanups. I'm ok on the PR, as I said it makes the worker's operation more understandable (though more complicated as well :-)). |
|
Yeah, I expect we'll run into a few frustrating issues in the near future. |
|
At least we don't seem to see any sporadic failures. |
|
OK, merging. |
This replaces the compute logic in the worker with something a bit more complex. See #698 for more details.