Skip to content

"hostname" program is called every time the config is read #31

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

Closed
raskig opened this issue Dec 13, 2016 · 3 comments
Closed

"hostname" program is called every time the config is read #31

raskig opened this issue Dec 13, 2016 · 3 comments

Comments

@raskig
Copy link

raskig commented Dec 13, 2016

We are using Nomad for retrieving config every time an endpoint is called of a web service. As we see from the logs, every time the config is read the "hostname" in shell is also called. This results in the following error after a while:
"java.io.IOException: Cannot run program "hostname": error=24, Too many open files"
Please confirm that this is a valid bug.
Thanks,
Gabor

@jarohen
Copy link
Owner

jarohen commented Dec 13, 2016

Hi @raskig, thanks for the report.

I don't think this is an issue with Nomad - it doesn't hold any open files after the call to hostname. Have you got a trace that shows whether there are multiple lingering hostname processes?

James

@raskig
Copy link
Author

raskig commented Dec 13, 2016

Hi @jarohen,
I think it is enough if it calls the "hostname" every time. My understanding is that the operation system will run out of file descriptors after a while when the load is high..

This is the exception we face after a while:

@40000000584fb9a93503e44c java.io.IOException: Cannot run program "hostname": error=24, Too many open files
@40000000584fb9a93503f7d4 	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047) ~[na:1.7.0_111]
@40000000584fb9a93503f7d4 	at java.lang.Runtime.exec(Runtime.java:617) ~[na:1.7.0_111]
@40000000584fb9a93503fbbc 	at clojure.java.shell$sh.doInvoke(shell.clj:116) ~[cljrc-web-120-standalone.jar:na]
@40000000584fb9a93503fbbc 	at clojure.lang.RestFn.invoke(RestFn.java:408) ~[cljrc-web-120-standalone.jar:na]
    @40000000584fb9a93504038c 	at nomad$get_hostname.invoke(nomad.clj:43) ~[cljrc-web-  120-standalone.jar:na]
    @40000000584fb9a93504038c 	at nomad$update_config.invoke(nomad.clj:168) ~[cljrc-web-120-standalone.jar:na]
@40000000584fb9a93504038c 	at nomad$read_config.doInvoke(nomad.clj:181) ~[cljrc-web-120-standalone.jar:na]

I was able to reproduce the problem by using a load test. By applying a quick fix (wrapping the (config) call in a (memoize config) ) it fixes the problem, but of course we loose the ability to change the config on the fly.

Hope this all makes sense.

@jarohen
Copy link
Owner

jarohen commented Dec 16, 2016

Hi @raskig - as luck would have it, I've just received a PR changing the implementation to use Java interop rather than shelling out (#32). Have released 0.7.3 with that change - does that work for you?

@jarohen jarohen closed this as completed Jul 17, 2018
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

No branches or pull requests

2 participants