1561316811 opened a new issue, #8854:
URL: https://github.com/apache/cloudstack/issues/8854

   <!--
   Verify first that your issue/request is not already reported on GitHub.
   Also test if the latest release and main branch are affected too.
   Always add information AFTER of these HTML comments, but no need to delete 
the comments.
   -->
   
   ##### ISSUE TYPE
   <!-- Pick one below and delete the rest -->
    * Bug Report
    * Improvement Request
    * Enhancement Request
    * Feature Idea
    * Documentation Report
    * Other
   
   ##### COMPONENT NAME
   <!--
   Categorize the issue, e.g. API, VR, VPN, UI, etc.
   -->
   ~~~
   cloud-framework-jobs
   ~~~
   
   ##### CLOUDSTACK VERSION
   <!--
   New line separated list of affected versions, commit ID for issues on main 
branch.
   -->
   
   ~~~
   commit ID: 45d267ccbf2749c547cbbbac4a2cb1f3351dcaf2 on main branch.
   ~~~
   
   ##### CONFIGURATION
   <!--
   Information about the configuration if relevant, e.g. basic network, 
advanced networking, etc.  N/A otherwise
   -->
   
   
   ##### OS / ENVIRONMENT
   <!--
   Information about the environment if relevant, N/A otherwise
   -->
   
   
   ##### SUMMARY
   <!-- Explain the problem/feature briefly -->
   The sensitvie information job object may leak through the 
"logger.trace("Unable to find a wakeup dispatcher from the joined job: " + 
job);"
   
   ##### STEPS TO REPRODUCE
   <!--
   For bugs, show exactly how to reproduce the problem, using a minimal 
test-case. Use Screenshots if accurate.
   
   For new features, show how the feature would be used.
   -->
   
   <!-- Paste example playbooks or commands between quotes below -->
   ~~~
   
   ~~~
   
   <!-- You can also paste gist.github.com links for larger files -->
   
   ##### EXPECTED RESULTS
   <!-- What did you expect to happen when running the steps above? -->
   
   ~~~
   
   ~~~
   
   ##### ACTUAL RESULTS
   <!-- What actually happened? -->
   
   <!-- Paste verbatim command output between quotes below -->
   ~~~
   
   ~~~
   
   #### bug code location
   org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl#runInContext
   ~~~
   protected void runInContext() {
               long runNumber = getJobRunNumber();
   
               try {
                   //
                   // setup execution environment
                   //
                   try {
                       JmxUtil.registerMBean("AsyncJobManager", "Active Job " + 
job.getId(), new AsyncJobMBeanImpl(job));
                   } catch (Exception e) {
                       // Due to co-existence of 
normal-dispatched-job/wakeup-dispatched-job, MBean register() call
                       // is expected to fail under situations
                       if (logger.isTraceEnabled())
                           logger.trace("Unable to register active job " + 
job.getId() + " to JMX monitoring due to exception " + 
ExceptionUtil.toString(e));
                   }
   
                   _jobMonitor.registerActiveTask(runNumber, job.getId());
                   AsyncJobExecutionContext.setCurrentExecutionContext(new 
AsyncJobExecutionContext(job));
                   String related = job.getRelated();
                   String logContext = job.getShortUuid();
                   if (related != null && !related.isEmpty()) {
                       AsyncJob relatedJob = 
_jobDao.findByIdIncludingRemoved(Long.parseLong(related));
                       if (relatedJob != null) {
                           logContext = relatedJob.getShortUuid();
                       }
                   }
                   ThreadContext.put("logcontextid", logContext);
   
                   // execute the job
                   if (logger.isDebugEnabled()) {
                       logger.debug("Executing " + 
StringUtils.cleanString(job.toString()));
                   }
   
                   if ((getAndResetPendingSignals(job) & 
AsyncJob.Constants.SIGNAL_MASK_WAKEUP) != 0) {
                       AsyncJobDispatcher jobDispatcher = 
findWakeupDispatcher(job);
                       if (jobDispatcher != null) {
                           jobDispatcher.runJob(job);
                       } else {
                           // TODO, job wakeup is not in use yet
                           if (logger.isTraceEnabled())
                               logger.trace("Unable to find a wakeup dispatcher 
from the joined job: " + job); // not cleanJob
                       }
                   } else {
                       AsyncJobDispatcher jobDispatcher = 
getDispatcher(job.getDispatcher());
                       if (jobDispatcher != null) {
                           jobDispatcher.runJob(job);
                       } else {
                           logger.error("Unable to find job dispatcher, job 
will be cancelled");
                           completeAsyncJob(job.getId(), JobInfo.Status.FAILED, 
ApiErrorCode.INTERNAL_ERROR.getHttpCode(), null);
                       }
                   }
   
                   if (logger.isDebugEnabled()) {
                       logger.debug("Done executing " + job.getCmd() + " for 
job-" + job.getId());
                   }
   
               } catch (Throwable e) {
                   logger.error("Unexpected exception", e);
                   completeAsyncJob(job.getId(), JobInfo.Status.FAILED, 
ApiErrorCode.INTERNAL_ERROR.getHttpCode(), null);
               } finally {
                   // guard final clause as well
                   try {
                       if (job.getSyncSource() != null) {
                           // here check queue item one more time to double 
make sure that queue item is removed in case of any uncaught exception
                           _queueMgr.purgeItem(job.getSyncSource().getId());
                       }
   
                       try {
                           JmxUtil.unregisterMBean("AsyncJobManager", "Active 
Job " + job.getId());
                       } catch (Exception e) {
                           // Due to co-existence of 
normal-dispatched-job/wakeup-dispatched-job, MBean unregister() call
                           // is expected to fail under situations
                           if (logger.isTraceEnabled())
                               logger.trace("Unable to unregister job " + 
job.getId() + " to JMX monitoring due to exception " + 
ExceptionUtil.toString(e));
                       }
   
                       //
                       // clean execution environment
                       //
                       AsyncJobExecutionContext.unregister();
                       _jobMonitor.unregisterActiveTask(runNumber);
   
                   } catch (Throwable e) {
                       logger.error("Double exception", e);
                   }
               }
           }
       };
   }
   ~~~
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to