Campaign loop Bug Mautic 4.4.8

Hello there, in the latest update on our company’s Mautic system, we’ve encountered a campaign looping problem. The campaign restarts while the user is still in the campaign’s stages, causing a ‘Duplicate entry’ error when the same event is called by both threads.
hope ive explained it clearly

Hi, I think more info is needed, including:

  • how the contacts are added to the campaign?
  • which action loops?
  • is that an executed action or scheduled action?
  • are you sure two consequitive campaign crons are not catching up with eachother?

Hi, @joeyk
The contacts are added from the segments.

The ss provided above shows the action executed when the error occurred, in logs it gives the following error:
‘INSERT INTO campaign_lead_event_log (rotation, date_triggered, is_scheduled, trigger_date, system_triggered, metadata, channel, channel_id, non_action_path_taken, event_id, lead_id, campaign_id, ip_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)’ with params [7, “2023-05-15 00:22:14”, 0, null, 0, “a:0:{}”, null, null, 0, 542, “364398”, 43, 570863]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘542-364398-7’ for key ‘campaign_rotation’".

when the contact visits trabzon pages, the error occurs, while when he visits other pages, the campaign runs without any problem.

Hope it helps.

Do I see correctly, that you created a loop without waiting time?
Every cycle the whole “no” branch is running through.

Yes @joeyk,
But it depends on contacts decision to visit a page. so it does not get in a loop

My problem, @joeyk, is that when a contact visits a Trabzon page (the first decision in the campaign) after the latest update we made, Mautic restarts the campaign parallelly with the old campaign thread. However, when the contact visits any other page, it runs without any problem.

It is really hard to troubleshoot like this.
What starts the campaign? What is your segment filter?
Are you adding contacts manually to the segment?

Sorry for the confusion, @joeyk.
The campaign is shown in the screenshot below:

The contacts are being added automatically to segments, rather than manually, and the segment filters are as follows:

  • The contacts visited a specific URL.
  • The contacts do not have a phone number.

The campaign starts when a contact visits any page with a URL containing the word “trabzon.”

Step 1: When a contact visits any page with the word “trabzon” in its URL.
Step 2: Check the value of the contact field.
Step 3: If the result is “no,” proceed to Step 4.
Step 4: when the contact visits ANY PAGE proceed to Step 5.
Step 5: The campaign sends the focus item to the contact.
Step 6: Jump back to Step 2 if the condition “closed popup today” is met.
What is happening: When a contact visits a page with a URL containing the word “trabzon” in Step 4, the campaign mistakenly interprets it as both Step 1 and Step 4 combined. As a result, it goes through the “closed popup today?” condition twice, leading to a “duplicated entry” error.

What should be:The campaign should continue with a single decision at Step 4 without repeating the “closed popup today?” condition or revisiting Step 1. This would prevent the duplication error and ensure a smooth flow in the campaign logic.

Hope it helps

As I remember (not tested myself, but as I remember I have read somewhere): when a “decision” (“Visits any pages” is a “decision”) has no time (within) defined on the negative branch, then the state is checked right away.
This would mean, if the contact visits the mentioned page, the “decision” will trigger true.
The Focus Item will be shown and right after that, the jump would restart the loop.
The “decision” will be again true, as the contact did not exited the mentioned page.
And Mautic would try to show the focus item again.
Would that trigger an error?
If the focus item is already shown, to trigger the action “show focus item” again and again would that be an error?
I suppose the steps would be calculated more that one time each cron run…

I would try at first to put a “wait command” on the negative branch of the condition “visits any pages” (you can use a “Modify tags” action and try removing a tag that is anyway unused or invalid for the contact). And as a wait put something like 30 days or something like this. That would be more healthy :slight_smile:

Hi @IonutOjicaDe,
As far as I know, the “visit page” decision will trigger as true only when a user hits a page, not while he still on the page (shown in the screen shot here)

However, the issue seems to occur specifically when the user visits pages related to “trabzon,” rather than any other page. This problem started after we updated Mautic to version 4.4.8 approximately two weeks ago. Prior to that update, everything was functioning smoothly without any issues.

You can “downgrade” to the previous version.
I did it myself also from 4.4.8 to 4.4.7 and then again upgrade.

Would then function again as expected?

1 Like