-
Notifications
You must be signed in to change notification settings - Fork 57
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
Large send commands (!) not returning prompt in lux #17
Comments
function27 stdin:
function27 stdout:
|
function28 stdin:
function28 stdout:
As you can clearly see, function28 has the exact same makeup as function27, but is working while function27 is not. Once again, the only difference I can think of is that function27 has a much larger XML body. Thanks again in advance for your time/help. |
Does it work sometimes? If not, perhaps it may be some issue with how long string echo can manage (on your host)? If it works sometimes I would compare the (textual) event.log file from a successful run with a failing run. More specifically I would try to figure out what happened just before the "echo giant | curl" command. Such as has the previous command REALLY finished before the giant command gets executed? And what differs in the stdout stream when the giant command gets executed?? |
Yes, it works sometimes, so that's how I came to the conclusion it was some kind of weird race condition, although I could be wrong. Unfortunately, looking at the Successful run:
Unsuccessful run:
Looking at the above output and comparing it, it looks like the failing test doesn't see the 'echo' output. This probably means the echo command doesn't complete, as it's expecting SH-PROMPT afterwards and never gets it. I'm a little stumped about what could possibly block an |
Check the previous "send" item in the event log and verify that it has completed. With this I mean that you have matched on something reliable, such as the SH-PROMPT produced AFTER the command has finished. Do ensure it was not matched on some earlier prompt. |
Yes, that's correct. It looks like the last successful match was on
|
Hey Hakan, how does invoking a macro work? Does it just spawn a separate shell to run the macro or does it simply include the commands and run it within the sequence?
Are the above two separate files essentially the equivalent of:
? |
They are essentially equivalent. Shells are started on demand with [shell NAME]. You can this in the event.log. It is very transparent. |
Btw, avoid to build in assumptions about where the script will be executed or where its logs will be located. Use "mkdir -p $LUX_EXTRA_LOGS/output_files" instead of using "mkdir -p lux_logs/latest_run/output_files". |
Have you tried to copy the "echo giant |curl" command from the stdin log and paste it repeatedly in a (Bourne) shell? It may cause the same problems as you encounter in the lux script. |
echo
not returning
echo
not returningecho
not returning in lux
Yes, I ran the command manually on the terminal and it works as expected, repeatedly. I managed to narrow down the problem to the specific line with the Here is what I did:
Results:
Conclusions:
Thanks again for your time and help. Much appreciated |
UPDATE 1: I experimented with the XML body I was sending and shortened it to test, and it looks like the shorter body works (consistently, with repeated running), which explains why the rest of my tests work (shorter XML bodies). UPDATE 2: Replaced Based on UPDATE 1, is there some kind of buffer limit or buffer overflow or some kind of array or variable size limit being placed on multi-line regex and other items for Lux? |
I do not think the problem really is lux. The argument string given to 'echo' is seems quite extreme. So I would avoid it as it may indicate that you have run into some system limit related to the shell (/bin/sh), the terminal or what not. Try using 'cat' or something else which avoids the very long argument string. Something like this may work:
|
[macro eval cmd] [macro eval_any cmd] |
Gave your suggestions a try and it runs into the same problem. The multi-line command with cat > xml.tmp << HEREDOC HEREDOC runs into the same issue: I ran it a multitude of times, and it succeeded once, and failed the other times. Every single multi-line command tested (i.e., I did notice that when I shorten the XML body, it then does work in Lux, and I'm not convinced that that is a system limitation, as you say, because once again, it works when run directly on the terminal. Thanks for your help thus far, I'll keep digging through and experimenting and I'll report back whether I find anything. |
Are you using the same shell as lux when you run it outside lux? See the
event.log about how lux starts its shell. (It is probably "/bin/sh -i".)
/Håkan
On Jan 12, 2017 00:10, "Michael Thanh" <[email protected]> wrote:
Gave your suggestions a try and it runs into the same problem. The
multi-line command with cat > xml.tmp << HEREDOC HEREDOC runs into the same
issue: I ran it a multitude of times, and it succeeded once, and failed the
other times.
Every single multi-line command tested (i.e., echo, printf, cat w/ heredoc,
even directly passing the entire body as an argument to curl) all worked
fine when run directly on the shell, but the test hangs inside Lux.
I did notice that when I shorten the XML body, it then does work in Lux,
and I'm not convinced that that is a system limitation, as you say, because
once again, it works when run directly on the terminal.
Thanks for your help thus far, I'll keep digging through and experimenting
and I'll report back whether I find anything.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#17 (comment)>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AAJpsO5PfUur6DIRBpsku8pX4I7suuAFks5rRWF6gaJpZM4Lf6yC>
.
|
Hmmm. No, my terminal runs zsh. So you think it might be a limitation of sh vs. zsh? I'll try running the lux tests in a different shell tomorrow. |
Maybe. It is one possible difference in the run environment. We have had
issues with /bin/sh compliance on some platforms.
Another issue may be the terminal settings. If you cannot reproduce the
problem with plain "/bin/sh -i", you may try with /bin/sh in conjunction
with lux/priv/bin/runpty like lux does. See the event.log for the shell
start details with runpty.
/Håkan
…On Thu, Jan 12, 2017 at 5:35 AM, Michael Thanh ***@***.***> wrote:
Hmmm. No, my terminal runs zsh. So you think it might be a limitation of
sh vs. zsh?
I'll try running the lux tests in a different shell tomorrow.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#17 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAJpsJ8H8oy1TDJuw_3vZWcFKCsdnqBAks5rRa2dgaJpZM4Lf6yC>
.
|
Hello Håkan, I'm working with Michael here. Seems like there is a lux limitation on how many characters can be in the send command. Please see my lux script it seems to fail when the number of characters are around 2048 on a send line. I've gotten the same results using printf and echo instead of cat as shown. /Lloyd Passes
Passes
Will timeout
|
Hey @hawk, I tried your suggestions to reproduce the error on the shell and was unable to. I first logged into the standard Bourne shell using the command as follows: Afterwards, I ran the same large command from inside the Lux script manually in the Bourne shell, and it succeeds without any problems repeatedly.
and the output I get is as expected:
I also tried a few other shells like zsh and bash, and those are also working as expected. At this point my tests and experiments don't reinforce that the issue is with the system or with the specific shell environment the command is being run in. |
echo
not returning in lux
I can confirm that it is a bug in Lux. It was possible to reproduce with:
then the shell hanged. Unfortunately I don't know a good temporary workaround. The bug needs to be fixed. |
Hey @hawk just curious when we might see the fix come through? Being able to send these sends with > 2048 bytes is a bit critical for our project. |
If you are brave you may test the latest on the non-blocking-pty branch. It
is not fully tested though.
/Håkan
…On Mon, Jan 16, 2017 at 5:09 PM, Lloyd Rochester ***@***.***> wrote:
Hey @hawk <https://github.com/hawk> just curious when we might see the
fix come through? Being able to send these sends with > 2048 bytes is a bit
critical for our project.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#17 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAJpsGWOOMXi_MoKFbR8iQAlP_o-olshks5rS5ZPgaJpZM4Lf6yC>
.
|
@hawk Sure thing we will try it out and let you know. |
Working on testing it. I looked through the code and the 4*BUF was interesting. The runpty is quite complex and cool as well, was looking at how you did that. Currently get 2 issues always when installing on OS X in that my erlc path is wrong so I edit include.mk, but then get an issue in make saying
Once I fix that I should be able to get back to you. |
When I fix my @hawk ORIGINAL COMMAND:
STDOUT OUTPUT:
If I had to make a guess, it looks like the 4*BUF didn't actually expand the size of the buffer to 4 times, but instead duplicated the limited-size buffer 4 times, resulting in the output you see above. I tested also with a simple lux script where I echo a large body of 0s like so:
and I am getting an error as follows:
It also looks like the SH-PROMPT: is still not returning |
Can you provide a minimal test case which reproduces the (new) problem?
The error message saying something about shell context, probably implies
that the shell has died prematurely. Take a look at the event log. Or run
lux with the -v flag.
/Håkan
On Jan 17, 2017 6:58 PM, "Michael Thanh" <[email protected]> wrote:
@lloydroc <https://github.com/lloydroc>
When I fix my include.mk files to reflect the correct erl and erlc
locations, my error for xmerl goes away. Maybe try checking that again?
Pulled the non-blocking-pty branch and tested it with the tests I was
previously having problems with. In the stdin.log, I'm seeing the expected
SEND command. However, in the stdout.log, I'm seeing an oddly mangled
version of what I sent, and it's also multiple times what the original
buffer had. Example:
SH-PROMPT: echo '
<LARGE XML BODY w/ LAST 2 LINES MISSING>
...
<DUPLICATE LARGE XML BODY w/ FIRST 2 LINES MISSING>
...
<DUPLICATE LARGE XML BODY w/ FIRST 6 LINES MISSING>
...etc.
I tested also with a simple lux script where I echo a large body of 0s like
so:
[shell test]
!echo '000000 .... '
?SH-PROMPT:
and I am getting an error as follows:
result : FAIL at 3
expected
SH-PROMPT:
actual error
The command must be executed in context of a shell
successful : 0
failed : 1
temp.lux:3 - The command must be executed in context of a shell
summary : FAIL
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#17 (comment)>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AAJpsPPpLfWN3LkpirG0vwzcr6GSs2lBks5rTQFCgaJpZM4Lf6yC>
.
|
1) Regarding the early-terminated shell Yes, you're right. I looked through the event log and it looks like the shell is terminated.
For reference, in the test, I echo a string of 6222 zeroes. It looks like the
This continues for about a thousand more lines because the The total number of 0s it receives is only around 3000 or so however before the shell is terminated. 2) Regarding Simple Test Case to Replicate New Problem
That's the whole test. It seems to die because of the new line characters - if I remove the new lines and have it pasted as a single contiguous line, then it works, but I somehow feel like that defeats the purpose of the multi-line send... |
This test works / passes.
|
@mvxt I modified my
Erlang I installed from From shell I have:
Not sure why it can't find |
Ok found the issue with installation. If you try to install lux with
Solution is to set the
|
@hawk with the like this:
with success. But when I run this (the cat is line 16):
This is the minimal test case I see to reproduce the error. We need to be able to send commands that are around 4096 I would assume maybe even bigger. In the grand scheme this isn't that big. The failure will be:
|
Sorry, I have not have the time to investigate the runpty problem. Hopefully I can do it tomorrow. Regarding your installation problem, you need an Erlang installation containing the xmerl application. Nowdays Erlang/OTP is split into tons av tiny packages in the eco system of many package managers. I don't know what platform you are using, but on Mac there is a package called 'erlang' which contains the works. "sudo port install erlang" installs what you need. If you have a symbolic link to lux from some bin directory in your path, you may also get that kind of error. If that is the case you need my recently contributed Erlang/OTP patch of escript.c:
|
Thanks @hawk just please let us know when you have something we can test again. In the meantime we found a workaround. |
I think I have fixed it now.
/Håkan
…On Tue, Jan 24, 2017 at 12:37 AM, Lloyd Rochester ***@***.***> wrote:
Thanks @hawk <https://github.com/hawk> just please let us know when you
have something we can test again. In the meantime we found a workaround.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#17 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAJpsKbDrKuqHa9FN9h7cZOn5yKfIgLCks5rVTnEgaJpZM4Lf6yC>
.
|
@hawk Thanks, we will test it as soon as we are available. Same branch, non-blocking-pty? |
Yes
/Håkan
…On Jan 31, 2017 18:01, "Michael Thanh" ***@***.***> wrote:
@hawk <https://github.com/hawk> Thanks, we will test it as soon as we are
available. Same branch, non-blocking-pty?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#17 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAJpsH_Uu2mBIZlJF6BBxJygTTC7hyIWks5rX2jXgaJpZM4Lf6yC>
.
|
@hawk I was able to verify the fix worked for me. Looked at the diff and that was a tricky bug. Do have one comment though I will comment on your commit. |
I've been poking at this for a little while and I'm at my wits' end. I would appreciate any direction/pointers. I'll include the relevant tidbits from files.
I have the following setup for a test suite:
function-27:
macro-27.luxinc:
package.luxinc:
So, the main test script function-27 first calls setup from the package.luxinc, which just creates a directory. This works fine. The place where I encounter trouble is when the main test script calls function27rest from the macro-27.luxinc file, which echoes a large XML body to a cURL command then pipes the resulting return body into a file.
For whatever reason, when I expect the SH-PROMPT, it never returns. The part that really confuses me is that I have the same setup for multiple tests (i.e., function-28, function-29, etc...) and they all work except this one. The biggest difference I can think of between this one and the rest of the tests is that this one has the largest XML body. But I'm not sure exactly what problem that causes.
The following comments on this issue contain the output from the .stdin and .stdout of the test suite. Any help would be appreciated!!
The text was updated successfully, but these errors were encountered: