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

Repeatedly divide read buffer size by 8 until success. Fixes #11481. #18332

Merged
merged 1 commit into from
Sep 5, 2016

Conversation

twadleigh
Copy link
Contributor

@twadleigh twadleigh commented Sep 2, 2016

This solution fixes julia --lisp on Windows 7 by repeatedly halving dividing by 8 the number of bytes requested on a failed read and trying again, implementing the suggestion of @vtjnash in #11481.

The behavior should be unchanged on Windows 10 (or other platforms for which there wasn't previously a failure).

@twadleigh twadleigh changed the title Repeatedly halve read buffer size until success. Fixes #11481. Repeatedly divide read buffer size by 8 until success. Fixes #11481. Sep 2, 2016
@twadleigh
Copy link
Contributor Author

Tests passed for me locally (64-bit Win7). Looks like the AppVeyor failure was due to some network issue on their end?

@twadleigh twadleigh closed this Sep 2, 2016
@twadleigh twadleigh reopened this Sep 2, 2016
@tkelman
Copy link
Contributor

tkelman commented Sep 2, 2016

LGTM. Possible to test? Maybe add a comment too?

@twadleigh
Copy link
Contributor Author

I'll add a comment and a test.

@twadleigh twadleigh force-pushed the fix-lisp-on-windows branch 2 times, most recently from 2e6ef14 to 8d55e39 Compare September 2, 2016 14:37
…g#11481.

Dividing by 8 leads to success on the second try in the case of the failure of --lisp on Windows 7.
@twadleigh
Copy link
Contributor Author

I have been unable to construct an automated test case for this.

One issue is that I can't duplicate the error if julia is run in mintty, even if I run an inner instance of julia through cmd. For instance:

shell> cmd /c julia --lisp

results in a functional femtolisp, even for a julia without this patch, so the problem just doesn't exist if there is a mintty somewhere in the parentage. Since the testbed is almost certainly always going to be run from a cygwin/msys2 terminal, this looks like a deal killer.

Further, if input is piped in to femtolisp, it works OK, without the patch. For instance, I was considering doing something like

echo (exit 42) | julia --lisp

and testing the return code. If I got 42, then the lisp worked. If it wasn't able to process the input and returned immediately, I'd get some other return code (presumably). Unfortunately, this command actually works for the unpatched julia.

In sum, the bug only manifests if:

  • cmd is the only shell in the process's parentage;
  • input is requested interactively.

So automating a test case might require more cleverness than I can muster.

@tkelman
Copy link
Contributor

tkelman commented Sep 3, 2016

fair enough. appveyor and most people who would run Base.runtests won't happen through mintty, so it's okay if some tests would need to be run outside of mintty to actually catch a problem.

@vtjnash vtjnash merged commit 79a7172 into JuliaLang:master Sep 5, 2016
@twadleigh twadleigh deleted the fix-lisp-on-windows branch September 5, 2016 15:26
@tkelman tkelman added this to the 0.5.x milestone Sep 7, 2016
tkelman pushed a commit that referenced this pull request Feb 22, 2017
Dividing by 8 leads to success on the second try in the case of the failure of --lisp on Windows 7.

(cherry picked from commit 0440507)
ref #18332
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.

None yet

4 participants