Duplicate anonymous usernames

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
jguengerich
Commodore (COMO)
Commodore (COMO)
Posts: 436
Joined: Tue May 07, 2013 1:59 pm

Duplicate anonymous usernames

Post by jguengerich » Mon Jun 23, 2014 7:11 am

Using Gold R5 (build 5731).
I have our site configured as member-only (users must log in before going to any page). However, it seems that going to the login page and/or being redirected to the login page still creates anonymous user records in the ac_User database. On Friday, we got several sets of entries in the error log similar to these:
2014-06-20 09:36:59,451 ERROR niqueResultException query did not return a unique result: 2
2014-06-20 09:36:59,649 ERROR AbleCommerce An error has occured at https://_._.com/login.aspx?ReturnUrl=/Members/MyOrder.aspx?OrderNumber=10225&OrderNumber=10225
System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> NHibernate.NonUniqueResultException: query did not return a unique result: 2
at NHibernate.Impl.AbstractQueryImpl.UniqueElement(IList list)
at NHibernate.Impl.CriteriaImpl.UniqueResult[T]()
at CommerceBuilder.Users.UserRepository.LoadForUserName(String userName, Boolean createMissing)
at CommerceBuilder.Services.Membership.WebUserLocator.Locate()
at CommerceBuilder.Common.AbleContext.get_User()
at AbleCommerce.ConLib.StoreHeader.Page_Load(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
2014-06-20 09:36:59,747 ERROR niqueResultException query did not return a unique result: 2
2014-06-20 09:37:02,769 ERROR niqueResultException query did not return a unique result: 2
2014-06-20 09:37:02,769 ERROR AbleCommerce An error has occured at http://_._.com/Errors/GeneralError.aspx?aspxerrorpath=/login.aspx
NHibernate.NonUniqueResultException: query did not return a unique result: 2
at NHibernate.Impl.AbstractQueryImpl.UniqueElement(IList list)
at NHibernate.Impl.CriteriaImpl.UniqueResult[T]()
at CommerceBuilder.Users.UserRepository.LoadForUserName(String userName, Boolean createMissing)
at CommerceBuilder.Services.Membership.WebUserLocator.Locate()
at CommerceBuilder.Common.AbleContext.get_User()
at CommerceBuilder.Services.PageTracker.Track(HttpApplication application, HttpContext context)
at CommerceBuilder.Services.HttpModule.a(Object A_0, EventArgs A_1)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Several notes:
1. I replaced our actual web site domain name with _._.com; the full correct name is in the error log.
2. The forum is shortening the URLs in the error message and creating links; the error log has the full URLs.
2. The entries that start with the timestamp, then "ERROR niqueResultException" do not show up in the Admin "Vew Error Log" page, just in the app.log file. The "U" is actually missing from "UniqueResultException" in all these lines.

I looked in the ac_Users table and there were 2 different anonymous users with the same UserName value (the random GUID-type number). Any idea what would cause this? The user getting the error was using FireFox, although I have no way of knowing if that contributed to the cause of the error. They have "real" user info in the ac_Users table and have used the site before without problems. I'm considering adding a unique constraint to the UserName column of the ac_Users table, would that cause any problems elsewhere in AbleCommerce, or potential problems during future updates?
Jay

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2651
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: Duplicate anonymous usernames

Post by Katie » Tue Jun 24, 2014 1:38 pm

Hi Jay,

I did some digging and found an unresolved issue reported in our bug tracking system. Unfortunately, it was some random thing that happened awhile back, and we never could figure out how to reproduce it, so the issue was set aside. I have moved it up in the queue and asked a developer to look at your forum post here to see if he has any ideas.

So, you are saying this user who went to your login form had an existing registered account and AC logged an anonymous record on his first visit? Almost seems cookie related, but I guess the real question is the random GUID number and why it ended up being a duplicate.

Hopefully, you'll have an update soon.

Thanks
Katie
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

jguengerich
Commodore (COMO)
Commodore (COMO)
Posts: 436
Joined: Tue May 07, 2013 1:59 pm

Re: Duplicate anonymous usernames

Post by jguengerich » Tue Jun 24, 2014 1:59 pm

Katie,

Thanks for looking into it. This customer has a valid user set up and has logged in with it many times without problems. I don't know if AC created the anonymous record on his first visit, or sometime since then, or on Friday when the error occurred. This is the first time he got this error. It happened once before for an internal test user while I was developing the site, but I also could not reproduce it and moved on to other things without ever submitting a bug report or forum post.

I did a little testing just now with my user, and if I type in an address that causes me to be redirected to the login page, one of the anonymous records in the ac_Users tables has it's LastActivityDate updated. Then, once I log in, my specific record in the ac_Users table has it's LastActivityDate updated. I don't know if that is useful info or not.
Jay

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Duplicate anonymous usernames

Post by jmestep » Wed Jun 25, 2014 3:47 am

I just remembered that I had seen that error in the past and their were two entries for the same person in the database. I remember going to the database and deleting one of them. I'll see if I can find any notes about it.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Duplicate anonymous usernames

Post by mazhar » Thu Jun 26, 2014 2:28 am

jguengerich wrote:Katie,
I did a little testing just now with my user, and if I type in an address that causes me to be redirected to the login page, one of the anonymous records in the ac_Users tables has it's LastActivityDate updated. Then, once I log in, my specific record in the ac_Users table has it's LastActivityDate updated. I don't know if that is useful info or not.
This is because when you login your user is migrated from anonymous to registered user record. This behavior is correct and makes sense. Not sure about duplicate GUID though. Considering it happened to different people its something real but hard to reproduce. I will do some research about GUID, Let's see if I can get it to reproduce or maybe found some hint in direction.

jguengerich
Commodore (COMO)
Commodore (COMO)
Posts: 436
Joined: Tue May 07, 2013 1:59 pm

Re: Duplicate anonymous usernames

Post by jguengerich » Fri May 15, 2015 10:58 am

This just occured again, and I realized I never got an answer to the last question in my first post:
I'm considering adding a unique constraint to the UserName column of the ac_Users table [to prevent duplicates from being created in the first place], would that cause any problems elsewhere in AbleCommerce, or potential problems during future updates?

I resolved the issue again by manually deleting one of the duplicate ac_Users records (which required deleting the matching ac_Baskets record first).
Jay

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Duplicate anonymous usernames

Post by mazhar » Fri May 15, 2015 8:30 pm

The problem with duplicate username creation was fixed in R9. In R9 change log here http://help.ablecommerce.com/upgrades/a ... _to_r9.htm the change was made under
[AC8-2436] - UserRepository.LoadForUserName(): query did not return a unique result

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2651
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: Duplicate anonymous usernames

Post by Katie » Sun May 17, 2015 7:07 am

Hi Jay,

If you are unable to upgrade, I can track down the source code changes to fix this issue.

Just let me know,

Katie
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

jguengerich
Commodore (COMO)
Commodore (COMO)
Posts: 436
Joined: Tue May 07, 2013 1:59 pm

Re: Duplicate anonymous usernames

Post by jguengerich » Mon May 18, 2015 8:16 am

Hi Katie,

Yes, the source code changes would be helpful, thanks. I don't see any changes in UserRepository.LoadForUserName() itself.
Jay

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2651
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: Duplicate anonymous usernames

Post by Katie » Tue May 19, 2015 6:16 am

Hi Jay,

Do you have the source for Gold R9 available to look at? The change was made in /CommerceBuilder/Services/Membership/WebUserLocator.cs

I'll try to email you the exact changes so you can see what to look for. You should have this within 5 min.

Thanks
Katie
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

Post Reply