Reworked POSIX Launcher #1548

Merged
merged 26 commits into from Jun 26, 2016

Conversation

Projects
None yet
5 participants
@rhwood
Contributor

rhwood commented Jun 21, 2016

  • Implements classpath and option handling as outlined in #1472.
    • Adds arguments for appending or prepending JARs to classpath.
    • Sources settings:jmri.conf for persistent arguments.
  • Implements a variation of #1382.
    • Uses JVM default Xmx value if larger than 768MB
    • Uses 3/4 of RAM for Xmx if total RAM less than or equal to 1GB
    • Uses 1/2 of RAM for Xmx if total RAM between 1 to 3 GB
    • This translates into:
      • 32-bit OSes get maximum of 1.5GB for Xmx of RAM unless using a PAE kernel
      • 64-bit OSes get 1/4 of RAM for Xmx unless they have less than 3 GB of RAM installed
      • A Raspberry PI 3 gets 768MB Xmx

rhwood added some commits Jun 11, 2016

Always set DEBUG
Our checks for $DEBUG are all ```[ -n “${DEBUG}” ]``` which is true iff
```“${DEBUG}”``` evaluates to a non-empty string, so we can always have
DEBUG set without ill side effects.
Empty whitespace at end of lines removed.
Updates to support conf file.
Really too many:
- documentation reflects what can be set in conf file
- parsing is in separate function so conf file and CLI args can be
parsed the same
- memory values are set separately and can be overridden by user
- append/prepend elements to classpath
Set Xmx using algorithm only if specified by JVM is too small
Also use only a single bash expression to capture command output
```$(``` instead of both ```$(``` and ``` ` ```.
Extensive documentation of memory handling
- Set default RAM after setting DEBUG, but before parsing arguments
- Document defaults, calculations, overrides of Xmx, Xms settings
- Parse JMRI_OPTIONS same as CLI arguments, default_options
Set settings dir for both launcher and JMRI.
If ```--settingsdir=…``` is passed to the launcher, ensure both the
launcher’s internal knowledge and the Java ```jmri.prefsdir``` system
property are both set.
Document startup options
Instead of documenting the flow of the POSIX launcher script, document
the options passed to it.
Ensure variables are set.
Only determine default memory values after reading parameters.
Variable expansion is strange.
- Ensure CONFIGFILE is always defined
- ```~``` only expands if not inside quotes, so use ${HOME} instead

@rhwood rhwood added the Enhancement label Jun 21, 2016

@rhwood rhwood added this to the 4.5.1 milestone Jun 21, 2016

Add default jmri.conf file to distribution.
Also remove trailing whitespace in build.xml

@rhwood rhwood added the WIP label Jun 21, 2016

rhwood added some commits Jun 22, 2016

@rhwood

This comment has been minimized.

Show comment
Hide comment
@rhwood

rhwood Jun 22, 2016

Contributor

Can this please be tested on older versions of OS X and Linux before merging? I have tested it on CentOS 7 and OS X 10.11.5.

Contributor

rhwood commented Jun 22, 2016

Can this please be tested on older versions of OS X and Linux before merging? I have tested it on CentOS 7 and OS X 10.11.5.

@bobjacobsen

This comment has been minimized.

Show comment
Hide comment
@bobjacobsen

bobjacobsen Jun 22, 2016

Member

Should I make a set of installers with this? That'll make it easy to have a couple users test it.

Member

bobjacobsen commented Jun 22, 2016

Should I make a set of installers with this? That'll make it easy to have a couple users test it.

@rhwood

This comment has been minimized.

Show comment
Hide comment
@rhwood

rhwood Jun 22, 2016

Contributor

@bobjacobsen That would probably be best. Thank you.

Contributor

rhwood commented Jun 22, 2016

@bobjacobsen That would probably be best. Thank you.

@bobjacobsen

This comment has been minimized.

Show comment
Hide comment
@bobjacobsen

bobjacobsen Jun 22, 2016

Member

Jenkins has an installer build task running against your repository fork. First files should be done soon.

Member

bobjacobsen commented Jun 22, 2016

Jenkins has an installer build task running against your repository fork. First files should be done soon.

@dheap

This comment has been minimized.

Show comment
Hide comment
@dheap

dheap Jun 23, 2016

Contributor

Tested with Mac Pro running Mavericks 10.9.5 and both Java 8 and Java 6 installed.

Tested both NCE Power Pro serial and SPROG, connections fine, port selection fine, able to read from ESU decoder.

Revealed some preference manager issues, probably not related to the script. Attached logs and settings: zip file but probably needs a new issue created.

2016-06-23 19:06:28,589 util.Log4JUtil INFO - ****** JMRI log ******* [main]
2016-06-23 19:06:30,663 util.Log4JUtil INFO - This log is appended to file: /Users/heap/Library/Preferences/JMRI/log/messages.log [main]
2016-06-23 19:06:30,665 util.Log4JUtil INFO - This log is stored in file: /Users/heap/Library/Preferences/JMRI/log/session.log [main]
2016-06-23 19:06:30,675 apps.AppsBase INFO - DecoderPro version 4.5.1-Rc2c191b starts under Java 1.8.0_91 on Mac OS X x86_64 v10.9.5 at Thu Jun 23 19:06:30 AEST 2016 [main]
2016-06-23 19:06:31,019 gui3.Apps3 INFO - Starting with profile NCE_Power_Pro.3f45d335 [main]
2016-06-23 19:06:31,120 node.NodeIdentity INFO - Using jmri-70CD60AACEA6-3f45d335 as the JMRI Node identity [main]
2016-06-23 19:06:31,182 managers.JmriUserPreferencesManager WARN - java.lang.NoSuchMethodException: apps.AppConfigBase.setMessagePreferencesDetails() [main]
2016-06-23 19:06:31,458 serialdriver.SerialDriverAdapter INFO - NCE /dev/cu.usbserial-FTFVOF0P port opened at 9600 baud [main]
2016-06-23 19:06:31,580 nce.NceConnectionStatus INFO - NCE EPROM revision = 6.2.2 [AWT-EventQueue-0]
2016-06-23 19:06:32,351 configurexml.CreateButtonModelXml ERROR - Exception while performing startup action for class: jmri.jmrix.nce.cab.NceShowCabPanel$Default [main]
java.lang.NullPointerException
at apps.startup.StartupActionModelUtil.getActionName(StartupActionModelUtil.java:46)
at apps.startup.StartupActionModelUtil.getActionName(StartupActionModelUtil.java:53)
at apps.startup.AbstractActionModel.getName(AbstractActionModel.java:28)
at apps.startup.AbstractActionModel.toString(AbstractActionModel.java:62)
at apps.configurexml.CreateButtonModelXml.load(CreateButtonModelXml.java:85)
at apps.StartupActionsManager.lambda$0(StartupActionsManager.java:71)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at apps.StartupActionsManager.initialize(StartupActionsManager.java:64)
at jmri.implementation.JmriConfigurationManager.initializeProvider(JmriConfigurationManager.java:249)
at jmri.implementation.JmriConfigurationManager.lambda$1(JmriConfigurationManager.java:178)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at jmri.implementation.JmriConfigurationManager.load(JmriConfigurationManager.java:177)
at jmri.implementation.JmriConfigurationManager.load(JmriConfigurationManager.java:166)
at jmri.implementation.JmriConfigurationManager.load(JmriConfigurationManager.java:156)
at apps.AppsBase.setAndLoadPreferenceFile(AppsBase.java:270)
at apps.gui3.Apps3.setAndLoadPreferenceFile(Apps3.java:351)
at apps.AppsBase.(AppsBase.java:102)
at apps.gui3.Apps3.(Apps3.java:81)
at apps.gui3.dp3.DecoderPro3.(DecoderPro3.java:35)
at apps.gui3.dp3.DecoderPro3.main(DecoderPro3.java:109)
2016-06-23 19:06:33,597 util.FileUtilSupport INFO - File path program: is /Volumes/JMRI 4.5.1-Rc2c191b/JMRI/ [main]
2016-06-23 19:06:33,600 util.FileUtilSupport INFO - File path preference: is /Ours/Our Documents/Dave/Dropbox/JMRI/ [main]
2016-06-23 19:06:33,603 util.FileUtilSupport INFO - File path profile: is /Users/heap/Library/Preferences/JMRI/NCE_Power_Pro/ [main]
2016-06-23 19:06:33,604 util.FileUtilSupport INFO - File path settings: is /Users/heap/Library/Preferences/JMRI/ [main]
2016-06-23 19:06:33,604 util.FileUtilSupport INFO - File path home: is /Users/heap/ [main]
2016-06-23 19:06:33,604 util.FileUtilSupport INFO - File path scripts: is /Volumes/JMRI 4.5.1-Rc2c191b/JMRI/jython/ [main]
2016-06-23 19:06:34,308 swing.RosterFrame ERROR - Unable to get the double click speed, Using JMRI default of half a secondjava.lang.NullPointerException [main]

2016-06-23 19:09:22,768 util.Log4JUtil INFO - ****** JMRI log ******* [main]
2016-06-23 19:09:24,746 util.Log4JUtil INFO - This log is appended to file: /Users/heap/Library/Preferences/JMRI/log/messages.log [main]
2016-06-23 19:09:24,747 util.Log4JUtil INFO - This log is stored in file: /Users/heap/Library/Preferences/JMRI/log/session.log [main]
2016-06-23 19:09:24,760 apps.AppsBase INFO - DecoderPro version 4.5.1-Rc2c191b starts under Java 1.8.0_91 on Mac OS X x86_64 v10.9.5 at Thu Jun 23 19:09:24 AEST 2016 [main]
2016-06-23 19:09:25,107 gui3.Apps3 INFO - Starting with profile SPROG.3f2bccd9 [main]
2016-06-23 19:09:25,209 node.NodeIdentity INFO - Using jmri-70CD60AACEA6-3f2bccd9 as the JMRI Node identity [main]
2016-06-23 19:09:25,332 managers.JmriUserPreferencesManager WARN - java.lang.NoSuchMethodException: apps.AppConfigBase.setMessagePreferencesDetails() [main]
2016-06-23 19:09:25,601 serialdriver.SerialDriverAdapter INFO - /dev/cu.usbmodemfd5431 port opened at 9600 baud, sees DTR: true RTS: true DSR: false CTS: true CD: false [main]
2016-06-23 19:09:27,130 util.FileUtilSupport INFO - File path program: is /Volumes/JMRI 4.5.1-Rc2c191b/JMRI/ [main]
2016-06-23 19:09:27,133 util.FileUtilSupport INFO - File path preference: is /Ours/Our Documents/Dave/Dropbox/JMRI/ [main]
2016-06-23 19:09:27,135 util.FileUtilSupport INFO - File path profile: is /Users/heap/Library/Preferences/JMRI/SPROG/ [main]
2016-06-23 19:09:27,135 util.FileUtilSupport INFO - File path settings: is /Users/heap/Library/Preferences/JMRI/ [main]
2016-06-23 19:09:27,136 util.FileUtilSupport INFO - File path home: is /Users/heap/ [main]
2016-06-23 19:09:27,136 util.FileUtilSupport INFO - File path scripts: is /Volumes/JMRI 4.5.1-Rc2c191b/JMRI/jython/ [main]
2016-06-23 19:09:27,926 swing.RosterFrame ERROR - Unable to get the double click speed, Using JMRI default of half a secondjava.lang.NullPointerException [main]

JMRI 2.zip

Contributor

dheap commented Jun 23, 2016

Tested with Mac Pro running Mavericks 10.9.5 and both Java 8 and Java 6 installed.

Tested both NCE Power Pro serial and SPROG, connections fine, port selection fine, able to read from ESU decoder.

Revealed some preference manager issues, probably not related to the script. Attached logs and settings: zip file but probably needs a new issue created.

2016-06-23 19:06:28,589 util.Log4JUtil INFO - ****** JMRI log ******* [main]
2016-06-23 19:06:30,663 util.Log4JUtil INFO - This log is appended to file: /Users/heap/Library/Preferences/JMRI/log/messages.log [main]
2016-06-23 19:06:30,665 util.Log4JUtil INFO - This log is stored in file: /Users/heap/Library/Preferences/JMRI/log/session.log [main]
2016-06-23 19:06:30,675 apps.AppsBase INFO - DecoderPro version 4.5.1-Rc2c191b starts under Java 1.8.0_91 on Mac OS X x86_64 v10.9.5 at Thu Jun 23 19:06:30 AEST 2016 [main]
2016-06-23 19:06:31,019 gui3.Apps3 INFO - Starting with profile NCE_Power_Pro.3f45d335 [main]
2016-06-23 19:06:31,120 node.NodeIdentity INFO - Using jmri-70CD60AACEA6-3f45d335 as the JMRI Node identity [main]
2016-06-23 19:06:31,182 managers.JmriUserPreferencesManager WARN - java.lang.NoSuchMethodException: apps.AppConfigBase.setMessagePreferencesDetails() [main]
2016-06-23 19:06:31,458 serialdriver.SerialDriverAdapter INFO - NCE /dev/cu.usbserial-FTFVOF0P port opened at 9600 baud [main]
2016-06-23 19:06:31,580 nce.NceConnectionStatus INFO - NCE EPROM revision = 6.2.2 [AWT-EventQueue-0]
2016-06-23 19:06:32,351 configurexml.CreateButtonModelXml ERROR - Exception while performing startup action for class: jmri.jmrix.nce.cab.NceShowCabPanel$Default [main]
java.lang.NullPointerException
at apps.startup.StartupActionModelUtil.getActionName(StartupActionModelUtil.java:46)
at apps.startup.StartupActionModelUtil.getActionName(StartupActionModelUtil.java:53)
at apps.startup.AbstractActionModel.getName(AbstractActionModel.java:28)
at apps.startup.AbstractActionModel.toString(AbstractActionModel.java:62)
at apps.configurexml.CreateButtonModelXml.load(CreateButtonModelXml.java:85)
at apps.StartupActionsManager.lambda$0(StartupActionsManager.java:71)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at apps.StartupActionsManager.initialize(StartupActionsManager.java:64)
at jmri.implementation.JmriConfigurationManager.initializeProvider(JmriConfigurationManager.java:249)
at jmri.implementation.JmriConfigurationManager.lambda$1(JmriConfigurationManager.java:178)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at jmri.implementation.JmriConfigurationManager.load(JmriConfigurationManager.java:177)
at jmri.implementation.JmriConfigurationManager.load(JmriConfigurationManager.java:166)
at jmri.implementation.JmriConfigurationManager.load(JmriConfigurationManager.java:156)
at apps.AppsBase.setAndLoadPreferenceFile(AppsBase.java:270)
at apps.gui3.Apps3.setAndLoadPreferenceFile(Apps3.java:351)
at apps.AppsBase.(AppsBase.java:102)
at apps.gui3.Apps3.(Apps3.java:81)
at apps.gui3.dp3.DecoderPro3.(DecoderPro3.java:35)
at apps.gui3.dp3.DecoderPro3.main(DecoderPro3.java:109)
2016-06-23 19:06:33,597 util.FileUtilSupport INFO - File path program: is /Volumes/JMRI 4.5.1-Rc2c191b/JMRI/ [main]
2016-06-23 19:06:33,600 util.FileUtilSupport INFO - File path preference: is /Ours/Our Documents/Dave/Dropbox/JMRI/ [main]
2016-06-23 19:06:33,603 util.FileUtilSupport INFO - File path profile: is /Users/heap/Library/Preferences/JMRI/NCE_Power_Pro/ [main]
2016-06-23 19:06:33,604 util.FileUtilSupport INFO - File path settings: is /Users/heap/Library/Preferences/JMRI/ [main]
2016-06-23 19:06:33,604 util.FileUtilSupport INFO - File path home: is /Users/heap/ [main]
2016-06-23 19:06:33,604 util.FileUtilSupport INFO - File path scripts: is /Volumes/JMRI 4.5.1-Rc2c191b/JMRI/jython/ [main]
2016-06-23 19:06:34,308 swing.RosterFrame ERROR - Unable to get the double click speed, Using JMRI default of half a secondjava.lang.NullPointerException [main]

2016-06-23 19:09:22,768 util.Log4JUtil INFO - ****** JMRI log ******* [main]
2016-06-23 19:09:24,746 util.Log4JUtil INFO - This log is appended to file: /Users/heap/Library/Preferences/JMRI/log/messages.log [main]
2016-06-23 19:09:24,747 util.Log4JUtil INFO - This log is stored in file: /Users/heap/Library/Preferences/JMRI/log/session.log [main]
2016-06-23 19:09:24,760 apps.AppsBase INFO - DecoderPro version 4.5.1-Rc2c191b starts under Java 1.8.0_91 on Mac OS X x86_64 v10.9.5 at Thu Jun 23 19:09:24 AEST 2016 [main]
2016-06-23 19:09:25,107 gui3.Apps3 INFO - Starting with profile SPROG.3f2bccd9 [main]
2016-06-23 19:09:25,209 node.NodeIdentity INFO - Using jmri-70CD60AACEA6-3f2bccd9 as the JMRI Node identity [main]
2016-06-23 19:09:25,332 managers.JmriUserPreferencesManager WARN - java.lang.NoSuchMethodException: apps.AppConfigBase.setMessagePreferencesDetails() [main]
2016-06-23 19:09:25,601 serialdriver.SerialDriverAdapter INFO - /dev/cu.usbmodemfd5431 port opened at 9600 baud, sees DTR: true RTS: true DSR: false CTS: true CD: false [main]
2016-06-23 19:09:27,130 util.FileUtilSupport INFO - File path program: is /Volumes/JMRI 4.5.1-Rc2c191b/JMRI/ [main]
2016-06-23 19:09:27,133 util.FileUtilSupport INFO - File path preference: is /Ours/Our Documents/Dave/Dropbox/JMRI/ [main]
2016-06-23 19:09:27,135 util.FileUtilSupport INFO - File path profile: is /Users/heap/Library/Preferences/JMRI/SPROG/ [main]
2016-06-23 19:09:27,135 util.FileUtilSupport INFO - File path settings: is /Users/heap/Library/Preferences/JMRI/ [main]
2016-06-23 19:09:27,136 util.FileUtilSupport INFO - File path home: is /Users/heap/ [main]
2016-06-23 19:09:27,136 util.FileUtilSupport INFO - File path scripts: is /Volumes/JMRI 4.5.1-Rc2c191b/JMRI/jython/ [main]
2016-06-23 19:09:27,926 swing.RosterFrame ERROR - Unable to get the double click speed, Using JMRI default of half a secondjava.lang.NullPointerException [main]

JMRI 2.zip

rhwood added some commits Jun 23, 2016

Do not call java with empty array on non-OS X systems.
Because I have barred the use of unset variables, an empty string (in
quotes) was being passed to the JVM on non-OS X systems when
DOCK_OPTIONS was empty.
Avoid this by not launching JMRI on non-OS X systems by performing a
check for OS X systems and calling java with different sets of
arguments depending on the OS (this is also how NetBeans launcher
handles this).
Avoid extraneous colons in path.
If pre_classpath and/or post_classpath were empty, colons were placed
at the beginning and end of the classpath. This change prevents that.
@rhwood

This comment has been minimized.

Show comment
Hide comment
@rhwood

rhwood Jun 23, 2016

Contributor

Historically, the launcher has included this logic:

# list of jar files in home, not counting jmri.jar
LOCALJARFILES=$( ls ${LIBDIR}/*.jar | grep -v jmri.jar | tr "\n" ":" )
if [ ${LOCALJARFILES} ] ; then
    CP="${CP}:${LOCALJARFILES}"
fi
# add jmri.jar
CP="${CP}:jmri.jar"
# and contents of lib
CP="${CP}:$( ls -m ${LIBDIR}/*.jar | tr -d ' \n' | tr ',' ':' )"

This duplicates the contents of lib before and after jmri.jar. I am inclined to simply remove the logic for creating LOCALJARFILES. Is there any reason I should not (recall that part of this exercise is encouraging users not to drop additional JAR files into lib)?

Contributor

rhwood commented Jun 23, 2016

Historically, the launcher has included this logic:

# list of jar files in home, not counting jmri.jar
LOCALJARFILES=$( ls ${LIBDIR}/*.jar | grep -v jmri.jar | tr "\n" ":" )
if [ ${LOCALJARFILES} ] ; then
    CP="${CP}:${LOCALJARFILES}"
fi
# add jmri.jar
CP="${CP}:jmri.jar"
# and contents of lib
CP="${CP}:$( ls -m ${LIBDIR}/*.jar | tr -d ' \n' | tr ',' ':' )"

This duplicates the contents of lib before and after jmri.jar. I am inclined to simply remove the logic for creating LOCALJARFILES. Is there any reason I should not (recall that part of this exercise is encouraging users not to drop additional JAR files into lib)?

@rhwood

This comment has been minimized.

Show comment
Hide comment
@rhwood

rhwood Jun 23, 2016

Contributor

@bobjacobsen Will Jenkins automatically rebuild this as changes are made?

Contributor

rhwood commented Jun 23, 2016

@bobjacobsen Will Jenkins automatically rebuild this as changes are made?

@mattharris

This comment has been minimized.

Show comment
Hide comment
@mattharris

mattharris Jun 23, 2016

Member

@rhwood Yes - it's on an hourly poll schedule at, roughly, 8 minutes past the hour.

Member

mattharris commented Jun 23, 2016

@rhwood Yes - it's on an hourly poll schedule at, roughly, 8 minutes past the hour.

@rhwood

This comment has been minimized.

Show comment
Hide comment
@rhwood

rhwood Jun 23, 2016

Contributor

@dheap your observed issues are outside the scope of this PR.

Contributor

rhwood commented Jun 23, 2016

@dheap your observed issues are outside the scope of this PR.

rhwood added some commits Jun 24, 2016

Remove obsolete VI macOS app templates.
These haven’t been used since about December 2011 and appear to have
been retained only because of CVS issues removing them.
Migrate V2 macOS app templates up one level
Move them out of the versioning scheme developed to work around a
broken SCM toolset.
@silverailscolo

This comment has been minimized.

Show comment
Hide comment
@silverailscolo

silverailscolo Jun 25, 2016

Contributor

Install of build 3 on OS X 10.11.5 completed successfully.

Contributor

silverailscolo commented Jun 25, 2016

Install of build 3 on OS X 10.11.5 completed successfully.

@rhwood rhwood merged commit fc9233b into JMRI:master Jun 26, 2016

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@rhwood

This comment has been minimized.

Show comment
Hide comment
@rhwood

rhwood Jun 26, 2016

Contributor

Testing suggests this works as intended without breaking anything existing.

Contributor

rhwood commented Jun 26, 2016

Testing suggests this works as intended without breaking anything existing.

@rhwood rhwood removed the WIP label Jul 1, 2016

@rhwood rhwood deleted the rhwood:launcher-options branch Oct 10, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment