[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-9283?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15142062#comment-15142062
 ] 

ASF GitHub Bot commented on CLOUDSTACK-9283:
--------------------------------------------

Github user bhaisaab commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1409#discussion_r52551673
  
    --- Diff: packaging/systemd/cloudstack-usage.service ---
    @@ -27,10 +27,11 @@ Environment=JAVA_HOME=/usr/lib/jvm/jre
     Environment=JAVA_HEAP_INITIAL=256m
     Environment=JAVA_HEAP_MAX=2048m
     Environment=JAVA_CLASS=com.cloud.usage.UsageServer
    +Environment=JAVA_PID=$$
     ExecStart=/bin/sh -ec '\
         export UCP=`ls /usr/share/cloudstack-usage/cloud-usage-*.jar 
/usr/share/cloudstack-usage/lib/*.jar | tr "\\n" ":"`; \
         export 
CLASSPATH="$UCP:/etc/cloudstack/usage:/usr/share/java/mysql-connector-java.jar";
 \
    -    ${JAVA_HOME}/bin/java -Xms${JAVA_HEAP_INITIAL} -Xmx${JAVA_HEAP_MAX} 
-cp "$CLASSPATH" $JAVA_CLASS'
    +    ${JAVA_HOME}/bin/java -Dpid=${JAVA_PID} -Xms${JAVA_HEAP_INITIAL} 
-Xmx${JAVA_HEAP_MAX} -cp "$CLASSPATH" $JAVA_CLASS'
    --- End diff --
    
    LGTM (did not test by creating packages and installing it though)


> cloudstack-usage fails to start throwing Integer exception during PID 
> retrieval
> -------------------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-9283
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9283
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: Usage
>    Affects Versions: 4.7.0
>         Environment: CentOS 7, systemd, packages from official repo
>            Reporter: Linas Žilinskas
>            Assignee: David Amorim Faria
>
> I have very little knowledge of java, but I looked at the code where the 
> exception is thrown. The code is 
> {code}_pid = Integer.parseInt(System.getProperty("pid"));{code} 
> Based on the information I found, I guess the command line requires -Dpid=$$ 
> to be passed, which isn't. I modified the systemd service to include the 
> parameter and service now starts. I'm not sure if this is something specific 
> to my environment or not, but seems strange that this could go unnoticed.
> {code}
> 12:49:27,981 DEBUG UsageManagerImpl:187 - Checking to see if usage.vmops.pid 
> exists.
> 12:49:27,982  INFO UsageManagerImpl:195 - Implementation Version is 4.7.0
> 12:49:28,737 DEBUG UsageManagerImpl:218 - Usage stats aggregation time zone: 
> GMT
> 12:49:28,738 DEBUG UsageManagerImpl:250 - Execution Time: Wed Feb 10 12:25:00 
> UTC 2016
> 12:49:28,738 DEBUG UsageManagerImpl:252 - Current Time: Wed Feb 10 12:49:28 
> UTC 2016
> java.lang.NumberFormatException: null
>         at java.lang.Integer.parseInt(Integer.java:542)
>         at java.lang.Integer.parseInt(Integer.java:615)
>         at 
> com.cloud.usage.UsageManagerImpl.configure(UsageManagerImpl.java:267)
>         at 
> com.cloud.utils.component.ComponentContext.initComponentsLifeCycle(ComponentContext.java:116)
>         at com.cloud.usage.UsageServer.start(UsageServer.java:61)
>         at com.cloud.usage.UsageServer.main(UsageServer.java:47)
> 12:49:28,745 DEBUG DefaultListableBeanFactory:243 - Returning cached instance 
> of singleton bean 'usageManagerImpl'
> 12:49:28,745  INFO UsageServer:70 - UsageServer ready...
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to