-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Quote the file path to the Ruby bin directory when starting fluentd as a windows service #1536
Conversation
… windows service. The the file path is passed to win32-service (which calls windows functions CreateService[1]) and to Process.spawn [2]. Both require spaces to be wrapped in quotes or windows will not properly handle them. Without this fix fluentd will fail fail when initilizing or when starting. [1]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682450(v=vs.85).aspx [2]: https://ruby-doc.org/core-2.2.0/Process.html#method-c-spawn
@nurse How about this? |
It does not have a function that I am aware of. |
@repeatedly instead of passing argv as single string, just pass them as array. |
@iantalarico Could you try convert single string to array? |
@repeatedly @nurse I gave this a try but was unable to make it work. Looking the documentation it looks like if I don't just pass a command line string it does not use the shell and will try to execute a built in command. I'm guessing this may not work if we are passing a path to an exe as the command. |
@iantalarico Where and How it failed. I thought both |
@nurse It fails on Process.spawn. If the path is quoted we get the error "Invalid argument - "C:/Program Files (x86)/TestDir/bin/ruby.exe"" If the path is unquoted we get the error "No such file or directory - OpenEvent" I don't think it's and issue with the path I think it's an issue of what Process.spawn expects when we pass the command and an array. |
@iantalarico How did you quote? |
@nurse I tried: |
@iantalarico Could you show with Process.spawn(... )? |
@nurse |
is correct. |
@nurse Yea I was wrong only the first one was failing on process spawn the second one fails on event open: "C:/Program Files (x86)/TestDir/lib/ruby/gems/2.3.0/gems/win32-event-0.6.3/lib/win32/event.rb:125:in It looks like the service is failing in some way in the daemon. I can dig more into this if need be but I don't see a problem with just passing a command line string? |
@iantalarico Anyway I need full backtrace of the error. |
@nurse I think that was the full backtrace. I did "err.backtrace.inspect" |
After fixed this problem, I will release new v0.14. |
@nurse Is the original backtrace I sent okay? Are you okay with the fix as is? This is essentially what was being done before. If not I can dig into this more. |
@iantalarico Backtrace is OK. |
@nurse It looks like I get the same backtrace: C:/Program Files (x86)/TestDir/lib/ruby/gems/2.3.0/gems/win32-event-0.6.3/lib/win32/event.rb:125:in open'" "winsvc.rb:59:inservice_stop'", "C:/Program Files (x86)/TestDir/lib/ruby/gems/2.3.0/gems/win32-service-0.8.10/lib/win32/daemon.rb:309:in `block in mainloop'" |
Hmm, it is not sufficient to investigate the issue. It seems to need more digging... |
@nurse I'm happy to dig more into this but why is the current solution not acceptable? This is what the current code is doing. |
@iantalarico Ah, I wrongly saw CI is failing but it looks false-positive. @repeatedly Could you merge this if CI is ok. |
@nurse Alright thanks. As I said I am happy to look into the array solution more if you feel strongly going that route. |
Thanks for your work 👍 |
The the file path is passed to win32-service (which calls windows functions CreateService) and to Process.spawn. Both require spaces to be wrapped in quotes or windows will not properly handle them.
Without this fix fluentd will fail fail when initializing or when starting with a ruby directory that contains spaces.