You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "rohityadavcloud (via GitHub)" <gi...@apache.org> on 2025/03/05 05:37:00 UTC

[PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

rohityadavcloud opened a new pull request, #10500:
URL: https://github.com/apache/cloudstack/pull/10500

   This handles an NPE case for when management server host status is not found in the DB, when stopping the cluster manager.
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [x] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   - [ ] build/CI
   - [ ] test (unit or integration test code)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [x] Minor
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [x] Minor
   - [ ] Trivial
   
   ### Screenshots (if appropriate):
   
   ### How Has This Been Tested?
   
   On Mac OS, the stat collector doesn't run well as the code assumes to be running on Linux. On non-Linux env, this is easily reproducible.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500#issuecomment-2705406130

   @rohityadavcloud a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "rohityadavcloud (via GitHub)" <gi...@apache.org>.
rohityadavcloud commented on PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500#issuecomment-2701533397

   @bernardodemarco yes, I didn't sent it to 4.20 as I reckon this affects devs (on non-Linux env) than production users. But feel free to send a PR.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "rohityadavcloud (via GitHub)" <gi...@apache.org>.
rohityadavcloud commented on PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500#issuecomment-2705405509

   
   @blueorangutan package
   
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "rohityadavcloud (via GitHub)" <gi...@apache.org>.
rohityadavcloud commented on PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500#issuecomment-2700253840

   
   @blueorangutan package
   
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500#issuecomment-2699907023

   @rohityadavcloud a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500#issuecomment-2700004776

   Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 12659


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "rohityadavcloud (via GitHub)" <gi...@apache.org>.
rohityadavcloud merged PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "rohityadavcloud (via GitHub)" <gi...@apache.org>.
rohityadavcloud commented on PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500#issuecomment-2699904369

   @blueorangutan package


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "bernardodemarco (via GitHub)" <gi...@apache.org>.
bernardodemarco commented on PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500#issuecomment-2700736326

   @rohityadavcloud, I think we should also address this fix on 4.20:
   
   https://github.com/apache/cloudstack/blob/a841ed949fc6877b14cace82094abc87eca8d093/framework/cluster/src/main/java/com/cloud/cluster/ClusterManagerImpl.java#L1103-L1110
   
   What do you think?


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500#issuecomment-2700427929

   Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12661


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500#discussion_r1983230985


##########
framework/cluster/src/main/java/com/cloud/cluster/ClusterManagerImpl.java:
##########
@@ -1107,9 +1107,18 @@ public boolean stop() {
         if (_mshostId != null) {
             final ManagementServerHostVO mshost = _mshostDao.findByMsid(_msId);
             if (mshost != null) {
-                final ManagementServerStatusVO mshostStatus = mshostStatusDao.findByMsId(mshost.getUuid());
-                mshostStatus.setLastJvmStop(new Date());
-                mshostStatusDao.update(mshostStatus.getId(), mshostStatus);
+                ManagementServerStatusVO mshostStatus = mshostStatusDao.findByMsId(mshost.getUuid());
+                if (mshostStatus != null) {
+                    mshostStatus.setLastJvmStop(new Date());
+                    mshostStatusDao.update(mshostStatus.getId(), mshostStatus);
+                } else {

Review Comment:
   got it, but a warn is appropriate, isn't it?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "bernardodemarco (via GitHub)" <gi...@apache.org>.
bernardodemarco commented on PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500#issuecomment-2702466641

   > @bernardodemarco yes, I didn't send it on 4.20 branch as I reckon this affects devs (on non-Linux env) more than production users on Linux. But feel free to send a PR.
   
   Ok, got it. So, after this one gets merged, I'll backport it to the 4.20 branch in a new PR


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "rohityadavcloud (via GitHub)" <gi...@apache.org>.
rohityadavcloud commented on code in PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500#discussion_r1981814294


##########
framework/cluster/src/main/java/com/cloud/cluster/ClusterManagerImpl.java:
##########
@@ -1107,9 +1107,18 @@ public boolean stop() {
         if (_mshostId != null) {
             final ManagementServerHostVO mshost = _mshostDao.findByMsid(_msId);
             if (mshost != null) {
-                final ManagementServerStatusVO mshostStatus = mshostStatusDao.findByMsId(mshost.getUuid());
-                mshostStatus.setLastJvmStop(new Date());
-                mshostStatusDao.update(mshostStatus.getId(), mshostStatus);
+                ManagementServerStatusVO mshostStatus = mshostStatusDao.findByMsId(mshost.getUuid());
+                if (mshostStatus != null) {
+                    mshostStatus.setLastJvmStop(new Date());
+                    mshostStatusDao.update(mshostStatus.getId(), mshostStatus);
+                } else {

Review Comment:
   I got this on MacOS, so you can say it's a developer env issue than what may not happen (but could happen) on a Linux host.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "bernardodemarco (via GitHub)" <gi...@apache.org>.
bernardodemarco commented on PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500#issuecomment-2773414606

   @rohityadavcloud @weizhouapache @DaanHoogland, I've just opened a PR to backport this one onto the `4.19` branch.
   
   On https://github.com/apache/cloudstack/pull/10500#issuecomment-2702466641, I mentioned that I would backport it onto the `4.20` branch, however I think it's worth it to also include it on `4.19`. 


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "rohityadavcloud (via GitHub)" <gi...@apache.org>.
rohityadavcloud commented on PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500#issuecomment-2705404277

   @blueorangutan package


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500#issuecomment-2699929156

   ## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/10500?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   All modified and coverable lines are covered by tests :white_check_mark:
   > Project coverage is 4.00%. Comparing base [(`eab37ec`)](https://app.codecov.io/gh/apache/cloudstack/commit/eab37eca4376237b0ee086cc30d0a3be5d0998a8?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`b3edd0e`)](https://app.codecov.io/gh/apache/cloudstack/commit/b3edd0ef5ead85662e8a2e68dce87a85f7961790?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   
   > :exclamation:  There is a different number of reports uploaded between BASE (eab37ec) and HEAD (b3edd0e). Click for more details.
   > 
   > <details><summary>HEAD has 1 upload less than BASE</summary>
   >
   >| Flag | BASE (eab37ec) | HEAD (b3edd0e) |
   >|------|------|------|
   >|unittests|1|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@              Coverage Diff              @@
   ##               main   #10500       +/-   ##
   =============================================
   - Coverage     16.15%    4.00%   -12.16%     
   =============================================
     Files          5666      396     -5270     
     Lines        498078    32532   -465546     
     Branches      60267     5767    -54500     
   =============================================
   - Hits          80481     1302    -79179     
   + Misses       408584    31080   -377504     
   + Partials       9013      150     -8863     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/10500/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/10500/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `4.00% <ø> (ø)` | |
   | [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/10500/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/cloudstack/pull/10500?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500#issuecomment-2700269325

   it looks this issue exists for some years


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500#discussion_r1981120809


##########
framework/cluster/src/main/java/com/cloud/cluster/ClusterManagerImpl.java:
##########
@@ -1107,9 +1107,18 @@ public boolean stop() {
         if (_mshostId != null) {
             final ManagementServerHostVO mshost = _mshostDao.findByMsid(_msId);
             if (mshost != null) {
-                final ManagementServerStatusVO mshostStatus = mshostStatusDao.findByMsId(mshost.getUuid());
-                mshostStatus.setLastJvmStop(new Date());
-                mshostStatusDao.update(mshostStatus.getId(), mshostStatus);
+                ManagementServerStatusVO mshostStatus = mshostStatusDao.findByMsId(mshost.getUuid());
+                if (mshostStatus != null) {
+                    mshostStatus.setLastJvmStop(new Date());
+                    mshostStatusDao.update(mshostStatus.getId(), mshostStatus);
+                } else {

Review Comment:
   ```suggestion
                   } else {
                       logger.warn("an MS host, [{}] without a status? this should never happen!", mshost);
   ```



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500#issuecomment-2700254786

   @rohityadavcloud a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "rohityadavcloud (via GitHub)" <gi...@apache.org>.
rohityadavcloud commented on code in PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500#discussion_r1984373692


##########
framework/cluster/src/main/java/com/cloud/cluster/ClusterManagerImpl.java:
##########
@@ -1107,9 +1107,19 @@ public boolean stop() {
         if (_mshostId != null) {
             final ManagementServerHostVO mshost = _mshostDao.findByMsid(_msId);
             if (mshost != null) {
-                final ManagementServerStatusVO mshostStatus = mshostStatusDao.findByMsId(mshost.getUuid());
-                mshostStatus.setLastJvmStop(new Date());
-                mshostStatusDao.update(mshostStatus.getId(), mshostStatus);
+                ManagementServerStatusVO mshostStatus = mshostStatusDao.findByMsId(mshost.getUuid());
+                if (mshostStatus != null) {
+                    mshostStatus.setLastJvmStop(new Date());
+                    mshostStatusDao.update(mshostStatus.getId(), mshostStatus);
+                } else {
+                    logger.warn("an MS host, [{}] without a status? this should never happen!", mshost);

Review Comment:
   ```suggestion
                       logger.warn("Found a management server host [{}] without a status. This should never happen!", mshost);
   ```



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] framework/cluster: fix NPE for ms-host status when mgr stops [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #10500:
URL: https://github.com/apache/cloudstack/pull/10500#issuecomment-2705481405

   Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12693


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org