# readCount discrepancy on segment emails

**URL:** <https://forum.mautic.org/t/readcount-discrepancy-on-segment-emails/18214>\
**Category:** Product Support\
**Created:** [February 18, 2021, 9:36am UTC](https://forum.mautic.org/t/readcount-discrepancy-on-segment-emails/18214 "2021-02-18T09:36:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![simcen](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/simcen/32/1379_2.png) [@simcen](https://forum.mautic.org/u/simcen)\
**Post date:** [February 18, 2021, 9:36am UTC](https://forum.mautic.org/t/readcount-discrepancy-on-segment-emails/18214/1 "2021-02-18T09:36:19Z")

</div>

**Your software**  
My Mautic version is: v3.2.3  
My PHP version is: 7.4.13  
My Database type and version is: MySQL 5.7

**Your problem**  
My problem is:  
After sending a segment email, I’m noticing a discrepancy between the “readCount” property on the email entity, which is shown in list, and the actual email stats (which email is sent to which contact and is known as read).

What I’m observing is that readCount is very often higher than number of entries in email\_stats belonging to the affected email where “date\_read” is not null (so the email is treated as “read” for a particular contact). This also expresses when clicking on “xx Read” colored badge, only contacts appear that have read the email - which is the expected count of reads of that email.

Sample:

 ![Screenshot 2021-02-18 at 10.29.56](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/d/d05b26791af7f22f201e8f607af95018bdb72194.png)

 ![Screenshot 2021-02-18 at 10.30.16](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/2/2572c03a0010e1107aa4c13c7c11af1a72cb99c9.png)

These errors are showing in the log:  
No errors ☹

Steps I have tried to fix the problem:  
I’ve traced down the tracking of reads of emails down to “hitEmail()” ([mautic/EmailModel.php at 6cf4b343af87fa8fde29dc5a7695262d184a0a1d · mautic/mautic · GitHub](https://github.com/mautic/mautic/blob/6cf4b343af87fa8fde29dc5a7695262d184a0a1d/app/bundles/EmailBundle/Model/EmailModel.php#L475)) method. According to that method, “upCount()” is only executed when the email isn’t read yet, so only unique reads should be counted on “readCount”. So the “readCount” counter shouldn’t be higher than actually number of entries in email\_stats where date\_read is not null…

Additionally, I’ve been analysing my access logs and I can exactly reproduce the email opens that lead to email\_stats entries set to “is\_read” = 1 and “date\_read” with the first open of the email.

Does anybody have an idea what could cause readCount being higher than actual reads recorded in email\_stats?

Any help is much appreciated!

Thanks,  
Simon

---

<div class="post-metadata">

**Author:** ![simcen](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/simcen/32/1379_2.png) [@simcen](https://forum.mautic.org/u/simcen)\
**Post date:** [February 22, 2021, 7:43am UTC](https://forum.mautic.org/t/readcount-discrepancy-on-segment-emails/18214/2 "2021-02-22T07:43:24Z")

</div>

I did some more testing and was able to reproduce the problem on my local setup.

The issue appears when multiple email tracking gifs for the same email of the same recipient are opened/requested at the same time.  
This can happen in real life when recipients are using modern email clients on multiple devices that prefetch content before opening the email. With push-enabled clients, the chances that one recipient prefetches content of the same email on multiple devices gets even higher.

What happens is that the check if the email was read by an individual recipient was changed by another request meanwhile, the up count on the “readCount” counter on the email entity still happens.

Does anybody have similar experiences? Any ideas on how to approach that?

Thanks  
Simon

---

<div class="post-metadata">

**Author:** ![patryk.gruszka](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/patryk.gruszka/32/9813_2.png) [@patryk.gruszka](https://forum.mautic.org/u/patryk.gruszka)\
**Post date:** [August 24, 2023, 12:06pm UTC](https://forum.mautic.org/t/readcount-discrepancy-on-segment-emails/18214/3 "2023-08-24T12:06:30Z")

</div>

This looks exactly like the problem I’ve described in [Multiple counting email reads · Issue #10056 · mautic/mautic · GitHub](https://github.com/mautic/mautic/issues/10056). I’ve prepared a fix for this concurrency issue, which you can review here: [[DPMMA-2218] Fix email read concurrency issues by patrykgruszka · Pull Request #12673 · mautic/mautic · GitHub](https://github.com/mautic/mautic/pull/12673).
