Menu

#47 Interpolated config options become "hard coded" in Windows

closed-fixed
nobody
None
5
2012-02-12
2011-11-07
mkeefe
No

When installing a service on Windows, any property that was interpolated is added as a command-line option to the service launcher. For example, our wrapper.conf file has something like the following:

java_home=C:/y/java/jdk_1.6.0_25

wrapper.java.command=${java_home}/bin/java.exe

The registry shows the service command as:

"C:/y/java/jdk_1.6.0_25/bin/java.exe" "-classpath" "Y:\yajsw-beta-10.6\wrapper.jar" "-Xrs" "-Dwrapper.service=true" "-Dwrapper.java.command=C:/y/java/jdk_1.6.0_25/bin/java.exe" "-Dwrapper.config=C:\Users\usr\Desktop\service_test\startup.conf" "-Dwrapper.additional.1x=-Xrs" "org.rzo.yajsw.boot.WrapperServiceBooter"

Notice that it contains "-Dwrapper.java.command=..." As a result, "wrapper.java.command" is included in the configuration twice, with the value passed in on the command line taking precedence. If wrapper.java.command is set directly like this:

wrapper.java.command = C:/y/java/jdk_1.6.0_25/bin/java.exe

Then the service command becomes:

"C:/y/java/jdk_1.6.0_25/bin/java.exe" "-classpath" "Y:\yajsw-beta-10.6\wrapper.jar" "-Xrs" "-Dwrapper.service=true" "-Dwrapper.config=C:\Users\usr\Desktop\service_test\startup.conf" "-Dwrapper.additional.1x=-Xrs" "org.rzo.yajsw.boot.WrapperServiceBooter"

Notice that "-Dwrapper.java.command=..." is missing.

This forces us to reinstall the service whenever we want to change the value of "wrapper.java.command" or any other property which was constructed via interpolation when the service was first installed. Since the behavior is different between Windows and Linux, I believe this is a bug.

Thanks.

Discussion

  • rzo

    rzo - 2011-11-08

    hello,

    this is not a bug, but a feature.
    the idea behind it is the following:
    - when installing a service the user is logged on on a certain user. However services run on the system user. Settings/env vars which are available for the logged on user may not be available or may be differently set for the system user.

    - services are supposed to run unattended. this may be compromised by users installing new software, which may change the environement, possibly resulting in errors when the service is started.

    "remembering" interpolations assures that the service is run with the same settings as when it was installed.

    There are cases however cases, where this feature is not desired.
    The solution will be to add a configuration property to control this feature.

    -- Ron

     
  • rzo

    rzo - 2011-11-08

    PS: the behavior should be platform independet. I will have to check this.

     
  • mkeefe

    mkeefe - 2011-11-08

    Thanks Ron. Making this configurable is perfect.

     
  • rzo

    rzo - 2012-02-12

    resolved in release stable-11.0

     
  • rzo

    rzo - 2012-02-12
    • status: open --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB