performing IO reads in a separate threads to avoid potentially blocking on Windows #765

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@dgholz

issue #755/#664

@mitchellh
Owner

Hm, I've thought of doing this but I'm not sure if it is necessary. I think the problem really lies right here: https://github.com/dgholz/vagrant/blob/fce98ff8cd39cc183b0aec7b655a4fba100b1976/lib/vagrant/util/subprocess.rb#L199

After staring at that method for about 5 minutes, I think I see what is going wrong on Windows. Specifically readpartial blocks only if there is no data in the buffer, whereas on linux read_nonblock never blocks, and raises an exception to break out.

I think the solution might just be to ALWAYS break after reading on Windows. This makes Windows slightly less performant but at least it won't hang. I'm going to keep looking though...

@mitchellh
Owner

So I believe this commit actually fixes this in a very simple way: a90f33d

I've tested it and Windows still works for me, but I never saw the blocking behavior. Can you see if it fixes it?

@mitchellh mitchellh closed this Feb 28, 2012
@dgholz

Works great!

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