[Mono-list] Fw: Bug with multiple threads in XSP ?

Tiago Lima tiago.lima@vianw.pt
Fri, 21 Nov 2003 21:12:08 -0000


This is a multi-part message in MIME format.

------=_NextPart_000_0047_01C3B074.1F46E2A0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_001_0048_01C3B074.1F46E2A0"


------=_NextPart_001_0048_01C3B074.1F46E2A0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi again,

Yes ! I've did it ! Here is a sort of test to demonstrate a bug in the =
XSP
server... Hope this helps :)
The file "MainClass1.cs" launches a couple of threads that request the =
same
page and display the length of the response.
It is supposed to be always the same value...

Instructions:
    - The files "MyButton.cs" and "ViewStateTester.aspx" are part of the
site to test.
         - compile with:
                    $ mcs *.cs
/t:library -r:System.Web.dll -out:bin/MyButton.dll

    - The file MainClass1.cs has a main method that launches a couple of
threads making requests to the site.
            - please replace <site> the site to test.
            - it displays the number of bytes returned by the xsp =
server...
Some request shows different lengths...

If you need more information I'am available. I would appreciate some =
kind of
urgency...

Thanks,
    Tiago Lima

------=_NextPart_001_0048_01C3B074.1F46E2A0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.3790.94" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>Hi again,<BR><BR>Yes ! I've did it ! Here is a sort of test to =
demonstrate=20
a bug in the XSP<BR>server... Hope this helps :)<BR>The file =
"MainClass1.cs"=20
launches a couple of threads that request the same<BR>page and display =
the=20
length of the response.<BR>It is supposed to be always the same=20
value...<BR><BR>Instructions:<BR>&nbsp;&nbsp;&nbsp; - The files =
"MyButton.cs"=20
and "ViewStateTester.aspx" are part of the<BR>site to=20
test.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - compile=20
with:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
$ mcs *.cs<BR>/t:library -r:System.Web.dll=20
-out:bin/MyButton.dll<BR><BR>&nbsp;&nbsp;&nbsp; - The file MainClass1.cs =
has a=20
main method that launches a couple of<BR>threads making requests to the=20
site.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p; -=20
please replace &lt;site&gt; the site to=20
test.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p; - it=20
displays the number of bytes returned by the xsp server...<BR>Some =
request shows=20
different lengths...<BR><BR>If you need more information I'am available. =
I would=20
appreciate some kind =
of<BR>urgency...<BR><BR>Thanks,<BR>&nbsp;&nbsp;&nbsp; Tiago=20
Lima<BR></DIV></BODY></HTML>

------=_NextPart_001_0048_01C3B074.1F46E2A0--

------=_NextPart_000_0047_01C3B074.1F46E2A0
Content-Type: application/octet-stream;
	name="MainClass1.cs"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="MainClass1.cs"


using System;
using System.IO;
using System.Net;
using System.Threading;

namespace FLMIDTests
{
	public class MainClass
	{
		public static void Main(string[] args)
		{
			for(int i =3D 0; i < 50; i++)
			{
				RequestThread request =3D new RequestThread();
				Thread thread =3D new Thread(new ThreadStart(request.Run));
				thread.Start();
			}
		}
	}
=09
	public class RequestThread
	{
		public void Run()
		{
			// Create a new WebRequest Object to the mentioned URL.
			WebRequest myWebRequest =3D =
WebRequest.Create("http://<site>/ViewStateTester.aspx");
			Console.WriteLine("\nThe Uri that responded for the Request is   =
{0}", myWebRequest.RequestUri);
		=09
			// Assign the response object of 'WebRequest' to a 'WebResponse' =
variable.
			WebResponse myWebResponse =3D myWebRequest.GetResponse();
		=09
			// Print the HTML contents of the page to the console.
			Stream streamResponse =3D myWebResponse.GetResponseStream();
			StreamReader streamRead =3D new StreamReader( streamResponse );
		=09
			System.Console.WriteLine(streamRead.ReadToEnd().Length);
		=09
			Console.WriteLine("\nThe Uri that responded for the Request is =
'{0}'", myWebRequest.RequestUri);
		}
	}
}

------=_NextPart_000_0047_01C3B074.1F46E2A0
Content-Type: application/octet-stream;
	name="ViewStateTester.aspx"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="ViewStateTester.aspx"

<%@ Register TagPrefix=3D"Control" Namespace=3D"ViewStateTests" =
Assembly=3D"MyButton" %>

<%@ Page Language=3D"C#" EnableViewState=3D"true" %>

<html>
<body>

<form runat=3D"server">
	<Control:MyButton id=3D"button1" runat=3D"server" />
</form>

<img src=3D'fdskdfsdh' runat=3D"server" />

<b>This page tests the view state capability of mono !</b>
<b>This page tests the view state capability of mono !</b>
<b>This page tests the view state capability of mono !</b>
<b>This page tests the view state capability of mono !</b>
<b>This page tests the view state capability of mono !</b>

<form runat=3D"server">
	<Control:MyButton id=3D"button2" runat=3D"server" />
</form>

<b>This page tests the view state capability of mono !</b>
<b>This page tests the view state capability of mono !</b>
<b>This page tests the view state capability of mono !</b>
<b>This page tests the view state capability of mono !</b>
<b>This page tests the view state capability of mono !</b>

<form runat=3D"server">
	<Control:MyButton id=3D"button3" runat=3D"server" />
</form>

<b>This page tests the view state capability of mono !</b>
<b>This page tests the view state capability of mono !</b>
<b>This page tests the view state capability of mono !</b>
<b>This page tests the view state capability of mono !</b>
<b>This page tests the view state capability of mono !</b>

<form runat=3D"server">
	<Control:MyButton id=3D"button4" runat=3D"server" />
</form>

<b>This page tests the view state capability of mono !</b>
<b>This page tests the view state capability of mono !</b>
<b>This page tests the view state capability of mono !</b>
<b>This page tests the view state capability of mono !</b>
<b>This page tests the view state capability of mono !</b>

<form runat=3D"server">
	<Control:MyButton id=3D"button5" runat=3D"server" />
</form>

<b>This page tests the view state capability of mono !</b>
<b>This page tests the view state capability of mono !</b>
<b>This page tests the view state capability of mono !</b>
<b>This page tests the view state capability of mono !</b>
<b>This page tests the view state capability of mono !</b>

</body>
</html>

------=_NextPart_000_0047_01C3B074.1F46E2A0
Content-Type: application/octet-stream;
	name="MyButton.cs"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="MyButton.cs"


using System.Web.UI.WebControls;

// mcs *.cs /t:library -r:System.Web.dll -out:bin/MyButton.dll

namespace ViewStateTests
{
	public class MyButton : Button
	{
		protected override void OnLoad(System.EventArgs e)
		{
			string garbage =3D "";
		=09
			for(int i =3D 0; i < 100; i++)
				garbage +=3D "$&=3D?(B? QW#?(F=C2=BB#!?( V#=3D/\"!=C2=BB/=3D =
!\"%/=3D=C2=BB\"#/ %\"";
		=09
			ViewState.Add("a", garbage);
		}
	}
}

------=_NextPart_000_0047_01C3B074.1F46E2A0--