camunda-bpm-platform icon indicating copy to clipboard operation
camunda-bpm-platform copied to clipboard

`NullPointerException` thrown when metrics are disabled

Open yanavasileva opened this issue 1 year ago • 2 comments

Environment (Required on creation)

Any (example below with 7.20 Wildfly 29)

Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket)

When metricsEnabled is set to false, a NPE is thrown in case in the following cases:

  • History cleanup is started => can't run the History cleanup
  • The invoice example application is deployed => no processes can be started
  • Cockpit dashboard is loaded (the exception is reported as a warning)

Root cause: "org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.getDbMetricsReporter()" is null

Server output:

logs.txt

Steps to reproduce (Required on creation)

  1. Download a pre-packaged distribution
  2. Set metricsEnabled to false
  3. Start the server

Observed Behavior (Required on creation)

In three different cases a NullPoitnerException is thrown and History cleanup and the invoice example can't be started

Expected behavior (Required on creation)

No errors are thrown, History cleanup can be started, the process engine can operate with disabled metrics.

Root Cause (Required on prioritization)

When the metrics are disabled, the dbMetricsReporter is null and there's no null check in:

  1. History cleanup where the reporter is used to report its metrics (HistoryCleanupSchedulerCmd.reportMetrics)
  2. Invoice example (InvoiceApplicationHelper)
  3. In Dashboard Cockpit, to display the metrics charts

Solution Ideas

Hints

  • Workarounds
    • Disable metrics for History cleanup via historyCleanupMetricsEnabled
    • Don't deploy the invoice example application
    • For Cockpit the NPE still will be reported as a warning

Links

  • https://jira.camunda.com/browse/SUPPORT-18916
  • duplicate: https://github.com/camunda/camunda-bpm-platform/issues/2704
  • related to: https://github.com/camunda/camunda-bpm-platform/issues/2739

Breakdown

### Pull Requests

Dev2QA handover

  • [ ] Does this ticket need a QA test and the testing goals are not clear from the description? Add a Dev2QA handover comment

yanavasileva avatar Oct 30 '23 08:10 yanavasileva

Hi @yanavasileva,

Can we close this duplicate since https://github.com/camunda/camunda-bpm-platform/issues/2704 is resolved? Maybe we could also communicate this to the customer? The process was broken since the support case wasn't linked to the other issue.

Best, Tassilo

tasso94 avatar Feb 15 '24 10:02 tasso94

@tasso94 https://github.com/camunda/camunda-bpm-platform/issues/2704 resolved use case 1. NPE in History cleanup. The NPE for use case 2. when the Invoice example application is deployed is not resolve. So I can adjust the description and leave the ticket open. (I am not sure if use case 3. warnings thrown when Cockpit is resolved either.) Let me know if you have objections.

yanavasileva avatar Feb 15 '24 11:02 yanavasileva