Print Thread
Hop To
Joined: Jun 2006
Posts: 811
old hand
old hand
Joined: Jun 2006
Posts: 811
I recently upgraded to 7.5.4.2 and am encountering an issue where users receive multiple "happy birthday" emails.

For example, I set my own birthday to to Jan. 24.

I received two emails:
- First one at 9:00 p.m. ET on Jan 23
- Second one at 1:33 a.m. ET on Jan 24

I'm on the east coast, and my server is on the west coast. So my offset time is set to "3" hours.

I'd love to diagnose and solve this so it was working as before the upgrade, with just one email sent at exactly 12am ET.

Any thoughts?

Joined: Jun 2006
Posts: 811
old hand
old hand
Joined: Jun 2006
Posts: 811
Any tips on things I could check out? Thanks.

Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
Hmm, we haven't changed any of the birthday email code since it was put in. Is it possible that it's been sending out duplicate emails for you all along? The way we currently handle times and triggered events definitely leads to the potential for issues like this (which we're resolving for v8).

Can you run the following query and post the results?

SQL Query
select * from ubbt_CACHE


Joined: Jun 2006
Posts: 811
old hand
old hand
Joined: Jun 2006
Posts: 811
Screen grab attached.

It wasn't sending duplicates before the upgrade.

Thanks for your advice.
Attachments
cp.jpg

Joined: Jun 2006
Posts: 811
old hand
old hand
Joined: Jun 2006
Posts: 811
Any tips of things I should check? Thanks.

Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
What I'd do is set your birthday for tomorrow and then after you receive the first one, run that SQL query again and see if the birthdays line has tomorrows date or still has todays.

Then we'll have a bit more of an idea of what's going on.

Joined: Jun 2006
Posts: 811
old hand
old hand
Joined: Jun 2006
Posts: 811
I changed my birthday to tomorrow, and like before I received the first email at 9pm ET tonight. I ran that same query again (see attached). It has tomorrow's date (the 30th). What should I try next? Thanks.
Attachments
sql.jpg

Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
i think i found the problem...

<start geek mode response>
triggers.inc.php is blatantly calling mysql_affected_rows with no handle, so according to the php.net it will use the last connection if not supplied.

it should really be calling $dbh->affected_rows() instead

also, the routine: affected_rows, should be using $this->dbh as well... in it's internal call to mysql_affected_rows().. should be: mysql_affected_rows($this->dbh) wink

PHP Code
function affected_rows() {
	return mysql_affected_rows($this->dbh);
} 
is proper implementation!


now Mitch, why would your PMs be staggered by 3 hours?

simple, there are two boards running on the same server. 1 board is EST and the other board is PST (3 hours apart) and the mysql_affected_rows() call is just bailing in triggers.. so you'll get 2 birthday emails.. and it will all 'look right' when you run Rick's query.. but it really ain't right smile

imagine if a server has even MORE installs with differing time zones and i think you'd see even more 'funky' results..

files that use mysql_affected_rows (direct mysql call) are: triggers.inc.php and delete.inc.php

files that attempt to do it right, but STILL will fail are inline_moderation.inc.php, where the $sth parameter is passed in..

also, this will work MOST of the time, since there usually (i'm assuming) are only 1 install of ubbthreads per server or even if there ARE more, they all have the same time zone..
</end geek mode response>

that could get REAL funky there!! laugh

ps: if there are other similar 'direct calls' to mysql, instead of using the sql class, you might also see funky stuff with other things.. ie.. multiple notifications on the same new user or whatever... it should be grep'd and made sure that you have properly abstracted the sql class everywhere..

pps: this also prolly catches the incorrect PM notification 'bug' too, since delete.inc.php uses that..

ppps: Mitch, i will make those changes on your board and we can watch what happens, but i'm 99% sure this is what is your symptom / fix..

Joined: Jun 2006
Posts: 811
old hand
old hand
Joined: Jun 2006
Posts: 811
Nice work! Thank you very much.

Joined: Jun 2004
Posts: 207
C
enthusiast
enthusiast
C Offline
Joined: Jun 2004
Posts: 207
We just upgraded last week and we had people getting upwards of 50 emails during the day.


Won't you take me to Funkytown?

Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Bots
by Outdoorking - 04/13/2024 5:08 PM
Can you add html to language files?
by Baldeagle - 04/07/2024 2:41 PM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
This is not a bug, but a suggestion
by Baldeagle - 04/05/2024 11:25 PM
Is UBB.threads still going?
by Aaron101 - 04/01/2022 8:18 AM
Who's Online Now
1 members (Nightcrawler), 737 guests, and 131 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)