How did happened? Duplicate contact

Thanks @joeyk, I am not seeing any JS (what did you mean by ja errors ? was it mean to be javascript errors ? Not seeing anything in the logs either. And CORS enabled and seems to be working as there are hundreds of new users being created every day.

I went and did a test to try and add a new “quick user” manually through the system. I used the same email as an existing one and get the following:
image

When I went and saved the contact it actually made a duplicate - is this the correct behaviour?

image

@rcheesley do you have any ideas on my last post here ? Is this expected behavior?

I don’t think that it should be duplicating the contact if you are using a + suffix - does it happen without the suffix?

Thanks Ruth.

I just tried without the + and got same behaviour.

I just tested the same case with 4.3.1, 4.4.2 and in both cases I was able to create a new user with quick add with the same email address…

This does not seem correct - or maybe I am missing something here on what a unique identifier is.

Is custom field → email set as Unique Identifier?

When I had the duplicate email issue, it was just only one contact that had duplicate contacts with same email. It not happening anymore and I don’t know what causes it in the first place.

I just toggled the email Unique Identifier No then save and then toggle it back Yes and save again.

Hey @techbill - yes email is set to Unique Identifier.

I tried to toggle it off, save and on again, however still same behaviour.

I have now tested this on 4.4.3 and getting same behaviour.

I know and see when you create a contact that it gives a warning that the contact email already exists, however when I save it actually creates the duplicate.

Anyone seeing same behaviour or is it not allowing you to save the dup contact ?

Hi @escopecz - is it possible for you to give some direction on how to go about debugging this issue ?

I checked in the local.php config file for a specific setting and could not find anything relating to this.

Any thoughts are appreciated

Mautic automatically merges contact by unique identifier field(s) when the data are coming from outside (CSV import, API, form submissions) but it will allow you to create a duplicate via UI. It should display a warning that a contact with the same email address exists as you type it in to the new contact form. But it won’t stop you nor merge. I don’t recall why it was designed this way but here we go.

There is a handy command to deduplicate all contacts based on the unique identifier fields. It will merge the field values as well as the history of both contacts.

bin/console mautic:contacts:deduplicate

This command is not very fast. If you have millions of contacts it can take days and even weeks. I created a pull request making it way faster and it’s waiting for one more tester to approve it and merge it:

1 Like

Thank you for the explanation @escopecz . I will go and pull this patch and test it myself now.

What do you think of the fact that the tracking script has the possibility of making duplicate contacts as shown above in this thread ?

In the scenario, the tracking script is creating users however our thinking is maybe our client has not implemented it correctly and it is being called multiple times and hence forming a race condition of sorts ?

I did start running the dedup a while ago and saw that it was very very slow and yes we have millions of contacts :frowning:

The tracking script should also deduplicate contacts automatically.

But indeed. I saw it too that some users implement the tracking script multiple times on their website and so multiple same requests are going to Mautic at the same time and a race conditions causes the contacts to be created twice. It’s not hard to spot that when you load the website tracked by Mautic that there are multiple POST requests to the tracking endpoint.

will this fix work with Mautic 4.x ?

I have tried manually installing patch but did landed up breaking my install, so had to put everything back

No, it won’t… Mautic 4 won’t have any feature release and the command performance improvement is an enhancement. Mautic 4 will get only some bug fixes.

1 Like

It happened again …

This contact was created via one of the Mautic form and It was submitted one time but duplicate was created. Look at the time frame created and database ID.

Hey!
Is this a Mautic form? Or post from another form?

Mautic form using automatic javascript on an another website

Original js embed from the form?

This

<script type="text/javascript" src="//mas.agwm.org/form/generate.js?id=17"></script>

Hello there. I too am running into this - although very infrequently.

Was the root cause ever discovered?

We are pulling in information from various sources (ie forms both native and non) and will try running the dedupe cron per above.

Thanks for any feedback.

This still happens to us from time to time. We haven’t found the root cause of duplications so we just delete the duplication when we spot one.

It doesn’t happen often enough that is not on top of our priority list to troubleshoot and find the cause.