-
Notifications
You must be signed in to change notification settings - Fork 338
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
MTR does not play nice with nohup #231
Comments
Additional detail: I tried this on a new distribution - same problem. Replicate with: nohup mtr -c 1 --split 8.8.8.8 This will never return. Strace shows: select(10, [0 6 8 9], [], NULL, {0, 0}) = 1 (in [0], left {0, 0}) If you run: nohup mtr -c 1 --split 8.8.8.8 < /dev/null > /dev/null 2>&1 & you get the same strace pattern and it never returns. |
I've fixed a bug that might present itself just like this "for macos". But I suspect I may have fixed it for you as well. Are you running the latest version? When select returns '1 (in[0])' the code can only do one thing, and that is issue a READ to filedescriptor zero. |
I've looked at the "split.c" code, and it had a similar bug to what caused problems on macos. Fixed now. (I like single-line-fixes). Still I can't reproduce your failure mode with the new or before-fix code. |
There was a circumstance in which I was also seeing a read(0...) but I can't seem to recreate that at the moment. I've tried with two versions of mtr: 0.86 and 0.92.25-fd41 (which is latest). The fast loop around a select is a constant though. |
I'll spin something fresh up & see if I can reproduce on that - if I can I'll send you creds to log in. |
I have set up a vm on which I've been able to re-create the problem with both the latest (from git) code and with the distribution's default package. The older version is just a fast loop around: select(10, [0 6 8 9], [], NULL, {0, 0}) = 1 (in [0], left {0, 0}) The latest version presents with two pids - one a child of another. The one that's taking a bunch of cpu is doing this: select(8, [0 5 7], [], NULL, {0, 0}) = 1 (in [0], left {0, 0}) I have set up a login on the host for you with sudo. I will send a private message with credentials. Feel free to login at your convenience. |
Hm ok I guess I can't send a private message - is there some other way? Edit/answer by REW: If you do a git clone, you can look in the commit messages to find Email addresses. |
rewolff - if you're on freenode, I'm dparker & I'm in #mtr right now - If you go there I'll send you the creds in a pm |
I was just looking at split.c - if that's where this is looping, I think maybe what's required is a new command line switch to just run without any option for interaction. The use case is this: I need to run a daemon (background, nohup) that repeatedly traces to an IP (-c 1). I'm taking the stdout from that and sending to logstash and from there to elasticsearch. This helped me track down a problem with thrashing routes and probably will be a useful tool going forward. However the inability to run mtr under nohup etc keeps me from being able to fire and forget - I have to leave a console open. |
Can you try again with the LATEST git. :-) |
I pulled and rebuilt:
Foreground:
nohup foreground:
nohup background:
|
rewolff I sent you an email |
In split-mode, mtr monitors the input for some commands, and you are trying to make it read from an unreadable source. If it was supposed to get the output in a file, you would try that in report/raw modes. |
yvs2014 ah ok - I guess that was what I was missing (it doesn't really say that in the man page). I'll rework my stuff to use the raw format. Thanks - closing. |
WAIT WAIT! You, if I analyzed this correctly, made MTR hang instead of doing the right thing. The way I fixed it, I think it will now quit, correct? Are you seeing that too? Even if you're going to make use of a different mode, I would like this bug fixed anyway. |
rewolff - it did in fact quit, yes. The series of tests I showed illustrate that. So yes I think with your change it's now doing the right thing. |
Hi, did you solve this problem? How? |
I converted everything to the --raw format. --raw is really the only
option mtr has for non-interactive operation. --report was coded with the
idea in mind that it's running underneath some interactive thing.
…--raw is kind of a pita - you have to get your head into what's going on a
bit more than you do with --report, but you could probably say that falls
into "with great power comes great responsibility". Good luck.
On Sat, Jan 6, 2018 at 2:17 AM, AlexTan-b-z ***@***.***> wrote:
Hi, did you solve this problem? How?
I have the same problem.
Can you help me? Thank you!
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#231 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAfPIdNnHh4u99MyOq3WeFB7-4cjr5AFks5tHywxgaJpZM4Qk-wf>
.
|
As far as I know, --report is meant to run an mtr scan say every hour from cron. So why are you saying otherwise? |
Thank you very much! |
I've come across two instances - one on an older ubuntu intel and on an a very old sparc solaris - where attempting to run a loop around "mtr -c 1" in a backgrounded nohupped job with output & err > /dev/null and input < /dev/null leads to mtr sitting in the background doing apparently nothing (save for I think periodically checking a filehandle with a select call). I've tried all kinds of permutations and tricks & am becoming really puzzled by this. Am I doing something wrong or is there something keeping it from working in that context?
The text was updated successfully, but these errors were encountered: