camunda / camunda-bpm-platform

Flexible framework for workflow and decision automation with BPMN and DMN. Integration with Quarkus, Spring, Spring Boot, CDI.
https://camunda.com/
Apache License 2.0
4.03k stars 1.53k forks source link

`NullPointerException` thrown when metrics are disabled #3903

Open yanavasileva opened 8 months ago

yanavasileva commented 8 months ago

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:

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

Links

Breakdown

### Pull Requests

Dev2QA handover

tasso94 commented 4 months ago

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

yanavasileva commented 4 months ago

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