Emulating multiple clients to a web server - session

If possible i want to use my computer to emulate multiple clients (like TPC-W) on a web server, i tried to use Htmlunit however when i created two WebClient() they had the same login session (when one logged in the other was logged in as well in a stateful bean, it causes the second one to crash because the login form disappears after the logging in).
The reason i'm not using TPC is because i want to benchmark on my own web pages. I'd like to know if it is possible to use TPC to emulate my own pages or a library/trick that can do the job.

It seems the answer to my question was written in the following question.
prevent Shared session with multiple browser windows
The answer is: multiple logins in a single session. Thanks goes to user191966 for the answer.

Related

How many viewer/subcriber will be consider if same user open the webpage in two different tabs, connecting to a session?

I have just came across a usecase in which same user (or user with same token) have to connect the session twice, what actually I found everything is working fine. But still curious to know.
In tokbox, if a user joins with two different tabs that is same token what will be happened at server end of tokbox and will it be consider two different viewer?
This will be two connections within the session - so different "viewers", yes. Each connection will be publishing and subscribing-to its own streams, so could be doing different things. This is unusual use case (which typically causes audio feedback etc.) so make sure this is what you really want in your design.

IIS hangs on specific route requests in ASP.NET MVC 3 app UNLESS running in debugger

We have a very strange issue that we're dealing with.
We have an MVC 3 application that we are still developing, and Monday we started running into an issue with four specific routes (methods) in one of our controllers. All four of these routes are used in the management of roles and deal with either creating or editing a role. We have two different tiers of roles in the application, so there are two routes for creating a role for each tier, and two routes for editing a role for each tier. Both methods for the corresponding create routes call the same view, as well as the two methods for the corresponding edit routes. Both views call a shared partial view that contains the form fields that correspond to the properties of the role being created or edited.
Here's the issue.
If I attempt to hit these routes without running the debugger first, IIS will hang. It will not error out, throw an error, or even register the request in the IIS log.
HOWEVER, if I attempt to access those routes in the debugger, regardless of whether I have a breakpoint set up or not, the routes function as they should.
To make life a little more interesting, if I attempt to access those same routes AFTER I've run and shut down the debugger, the routes STILL function as they should.
We can reproduce this behavior on EVERY machine on our development team AND our staging server (except the debugging part on staging).
The methods that correspond to all of these routes themselves rely on a couple of methods in the same web service in our middle tier. Those methods work properly outside of the debugger in our integration tests.
We've checked for endless loops in the code, but can't find anything that would create an endless loop under these conditions. In fact, there's only one loop in the shared view, but it's a for each loop which shouldn't ever result in an endless loop.
Lastly, when I attempt to hit any of these four routes without running under the debugger or at least running it on a previous request, IIS essentially hangs. It will not time out. It will not throw an error. It will not log an error to the IIS log. Finally, it will eat up system resources the the point that you have to either restart IIS or reboot the entire machine.
Has anyone ever seen this behaviour before? Any ideas on how to get around it? I've NEVER seen this behavior before, and the only thing that anyone in our development group could come up with was some sort of permissions issue on a file, but we're not accessing the file system (outside of the view files themselves, and they have proper permissions) at any point during the processing of these methods.
I'm open to any and all suggestions.
UPDATE #1:
I have also posted this question on the ASP.NET forums and I had someone ask a question for more information. Here's my response to their questions.
What IIS are we talking about?
IIS 7.5. We're using the full-fledged IIS, not IIS Express.
What error?
That's just it. There is no error. No error is being reported. In fact, the request itself isn't being recorded in the IIS log for the site IF we're attempting to access these routes without the debugger running. If the debugger is running, everything works as you would expect it to.
VS Cassini?
Nope. IIS 7.5 that comes with Windows 7.
If you deploy on IIS a default WebForm project , does it works?
Yes. Without an issue. I actually have a number of WebForms applications that I maintain for customers running on my development box. They all work without any issue whatsoever.
If you deploy on IIS a default MVC project , does it works?
Yes. I have a number of sites running on this box. All of these sites are running without a hitch. IN FACT, the vast majority of routes on this site can be accessed without any issue. The vast majority of routes WITHIN THIS VERY CONTROLLER can be accessed without any issue!!!
To reiterate, this controller allows a user to manage users, roles, and permissions within the application. We have methods in there for listing, creating, and updating users, roles, and permissions. The routes that hit the methods for managing users and permissions work regardless of whether the debugger is running or not. The ONLY routes giving us issues are the four routes that I described above.
We currently have 19 controllers in this application, each with a varying number of defined route methods. EVERY OTHER route defined for the application is working properly and is not exhibiting this behavior. These are the only four methods (routes) in this one particular controller where we are seeing this.
UPDATE #2:
I've narrowed this down to a REST call (to a service that we control) within the controller. Here's the weird part - if I go into the REST service and immediately return a value (don't process anything), it still hangs outside of the debugger. If I'm running inside of the debugger or immediately after running the debugger, everything works as it should.
If I attempt to hit that REST service in fiddler directly, it works like a charm.
I'm going to try changing the URL in the service contract for the web service I'm calling and see if that works. Maybe it's something to do with the REST URL on the web service.
UPDATE #3:
Just to add further confusion, I set up Fiddler to act as a proxy between my MVC application and the REST middle tier. For EVERY other REST call within the application, the proxy gets the request. For this particular REST call, the proxy NEVER gets the request.
Now here's the annoying part. The WebChannelFactory that we use to call all of the methods in the middle tier through REST is created using a utility class in our MVC application. This code is used to generate every channel, so there's no difference between the requests that populate the list of users and the one that populates the list of permissions (the one that's hanging).
This is a GET request that's hanging, so I was able to call it directly in the browser. It works without an issue. The issues doesn't appear to be on the service end, but somewhere in the MVC application.
Make sure that you don't pass in ViewBag.Variable.ToString(), since it's dynamic, it will not work!

Is it possible to share one HttpSession object with multiple browser windows?

Does Tomcat absolutely guarantee that sessions and browser windows have 1-to-1 relationship? Or it is possible to have multiple windows sharing one HttpSession, for example when pressing Ctrl-N?
This is not server specific and can also not be controlled from the server side on. This is client (webbrowser) specific and can only be controlled by client side configuration (whenever available). By default, all modern browsers share the same cookies and thus also the session among all instances (all windows and tabs). Only in Chrome, you can open a new "Incognito" window using Ctrl+Shift+N which will create an entirely separate session.
See also:
How do servlets work? Instantiation, sessions, shared variables and multithreading
The session is bound to the JSESSIONID cookie, so it'll be shared across the windows from the same browser. If you want two sessions you can use two browsers side by side, like Firefox and Chrome.

Changing domain linked to a Selenium::Client::Driver instance

I'm using the Selenium Client (v 1.2.18) to do automated navigation of retail websites for which there exists no external API. My goal is to determine real-time, site-specific product availability using the "Check Availability" button that exists on a lot of these sites.
In case there's any concern, each of these checks will be initiated by a real live consumer who is actually interested in whether or not something's available at that store. There will be no superfluous requests or other internet badness.
I'm using Selenium's Grid framework so that I can run stuff in parallel and I'm keeping each of the controlled browsers open between requests. The issue I'm experiencing is that I need to perform these checks across a number of different domains, and I won't know in advance which one I will have to check next. I didn't think this would be too big an issue, but it turns out that when a Selenium browser instance gets made, it gets linked to a specific domain and I haven't been able to find any way to change what domain that is. This requires restarting a browser each time a request comes in for a domain we're not already linked to.
Oh, and the reason we're using Selenium instead something more light-weight (eg. Mechanize) is because we need something that can handle JavaScript.
Any help on this would be greatly appreciated. Thanks in advance.
I suppose you are restricted from changing domain because of same origin policy. Did you try using browser with elevated security privileges like iehta for internet explorer and chrome for firefox browsers. While using these modes of browsers, use open method in your tests and pass the URL which you want to open. This might solve your problem.

How does web applications handle multiple browser window

I have a very basic knowledge of the web programming, and I couldn't figure out the answer to this question.
Typically, a cookie is used to identify a session in web applications. However, as far as I know, multiple browser windows share cookies. In that case, how does web applications distinguish between the tabs?
Edit: I guess all the answers are saying the same thing - there is no standard way to handle this. Ok. Thanks for resolving my uncertainty guys.
However, as far as I know, multiple browser windows share cookies. In that case, how does web applications distinguish between the tabs?
It cannot distinguish at all. Hence comes the challenge for web developers - make their application robust to prevent data destruction or unauthorized operations when access is performed from some other "outdated" tab.
They don't. The application does not know that you have two tabs open. If you are tracking sessions then it can know that you have two sessions open.
What are you trying to accomplish?
They don't. You have one cookie per different browser (ff/ie/ google chrome).
You'll have to distinguish the tabs client-side (ie Javascript).

Resources