[Mono-bugs] [Bug 633945] New: [Windows] some async HttpWebRequest or its underlying layer fails to invoke callback
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Tue Aug 24 04:33:15 EDT 2010
https://bugzilla.novell.com/show_bug.cgi?id=633945
https://bugzilla.novell.com/show_bug.cgi?id=633945#c0
Summary: [Windows] some async HttpWebRequest or its underlying
layer fails to invoke callback
Classification: Mono
Product: Mono: Class Libraries
Version: SVN
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: System
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: aenomoto at novell.com
QAContact: mono-bugs at lists.ximian.com
CC: gonzalo at novell.com
Found By: ---
Blocker: ---
I noticed that on Windows some HttpWebRequest, async delegate or something else
does not work as it does on Linux. HttpWebRequest fails to invoke AsyncCallback
before timeout, probably BeginGetStream() callback is not invoked.
What is interesting is that it sends the actual request *after* the timeout
happens.
Repro server and client (client matters):
// ---- server ----
using System;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Threading;
public class Test
{
public static void Main ()
{
var b = new BasicHttpBinding ();
var cl = b.BuildChannelListener<IReplyChannel> (new Uri
("http://localhost:8989"));
cl.Open ();
var ch = cl.AcceptChannel ();
ch.Open ();
var rc = ch.ReceiveRequest ();
Console.WriteLine ("Request received");
Console.WriteLine (rc.RequestMessage);
var msg = Message.CreateMessage (MessageVersion.Soap11,
"http://tempuri.org/EchoResponse", "echo");
rc.Reply (msg);
Thread.Sleep (3000);
}
}
// ---- client ----
using System;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
public class Test
{
public static void Main ()
{
var cf = new ChannelFactory<ITestService> (
new BasicHttpBinding (),
new EndpointAddress ("http://localhost:8989"));
var ch = cf.CreateChannel ();
//ch.Echo ("test"); // works. (error)
ch.EndEcho (ch.BeginEcho ("test", null, null));
}
}
[ServiceContract]
public interface ITestService
{
[OperationContract] // sync
string Echo (string input);
[OperationContract (AsyncPattern = true)]
IAsyncResult BeginEcho (string input, AsyncCallback cb, object state);
string EndEcho (IAsyncResult result);
}
--------
Another couple of working cases are:
- Sync operation. By using "Echo" instead of "BeginEcho" / "EndEcho", it works
fine.
- A simpler client example that does not involve client "proxy" just works (in
async operation), so it's not simply HttpWebRequest issue as a standalone.
Example below:
// ---- working client ----
using System;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Threading;
public class Test
{
public static void Main ()
{
var b = new BasicHttpBinding ();
var cf = b.BuildChannelFactory<IRequestChannel> ();
cf.Open ();
var ch = cf.CreateChannel (new EndpointAddress
("http://localhost:8989"));
ch.Open ();
var msg = Message.CreateMessage (MessageVersion.Soap11, "urn:foo",
"echo");
ch.EndRequest (ch.BeginRequest (msg, null, null));
}
}
--------
It's looking like some threading issue regarding async delegate invocation, but
I could only identify the issue to this extent so far.
CCing Gonzalo as he might have some inputs.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list