Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in History-Cleanup produces ByteArray without removal time #3288

Closed
1 task
danielkelemen opened this issue Mar 28, 2023 · 4 comments · Fixed by #3473
Closed
1 task

Exception in History-Cleanup produces ByteArray without removal time #3288

danielkelemen opened this issue Mar 28, 2023 · 4 comments · Fixed by #3473
Assignees
Labels
group:support All requests that are linked to a customer request. DRI: Tassilo type:bug Issues that describe a user-facing bug in the project. version:7.18.10 version:7.19.4 version:7.20.0-alpha3 version:7.20.0

Comments

@danielkelemen
Copy link
Member

danielkelemen commented Mar 28, 2023

Environment (Required on creation)

Reported in 7.18.5-ee. Also reproduced in latest version.

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

Exceptions during history cleanup produce a job log with a corresponding ByteArray containing the stack trace. When the historyCleanupJobLogTimeToLive is configured this job log contains the correct removalTime. However, the stack trace byte array entity does not have the removalTime set.
As a consequence, these byte arrays will remain in the database and won't get cleaned up.

Steps to reproduce (Required on creation)

  1. Configure history cleanup with historyCleanupJobLogTimeToLive=1
  2. Force an exception during history cleanup
  3. Look up the created ACT_HI_JOB_LOG and ACT_GE_BYTEARRAY records. The removalTime is not set for the byte array which means it won't be cleaned up.

Observed Behavior (Required on creation)

The history cleanup stack trace byte array has no removalTime set.
The record will not get cleaned up from the database.

Expected behavior (Required on creation)

The history cleanup stack trace byte array has removalTime set.
The record will get cleaned up from the database.

Root Cause (Required on prioritization)

The DefaultHistoryEventProducer skips setting the removalTime of the byte array when strategy end is defined. This works fine with job log byte arrays that are related to process instances as they will get updated later when the corresponding PI has ended.
However, history cleanup job log has no process instance relation so their byte arrays will remain in the database.

Solution Ideas

If the HistoricJobLogEventEntity has no processInstanceId, the byte array could inherit the same removalTime as the job log entity, regardless of the removal time strategy:

if (isHistoryRemovalTimeStrategyStart() || event.getProcessInstanceId() == null) {
  byteArray.setRemovalTime(event.getRemovalTime());
}

In DefaultHistoryEventProducer.

Hints

Links

Breakdown

Dev2QA handover

  • Does this ticket need a QA test and the testing goals are not clear from the description? Add a Dev2QA handover comment
@danielkelemen danielkelemen added the type:bug Issues that describe a user-facing bug in the project. label Mar 28, 2023
@daniel-ewing daniel-ewing added the group:support All requests that are linked to a customer request. DRI: Tassilo label Mar 28, 2023
@ThorbenLindhauer
Copy link
Member

I wonder if the if statement is needed at all in DefaultHistoryEventProducer#createHistoricJobLogFailedEvt. The same condition exists already in #initHistoricJobLogEvent, so if the removal time strategy is end and the event belongs to a process instance, the removal time will be null and we could "copy" that null value to the byte array, too (just from reading the code; might misunderstand this).

So maybe this can also be fixed by just removing the condition when setting the byte array removal time. Think about it another way: The job log event and the byte array should probably never have different removal times. So just copying the job log's removal time over unconditionally sounds reasonable.

@tmetzke
Copy link
Member

tmetzke commented Jun 2, 2023

Review hints:

  • Code changes look good, I only added some smaller suggestions.
  • Please don't forget to backport this as indicated by the issue labels.

psavidis added a commit that referenced this issue Jun 7, 2023
- Remove unused list from history cleanup jobs
- Initialize configuration using ProcessEngineBootstrapRule instead to fix stateful propagation of ProvidedProcessEngineRule config
- To achieve the above point, EntityRemoveRule now supports lazy initialization
- RuleChainBuilder to simplify Chain creation from the clients perspective

Related to: #3288
psavidis added a commit that referenced this issue Jun 7, 2023
- Use testRule#deleteHistoryCleanupJobs to cleanup history jobs instead
- Remove RuleChainBuilder (hides the rules from test class & makes it inconvenient)

Related to: #3288
psavidis added a commit that referenced this issue Jun 7, 2023
psavidis added a commit that referenced this issue Jun 7, 2023
- Remove unused list from history cleanup jobs
- Initialize configuration using ProcessEngineBootstrapRule instead to fix stateful propagation of ProvidedProcessEngineRule config
- To achieve the above point, EntityRemoveRule now supports lazy initialization
- RuleChainBuilder to simplify Chain creation from the clients perspective

Related to: #3288
psavidis added a commit that referenced this issue Jun 7, 2023
- Use testRule#deleteHistoryCleanupJobs to cleanup history jobs instead
- Remove RuleChainBuilder (hides the rules from test class & makes it inconvenient)

Related to: #3288
psavidis added a commit that referenced this issue Jun 7, 2023
- Use testRule#deleteHistoryCleanupJobs to clean-up history jobs instead
- Remove Unused list from history clean-up jobs
- Use ProcessEngineBootstrapRule instead to fix Config Propagation issues
- To achieve the above point, EntityRemoveRule now supports lazy initialization

Related to: #3288
psavidis added a commit that referenced this issue Jun 8, 2023
psavidis added a commit that referenced this issue Jun 8, 2023
- Use testRule#deleteHistoryCleanupJobs to clean-up history jobs instead
- Remove Unused list from history clean-up jobs
- Use ProcessEngineBootstrapRule instead to fix Config Propagation issues
- To achieve the above point, EntityRemoveRule now supports lazy initialization

Related to: #3288
psavidis added a commit that referenced this issue Jun 8, 2023
- removalTime of a failing clean-up job's bytearray was null. As a result, that entry was not getting cleaned up. This fix ensures passing the value through.

Related to: #3288
@psavidis psavidis reopened this Jun 8, 2023
@yanavasileva
Copy link
Member

Assigning for a backport review.

@yanavasileva yanavasileva assigned yanavasileva and unassigned psavidis Jun 8, 2023
@yanavasileva
Copy link
Member

Backport review: done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group:support All requests that are linked to a customer request. DRI: Tassilo type:bug Issues that describe a user-facing bug in the project. version:7.18.10 version:7.19.4 version:7.20.0-alpha3 version:7.20.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants