Welcome Guest Search | Active Topics | Log In | Register

Header Issues - Critical Options · View
airsickmoth
#1 Posted : Thursday, February 14, 2008 1:43:53 AM
Rank: Advanced Member


Joined: 1/15/2008
Posts: 60
Location: Vancouver, Canada
Hey, haha, sorry to keep bringing in bad news like this, but I'm testing out my system with the help of a bunch of our users (only about 15) so there are some load issues coming up.

The biggest issue is that of the header.

When the pages loads, sometimes the header loads for a different user. It seems that if the server is serving to users at once, the yafcontext gets a little bit mixed up and loads at least the header for a different user.

If I am loading a page as an admin, I sometimes get a header that shows me logged in as a different user and show their header links for their permission. It only seems to happen infrequently, and on the next page load, the header gets loaded for the proper account.

The rest of the page load is in question. Sometimes it seems to load with my permissions, sometimes it seems to load with their permissions. It doesn't look like anyone can go out and post as another user or change admin settings as it will fail by permission on the next pageload. But its rather concerning.

I'm going to be working on this problem myself the rest of the day. If anyone has any pointers or quick fixes that can get this sorted out it would be great. But its looking like a cache or session issue.
airsickmoth
#2 Posted : Thursday, February 14, 2008 4:01:57 AM
Rank: Advanced Member


Joined: 1/15/2008
Posts: 60
Location: Vancouver, Canada
quick update while I'm working on a solution:

Correct me if I'm wrong anywhere.

Yafcontext appears to be a singleton retrieved using a static member.

Static variables are app wide, not session. So if two different clients are calling pagecontext at the same time, they could be reading the same static "current" member. In paticular the current user membership object. One client could load theirs into the static var, then another can read it because its not null?

Am I right so far?
airsickmoth
#3 Posted : Thursday, February 14, 2008 4:35:30 AM
Rank: Advanced Member


Joined: 1/15/2008
Posts: 60
Location: Vancouver, Canada
Possible solution I am testing. I replaced the original Static Singleton with a "session" singleton.

Code:

public static YafContext Current
{
        get
    {
            YafContext context = null;
            if (HttpContext.Current.Session["yaffContextSession666"] == null)
            {
               context = new YafContext();
               HttpContext.Current.Session["yaffContextSession666"] = context;
            }
            else
               context =(YafContext)HttpContext.Current.Session["yaffContextSession666"];
            return context;
                   
    }
}


I put the 666 on the end to make sure I'm not conflicting with any other possible session vars.

So far there are no problems with the Header showing the wrong name. I'll keep testing and see what happens.

Any comments on possible problems or issues? There might be performance and resource issues, because some of the things in the context are app wide and not session based?
Jaben
#4 Posted : Thursday, February 14, 2008 8:57:41 AM

Rank: YAF Head Dude



Joined: 10/10/2004
Posts: 2,963
Location: Honolulu, HI
Hmm... Good eye moth. I think you are correct. Yes, it hasn't been tested under load yet so I'm happy someone is brave enough to try that. (And smart enough to help with a complex bug.)

Instead of the "666" Session, I think I'll go with this solution:

http://dotnetslackers.co..._2D00_Page-pattern.aspx

Strictly speaking -- a singleton isn't what I'm going for here. I just want an instance per page.
"When you are grateful, fear disappears and abundance appears”."

Jaben
#5 Posted : Thursday, February 14, 2008 9:30:20 AM

Rank: YAF Head Dude



Joined: 10/10/2004
Posts: 2,963
Location: Honolulu, HI
The SVN has been updated with a fix if you want it. Hopefully it works good now. I haven't tested it under load.
"When you are grateful, fear disappears and abundance appears”."

S_lam
#6 Posted : Tuesday, September 23, 2008 1:08:53 PM

Rank: YAF Forumling


Joined: 8/27/2007
Posts: 6
Location: egypt
i want to say thanks to you

but i have the same problem for that can you explain your solution in details i mean where the code will be replaced with your code Cheesy Grin

thanks again
CodeJunky2008
#7 Posted : Thursday, October 02, 2008 10:08:23 AM
Rank: Member


Joined: 4/24/2008
Posts: 27
Location: East Sussex UK
Jaben wrote:
The SVN has been updated with a fix if you want it. Hopefully it works good now. I haven't tested it under load.


Hi

I have seen this behaviour twice now and would love to implement the fix, where can I find the SVN (latest code release). I will create another thread but I am getting a cache problem that newly added moderators are getting redirected to first category until i clear the cache. Are these things related.

thanks

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAFPro Theme Created by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.3 RC2 | YAF © 2003-2008, Yet Another Forum.NET
This page was generated in 0.110 seconds.

SourceForge.net Logo Powered by ASP.NET v2.0 411ASP.NET