Modify

Opened 3 years ago

Closed 10 days ago

Last modified 6 days ago

#12228 closed defect (fixed)

With Trac 1.0.3 or later user email validation often fails because of caching in the env.get_known_users() function

Reported by: sammcz Owned by: Ryan J Ollos
Priority: high Component: AccountManagerPlugin
Severity: critical Keywords:
Cc: Ryan J Ollos Trac Release: 1.0

Description

After upgrading TRAC to 1.0.4 i got many reports about broken email validation. In SMTP server logs i found that TRAC is not attempting to send email in many cases. In the trac log i found many records like this:

Mar  8 03:46:35 sphere Trac[api] INFO: Email verification requested for user: BrigittMcewen
Mar  8 03:46:35 sphere Trac[notification] INFO: Email address w/o domain: BrigittMcewen
Mar  8 03:46:35 sphere Trac[notification] INFO: no recipient for a ticket notification
Mar  8 03:46:35 sphere Trac[session] INFO: Refreshing session BrigittMcewen

This is not happens on every registration, but in about 50% cases. Of course this user have valid email and not only username. Then i wrote a test script to repeat the issue and found that it is caused by recent changes in the trac caching. AccountManager edits attributes directly, so at some point cached records are not valid anymore. After adding few self.env.invalidate_known_users_cache() calls to the code issue was resolved.

Attachments (2)

accmgr.patch (1.3 KB) - added by sammcz 3 years ago.
quick and dirty fix for the problem
accmgr_v2.patch (1.5 KB) - added by sammcz 3 years ago.
This patch invalidates cache if there are any actions with users database

Download all attachments as: .zip

Change History (14)

comment:1 Changed 3 years ago by sammcz

JFYI - i am using Trac 1.0.4 and TracAccountManager 0.4.4.

Changed 3 years ago by sammcz

Attachment: accmgr.patch added

quick and dirty fix for the problem

comment:2 Changed 3 years ago by sammcz

I was able to find that bug is trigged only when notification is enabled, e.g. notify_actions = new,change,delete in the trac.ini. So probably during notification it updates users cache with a wrong data. My patch fixing issue, however i think it is not accurate or complete. I will try to provide better patch soon.

Changed 3 years ago by sammcz

Attachment: accmgr_v2.patch added

This patch invalidates cache if there are any actions with users database

comment:3 Changed 2 years ago by Ryan J Ollos

Cc: Ryan J Ollos added

comment:4 Changed 18 months ago by samm@…

Hi, any chance to get it committed before ongoing 0.5?

comment:5 Changed 18 months ago by Ryan J Ollos

Yes, see #12569.

comment:6 Changed 14 months ago by Ryan J Ollos

In 15717:

0.5dev: Clear known users cache in model functions

More changes are needed to cover all possible cases in
which the cache needs to be cleared.

Refs #12228.

comment:7 Changed 11 months ago by Ryan J Ollos

Owner: changed from Steffen Hoffmann to Ryan J Ollos
Status: newaccepted

comment:8 Changed 10 months ago by Ryan J Ollos

#13000 closed as a duplicate, reporting no email sent when using reset password from the admin panel.

comment:9 Changed 10 days ago by Ryan J Ollos

In 16869:

TracAccountManager 0.5dev: Clear known users cache

Minor revisions to r15717 and addition of test coverage.

Refs #12228.

comment:10 Changed 10 days ago by Ryan J Ollos

Resolution: fixed
Status: acceptedclosed

Please test r16869 and let me know if it's not working for you. I think the issue is resolved.

comment:11 Changed 6 days ago by Ryan J Ollos

In 16887:

TracAccountManager 0.5dev: Workaround trac:#12929

This revises r16869.

Refs #12228.

comment:12 Changed 6 days ago by Ryan J Ollos

In 16888:

TracAccountManager 0.5dev: Revert unintended changes in r16887

Refs #12228.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.