GabrielBrascher commented on issue #3207: Fix #3203 usage server broken in 
4.11/4.12
URL: https://github.com/apache/cloudstack/pull/3207#issuecomment-471539732
 
 
   
   @wido, as far as I know, the implementation used the pid to have a unique id 
regarding the cloudstack-usage.service (in case of multiple cloudstack-usage 
nodes running). To change this approach some refactoring is needed.
   
   Regarding the codebase (prior to this PR), the exception was happening at 
line 274 from UsageManagerImpl.java.
   `_pid = Integer.parseInt(System.getProperty("pid"));` and silenced at the 
UsageServer as it would print the stack only in case of running the service 
from the command line and not a systemd service (which was not the case for any 
of us). Explaining why the usage.log  did not print details and/or an exception.
   
   ```
   try {
       ComponentContext.initComponentsLifeCycle();
   } catch (Exception e) {
       e.printStackTrace();
   }
   ```
   
   If the _pid is not a valid pid for the service (for instance zero) the 
runInContextInternal execution flow is ignored.
   
   
https://github.com/apache/cloudstack/blob/1d05fead49f5c856257a741b07122f5633d2e359/usage/src/main/java/com/cloud/usage/UsageManagerImpl.java#L353
   
https://github.com/apache/cloudstack/blob/1d05fead49f5c856257a741b07122f5633d2e359/usage/src/main/java/com/cloud/usage/UsageManagerImpl.java#L354

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to