Skip to content

Commit

Permalink
build: add random seed lockup workaround to all exec scripts and ant
Browse files Browse the repository at this point in the history
  • Loading branch information
pplx committed Aug 9, 2019
1 parent 9abf73a commit 92bdaec
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 55 deletions.
91 changes: 41 additions & 50 deletions build.xml
Expand Up @@ -72,7 +72,10 @@ code package.
<propertyref name="ivy.settings.file"/>
<propertyref name="checkreqs.ran"/>
</propertyset>


<!-- Random seed, workaround for lockups on some systems -->
<property name="scipio.exec.os.linux.randseed" value="file:///dev/./urandom"/>

<!-- Dynamic early main build.xml additions. Allows any component or addon to include
a file named "build-main-early.xml" in its folder, which will be imported into
the main build, supporting plugin-like additions to root build.xml.
Expand Down Expand Up @@ -1109,8 +1112,7 @@ code package.
<!-- Start and Stop OFBiz -->
<!-- ================================================================== -->

<!-- SCIPIO: ofbiz.jar exec macro - generic, factors out jvmargs common to ALL start tasks (added 2017-09-08, for solr)
TODO?: is not as versatile or friendly as it could be; didn't want to refactor all the task xml at this time -->
<!-- SCIPIO: ofbiz.jar exec macro - generic, factors out jvmargs common to ALL start tasks (added 2017-09-08, for solr) -->
<macrodef name="exec-scipio-jar">
<attribute name="action" default=""/>
<attribute name="fork" default="true"/>
Expand All @@ -1137,54 +1139,43 @@ code package.
<equals arg1="@{action}" arg2="load-data"/>
<then><var name="exec-scipio-jar.component" value="${component}" if:set="component"/></then>
</if>
<!-- Main invocation -->
<if><!-- FIXME: get rid of this copy-paste with ant 1.9.3... -->
<var name="scipio.exec.os.linux.randseed.set" unset="true"/>
<condition property="scipio.exec.os.linux.randseed.set">
<and>
<os family="unix"/>
<not><equals arg1="${scipio.exec.os.linux.randseed}" arg2=""/></not>
<not><equals arg1="${scipio.exec.os.linux.randseed}" arg2="-"/></not>
</and>
</condition>
<var name="scipio.exec.secure" unset="true"/>
<condition property="scipio.exec.secure">
<equals arg1="@{secure}" arg2="true"/>
<then>
<java jar="ofbiz.jar" fork="@{fork}" spawn="@{spawn}" resultproperty="@{resultproperty}">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<jvmarg value="-javaagent:${ofbiz.home.dir}/tools/security/notsoserial/notsoserial-1.0-SNAPSHOT.jar"/>
<jvmarg value="-Dnotsoserial.whitelist=${ofbiz.home.dir}/tools/security/notsoserial/empty.txt"/>
<jvmarg value="-Dnotsoserial.dryrun=${ofbiz.home.dir}/tools/security/notsoserial/is-deserialized.txt"/>
<jvmarg value="-Dnotsoserial.trace=${ofbiz.home.dir}/tools/security/notsoserial/deserialize-trace.txt"/>
<!-- SCIPIO: solr home -->
<jvmarg value="-Dsolr.solr.home=${solr.home}"/>
<jvmarg value="-Dsolr.log.dir=${solr.log.dir}"/>
<jvmarg value="-Dsolr.lock.type=${solr.lock.type}"/>
<jvmarg value="-Ddisable.configEdit=${solr.disable.configEdit}"/>
<jvmarg value="-Dscipio.solr.reindex.startup.force=${scipio.solr.reindex.startup.force}"/>
<!-- SCIPIO: Uncomment to specify a java.util.logging config for Tomcat (non-log4j)
<jvmarg value="-Djava.util.logging.config.file=${ofbiz.home.dir}/framework/base/config/logging.properties"/>-->
<syspropertyset>
<propertyref prefix="scipio."/>
</syspropertyset>
<arg value="${exec-scipio-jar.action}" if:set="exec-scipio-jar.action"/>
<arg value="component=${exec-scipio-jar.component}" if:set="exec-scipio-jar.component"/>
<args/>
</java>
</then>
<else>
<java jar="ofbiz.jar" fork="@{fork}" spawn="@{spawn}" resultproperty="@{resultproperty}">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<!-- SCIPIO: solr home -->
<jvmarg value="-Dsolr.solr.home=${solr.home}"/>
<jvmarg value="-Dsolr.log.dir=${solr.log.dir}"/>
<jvmarg value="-Dsolr.lock.type=${solr.lock.type}"/>
<jvmarg value="-Ddisable.configEdit=${solr.disable.configEdit}"/>
<jvmarg value="-Dscipio.solr.reindex.startup.force=${scipio.solr.reindex.startup.force}"/>
<!-- SCIPIO: Uncomment to specify a java.util.logging config for Tomcat (non-log4j)
<jvmarg value="-Djava.util.logging.config.file=${ofbiz.home.dir}/framework/base/config/logging.properties"/>-->
<syspropertyset>
<propertyref prefix="scipio."/>
</syspropertyset>
<arg value="@{action}" if:set="exec-scipio-jar.action"/>
<arg value="component=${component}" if:set="exec-scipio-jar.component"/>
<args/>
</java>
</else>
</if>
</condition>
<!-- Main invocation -->
<java jar="ofbiz.jar" fork="@{fork}" spawn="@{spawn}" resultproperty="@{resultproperty}">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<jvmarg value="-javaagent:${ofbiz.home.dir}/tools/security/notsoserial/notsoserial-1.0-SNAPSHOT.jar" if:set="scipio.exec.secure"/>
<jvmarg value="-Dnotsoserial.whitelist=${ofbiz.home.dir}/tools/security/notsoserial/empty.txt" if:set="scipio.exec.secure"/>
<jvmarg value="-Dnotsoserial.dryrun=${ofbiz.home.dir}/tools/security/notsoserial/is-deserialized.txt" if:set="scipio.exec.secure"/>
<jvmarg value="-Dnotsoserial.trace=${ofbiz.home.dir}/tools/security/notsoserial/deserialize-trace.txt" if:set="scipio.exec.secure"/>
<!-- SCIPIO: random lockup workaround -->
<jvmarg value="-Djava.security.egd=${scipio.exec.os.linux.randseed}" if:set="scipio.exec.os.linux.randseed.set"/>
<!-- SCIPIO: solr home -->
<jvmarg value="-Dsolr.solr.home=${solr.home}"/>
<jvmarg value="-Dsolr.log.dir=${solr.log.dir}"/>
<jvmarg value="-Dsolr.lock.type=${solr.lock.type}"/>
<jvmarg value="-Ddisable.configEdit=${solr.disable.configEdit}"/>
<jvmarg value="-Dscipio.solr.reindex.startup.force=${scipio.solr.reindex.startup.force}"/>
<!-- SCIPIO: Uncomment to specify a java.util.logging config for Tomcat (non-log4j)
<jvmarg value="-Djava.util.logging.config.file=${ofbiz.home.dir}/framework/base/config/logging.properties"/>-->
<syspropertyset>
<propertyref prefix="scipio."/>
</syspropertyset>
<arg value="@{action}" if:set="exec-scipio-jar.action"/>
<arg value="component=${component}" if:set="exec-scipio-jar.component"/>
<args/>
</java>
</sequential>
</macrodef>

Expand Down
3 changes: 2 additions & 1 deletion start.sh
Expand Up @@ -21,10 +21,11 @@ rm -f $OFBIZ_LOG
#IPADDR=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
#RMIIF="-Djava.rmi.server.hostname=$IPADDR"
MEMIF="-Xms128M -Xmx3512M"
RNDFIX="-Djava.security.egd=file:///dev/./urandom"
#JMX="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=33333 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
#MISC="-Duser.language=en"
MISC="-Dsolr.solr.home=applications/solr/ -Dsolr.log.dir=runtime/logs/solr/ -Dsolr.lock.type=single"
VMARGS="$MEMIF $MISC $JMX $DEBUG $RMIIF"
VMARGS="$MEMIF $RNDFIX $MISC $JMX $DEBUG $RMIIF"

# Worldpay Config
#VMARGS="-Xbootclasspath/p:applications/accounting/lib/cryptix.jar $VMARGS"
Expand Down
2 changes: 1 addition & 1 deletion stop.sh
Expand Up @@ -12,5 +12,5 @@ else
JAVA=java
fi

$JAVA -jar ofbiz.jar -shutdown
$JAVA -Djava.security.egd=file:///dev/./urandom -jar ofbiz.jar -shutdown

2 changes: 1 addition & 1 deletion tools/scripts/rc.scipio
Expand Up @@ -30,7 +30,7 @@ SCIPIO_HOME=/home/scipio/scipioce
JAVA_VMOPTIONS="-Xms128M -Xmx3512M -XX:MaxPermSize=1024m"

# Java arguments
JAVA_ARGS="-jar ofbiz.jar"
JAVA_ARGS="-Djava.security.egd=file:///dev/./urandom -jar ofbiz.jar"

# *nix user ofbiz should run as (you must create this user first)
SCIPIO_USER=scipio
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/rc.scipio.for.debian
Expand Up @@ -30,7 +30,7 @@ SCIPIO_HOME=/home/ofbiz/ofbiz
JAVA_VMOPTIONS="-Xms128M -Xmx3512M -XX:MaxPermSize=1024m"

# Java arguments
JAVA_ARGS="-jar ofbiz.jar"
JAVA_ARGS="-Djava.security.egd=file:///dev/./urandom -jar ofbiz.jar"

# *nix user scipio should run as (you must create this user first)
SCIPIO_USER=scipio
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/scipio.service
Expand Up @@ -7,7 +7,7 @@ Requires=network-online.target
User=scipio
Group=scipio
WorkingDirectory=/home/scipio/scipioce-dev
ExecStart=/bin/sh -c "exec /usr/java/latest/bin/java -Dsolr.solr.home=applications/solr/ -Dsolr.log.dir=runtime/logs/solr/ -jar /home/scipio/scipioce-dev/ofbiz.jar"
ExecStart=/bin/sh -c "exec /usr/java/latest/bin/java -Djava.security.egd=file:///dev/./urandom -Dsolr.solr.home=applications/solr/ -Dsolr.log.dir=runtime/logs/solr/ -jar /home/scipio/scipioce-dev/ofbiz.jar"
ExecStop=/bin/kill $MAINPID
SuccessExitStatus=143
KillMode=process
Expand Down

0 comments on commit 92bdaec

Please sign in to comment.