69 Commits
Author SHA1 Message Date
Paul Fertser 62c0db6457 [wcf] Fix memory leak processing requests
This partially reverts commit 1628f04de5 .

Runtime tested and confirmed to fix issue #8970 and allows long-term
operation of RapidSCADA.
2018-06-01 17:38:04 +02:00
hgy59 abebff426a [WCF] fix ChannelDispatcher by accepting InstanceProvider (#7909)
* WCF: ChannelDispatcher/ListenerLoopManager.Setup validate InstanceProvider, not InstanceContextProvider
- the creation of endpoints requires an instance provider or a default constructor
- InstanceProvider vs InstanceContextProvider was obviously a typo

* include InstanceContextProvider for validation as before
- two unittests failed due InstanceProvider is null and ed.DispatchRuntime has not type set
- comment for the validation is not useful anyway (It is tested at Open(), but strangely it is not instantiated at this point.)
2018-04-03 14:31:14 +02:00
Paul Fertser dd4dbd8d4b [System.ServiceModel] Prevent crash in Dispatcher.ListenerLoopManager… (#7136)
In certain cases of having concurrent WCF requests
HttpReplyChannel.TryReceiveRequest can return true with the context
being null ("at closing phase").

This patch prevents crashing the whole application with a
NullReferenceException as reported in issue #7134.

Whether this is just covering the issue over or a real fix is yet to be
determined.

Fixes https://github.com/mono/mono/issues/7134
2018-02-20 14:05:05 -05:00
Alexander Köplinger 9e91b6687e [System.ServiceModel] Don't use DateTime.Now for measuring elapsed time
Use Stopwatch or DateTime.UtcNow instead which aren't affected
by things like daylight-saving time
2017-07-02 23:31:34 +02:00
Alexander Köplinger 2dda624df4 [System.ServiceModel] Make looper thread in ChannelDispatcher a background thread and join instead of abort
This showed up when switching to nunit-lite since it runs all tests in the same AppDomain,
meaning it won't exit when any foreground threads are still running. This was the case
with the thread created by ChannelDispatcher which was still waiting on a connection.

Also try to Join() the thread for a bit so it exits gracefully before trying to abort,
might resolve issues like in https://github.com/mono/mono/pull/3819
2016-10-29 14:09:42 +02:00
Miguel de Icaza 28f473c41d Merge pull request #1225 from strawd/bug22307
Fix for bug 22307 - Intermittent IndexOutOfRangeException on closing connection
2015-09-23 15:34:55 -04:00
Zoltan Varga e71bf630bc [bcl] Fix test failures in the System.ServiceModel tests after 9ffb681d06. 2015-08-15 22:26:59 -04:00
Miguel de Icaza 5715cdc582 [System.ServiceModel] Prevent server crash when client disconnect
This patch is an updated version of a pull request (377) from Rob
Wilkens to fix #5926
2015-02-16 10:01:22 -05:00
David Straw 5b6c684d26 Fix for bug 22307 - Intermittent IndexOutOfRangeException on closing connection 2014-08-22 11:50:08 -06:00
Martin 5aecac0f33 completes commit 4f3d21e46e 2011-12-29 15:38:58 +01:00
QuickJack 4f3d21e46e Fixes CS0168 in System.ServiceModel.dll 2011-12-29 15:28:26 +01:00
Atsushi Eno 0045240824 Enable environment-controled output on non-moon profile too. Add error logging. 2011-04-25 15:35:03 +09:00
Atsushi Eno a316b856d0 Get real fix for bug #687902. Revert request processor IDisposable.
and handle session shutdown when creating InstanceContext.
Also add note on DisposeInstance(), which got me stuck.
2011-04-20 19:11:34 +09:00
Atsushi Eno 5c306c5d04 Ongoing service channel closing fix and session management in ChannelDispatcher.
It is part of bugfix 687902.

To get the bug fixed, the new "using" sections in ChannelDispatcher.cs to
explicitly dispose channels. But this causes regression in PerSession-based
tests. So some new session management code is (likely) required as well.

It will also alter "mixed" MaxConcurrentCalls and MaxConcurrentSessions with
correct management code.
2011-04-20 16:52:36 +09:00
Marek Habersack d4bb1c86b7 [wcf] make /js and /jsdebug dispatchers work.
There were several issues here:

- The IChannelDispatcherBoundListener was defined twice, in two different namespaces, and it caused code in
  ChannelDispatcher.Attach not to set its associated listener's ChannelDispatcher property to the correct value.
  This, in turn, caused incorrect HttpListenerManagerTable operation, where it would put the "/js" and "/jsdebug"
  dispatchers in separate HttpListenerManagers, instead of in the main (base) service's one.
- After fixing the above, it turned out that SvcHttpHandler selected the manager based on the host's base address,
  when it should first try to find one whose URL matches the current request exactly.
2010-10-20 15:04:37 +02:00
Atsushi Eno d46518eef2 2010-07-12 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : apply ErrorHandlers to IInputChannel too.


svn path=/trunk/mcs/; revision=160228
2010-07-12 09:43:24 +00:00
Atsushi Eno b177dfdc22 2010-07-09 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : do not swallow exception during
	  RequestContext.get_RequestMessage() and thus return SOAP Fault for
	  MessageSecurityException to the client.


svn path=/trunk/mcs/; revision=160122
2010-07-09 12:36:21 +00:00
Atsushi Eno e9f74b8a85 2010-07-08 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : support ErrorHandlers.


svn path=/trunk/mcs/; revision=160041
2010-07-08 10:30:40 +00:00
Atsushi Eno ab39e8acac 2010-07-05 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs :
	  moved IChannelDispatcherBoundListener from HttpChannelListener.cs.

	* SvcHttpHandler.cs : removed old code and #if blocks.

	* HttpStandaloneReplyChannel.cs
	  HttpStandaloneRequestContext.cs
	  HttpStandaloneChannelListener.cs
	  HttpReplyChannel.cs
	  HttpRequestContext.cs
	  HttpChannelListener.cs : renamed former 3 files to latter 3 files.

	* System.ServiceModel.dll.sources :
	  renamed new HTTP channel listener implementation sources, and
	  removed old sources.



svn path=/trunk/mcs/; revision=159913
2010-07-05 17:29:24 +00:00
Atsushi Eno b1be2aea6f 2010-06-24 Atsushi Enomoto <[email protected]>
* HttpTransportBindingElement.cs :
	  Use new HTTP channel listener implementation.

	* ChannelDispatcher.cs : enable service throttling again.
	  This time Http(Listener), ASP.NET and TCP listeners all work.

	* System.ServiceModel.dll.sources :
	  add new HTTP channel listener implementation sources.

	  Old sources will be kept for a while, won't entirely vanish as
	  ASP.NET support will live there.


svn path=/trunk/mcs/; revision=159491
2010-06-24 12:07:13 +00:00
Atsushi Eno 975c8846f8 2010-06-21 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : raise an error if IChannelListener is
	  already opened when it's opening.


svn path=/trunk/mcs/; revision=159267
2010-06-21 13:56:53 +00:00
Atsushi Eno d24448c5b9 2010-06-21 Atsushi Enomoto <[email protected]>
* ServiceThrottle.cs : take ChannelDispatcher to validate setters.

	* ServiceThrottlingBehavior.cs : pass channel dispatcher for .ctor.

	* ServiceHostBase.cs : remove extra throttling field.


svn path=/trunk/mcs/; revision=159232
2010-06-21 07:44:07 +00:00
Atsushi Eno 1f4684cd40 2010-06-17 Atsushi Enomoto <[email protected]>
* ServiceHostBase.cs : retrieve MessageVersion and raise an error
	  if there is none. (Check this earlier than building a listener.)

	* ChannelDispatcher.cs : MessageVersion check is moved to
	  ServiceHostBase.

	* ServiceMetadataExtension.cs : overwrite MessageVersion to use None.
	  (The only special case I found for ChannelDispatcher.MessageVersion.)

	* CustomBindingTest.cs : add tests for MessageVersion check on Open().

	* MetadataExchangeBindingsTest.cs : make sure that special casing of
	  MessageVersion does not happen at this layer.


svn path=/trunk/mcs/; revision=159061
2010-06-17 10:48:55 +00:00
Atsushi Eno 9e08c76462 2010-05-21 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : disable slottling again :( It still fails
	  to process concurrent requests if there is service metadata channel
	  and MaxConcurrentSessions > 1 on non-ASP.NET channels.


svn path=/trunk/mcs/; revision=157670
2010-05-21 09:16:37 +00:00
Atsushi Eno 79a9bcb766 2010-05-21 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : enable throttling again. Though issues
	  regarding parallel request is not here (multiple dispatchers
	  can accept a channels for each), and HTTP channels do not accept
	  more than one channel at a time anyways.


svn path=/trunk/mcs/; revision=157662
2010-05-21 04:48:10 +00:00
Atsushi Eno 277acc8496 2010-04-28 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : add workaround to set ChannelDispatcher
	  to IChannelListener. Avoid null ChannelDispatcher in http listener.

	* HttpChannelListener.cs, HttpListenerManager.cs :
	  Fix NRE issue in olive/samples/wcf/web-http-binding/samplesvc3.exe.


svn path=/trunk/mcs/; revision=156344
2010-04-28 16:25:01 +00:00
Atsushi Eno a286cc646c 2010-03-30 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : differentiate EndpointNotFound and
	  ActionNotSupported so that FaultConverter can create appropriate
	  fault messages. Removed extra filter condition on null To item.
	  And create fault messages on *any* server side error, do not let
	  request client infinitely wait for the response until timeout.

	  (RunDestinationUnreachableTest() is still not working but it works
	  when it is SOAP 1.2.)


svn path=/trunk/mcs/; revision=154439
2010-03-30 10:28:51 +00:00
Atsushi Eno 3d135ccba1 2010-03-30 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : for faults, use fault namespace, not that of
	  ReplyAction. Added FIXME comment regarding dispatcher.


svn path=/trunk/mcs/; revision=154427
2010-03-30 07:35:56 +00:00
Atsushi Eno 0dcd75c5fc 2010-03-24 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : return EndpointDispatcher at initializing
	  for internal use. Add some locks. Patch by Matt Dargavel.

	* ServiceHostBase.cs : if there is an existing ChannelDispatcher
	  for the same endpoint URI, reuse it. Patch by Matt Dargavel.


svn path=/trunk/mcs/; revision=154114
2010-03-24 07:12:29 +00:00
Atsushi Eno 5049788319 2010-03-24 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : fix wrong method call in open_delegate.
	  Patch by Matt Dargavel.


svn path=/trunk/mcs/; revision=154111
2010-03-24 06:07:09 +00:00
Atsushi Eno 93dc6116a5 2010-03-24 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : give the actual exception message instead
	  of "error occured".


svn path=/trunk/mcs/; revision=154110
2010-03-24 06:04:22 +00:00
Atsushi Eno dd3adaa509 2010-02-18 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : revert previous change - it could result
	  in blocking some threads and block nunit completion.


svn path=/trunk/mcs/; revision=151960
2010-02-18 08:20:36 +00:00
Atsushi Eno 6032fc1874 2010-02-04 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : now I can enable service throttling to
	  handle more than one concurrent channels as ASP.NET reply channel
	  got fixed.

	* HTTP_listener_notes.txt: Fixed some wrong description, simplified
	  some, and updated some.


svn path=/trunk/mcs/; revision=150851
2010-02-04 11:52:57 +00:00
Atsushi Eno fb89844a39 2010-01-25 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : actually instance context provider could be
	  null through the entire service run.

	  Fixed all current nunit failures!


svn path=/trunk/mcs/; revision=150110
2010-01-25 09:01:04 +00:00
Atsushi Eno 79c79e577b 2010-01-22 Atsushi Enomoto <[email protected]>
* DuplexClientRuntimeChannel.cs : do not try to iterate channel
	  acceptor when it is being closed.

	* ChannelDispatcher.cs : do not try to iterate channel acceptor when
	  it is being closed.


svn path=/trunk/mcs/; revision=150047
2010-01-22 08:18:19 +00:00
Atsushi Eno 47f6d5587c 2010-01-19 Atsushi Enomoto <[email protected]>
* CommunicationObject.cs : when process state changes, lock the
	  object to make sure the state transition is valid.
	  Change OnClosed/OnClosing to do the way OnOpened/OnOpening does.

	* ChannelDispatcher.cs : another error audit.


svn path=/trunk/mcs/; revision=149793
2010-01-19 10:15:25 +00:00
Atsushi Eno 3626d9fdcd 2010-01-07 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : make sure to unlock channel acceptor wait
	  handle when the delegated method resulted in an error.


svn path=/trunk/mcs/; revision=149162
2010-01-07 08:25:51 +00:00
Atsushi Eno 577d5f7da8 2009-12-26 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : close such channels that failed to receive
	  request or input.


svn path=/trunk/mcs/; revision=148902
2009-12-26 08:55:21 +00:00
Atsushi Eno 07d0ed89df 2009-12-07 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : fix regression; ServiceBehaviorAttribute
	  could be set explicitly null.


svn path=/trunk/mcs/; revision=147782
2009-12-07 15:50:08 +00:00
Atsushi Eno 0c9426582b 2009-12-07 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : handle AddressFilterMode (.Any only yet).
	* OperationInvokerHandler.cs : fix wrong IAsyncResult use.


svn path=/trunk/mcs/; revision=147781
2009-12-07 15:40:13 +00:00
Atsushi Eno 9f41ecccde 2009-10-22 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : disable concurrent channel acceptance
	  until it gets working fine.


svn path=/trunk/mcs/; revision=144657
2009-10-22 18:08:45 +00:00
Atsushi Eno be14cb07f3 2009-10-16 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : fix warnings.


svn path=/trunk/mcs/; revision=144260
2009-10-16 11:23:34 +00:00
Atsushi Eno e4fe97dc46 2009-10-09 Atsushi Enomoto <[email protected]>
* CommunicationObject.cs : OnOpening() and OnOpened() require calls
	  to base methods. This resulted in not a few changes everywhere.

	 * ChannelDispatcher.cs : OnOpened/OnOpening constraints related
	   changes were required here too. Actually it simplified code.

	* InstanceContext.cs : new constraints on CommunicationObject
	  required calls to base methods.
	* ChannelFactory.cs : ditto. Actually changed timing to call
	  Open() on the internal factory.
	* ServiceHostBase.cs : removed DoOpen() which is almost extra now.
	  Added temporary IMetadataExchange workaround.


svn path=/trunk/mcs/; revision=143829
2009-10-09 07:30:39 +00:00
Atsushi Eno 487b8d3e04 2009-10-05 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : make sure to close, *and* abort channels
	  in case they failed to close. Also consider close timeouts.
	  Rename a field to make less confusing.


svn path=/trunk/mcs/; revision=143431
2009-10-05 18:18:32 +00:00
Atsushi Eno e3f4a64baf 2009-09-17 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs, EndpointDispatcher.cs :
	  when an EndpointDispatcher is added to ChannelDispatcher, its
	  ChannelDispatcher property is automatically filled. To do this,
	  create a derived collection type for Endpoints (that's what .NET
	  does). Remove extra InitializeEndpoint() argument.

	* DuplexClientRuntimeChannel.cs : reflecting EndpointDispatcher change.

	* ChannelDispatcherTest.cs : add a test to make sure that
	  EndpointDispatcher.ChannelDispatcher property is filled by Add().


svn path=/trunk/mcs/; revision=142124
2009-09-17 17:58:15 +00:00
Atsushi Eno f6f60a7e50 2009-09-16 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : make sure to close the request context,
	  some channels such as http keeps opening it. Patch by Levi Bard.
	  Fixed bug #533776.


svn path=/trunk/mcs/; revision=142008
2009-09-16 05:02:42 +00:00
Atsushi Eno baff9c75c8 2009-09-14 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : do not try to wait for channel closer
	  handle when the loop is not started yet. This fixes lengthy wait
	  in the nunit tests.


svn path=/trunk/mcs/; revision=141881
2009-09-14 09:03:15 +00:00
Atsushi Eno db820aa7c6 2009-09-04 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : remove obsoleted method.


svn path=/trunk/mcs/; revision=141314
2009-09-04 10:41:45 +00:00
Atsushi Eno c3995f0e2f 2009-08-24 Atsushi Enomoto <[email protected]>
* EndpointDispatcher.cs, ChannelDispatcher.cs : differentiate
	  service dispatch and callback client dispatch at initialization.


svn path=/trunk/mcs/; revision=140475
2009-08-24 08:50:05 +00:00
Atsushi Eno d577a89aa2 2009-08-21 Atsushi Enomoto <[email protected]>
* ChannelDispatcher.cs : also made reference to host optional.


svn path=/trunk/mcs/; revision=140406
2009-08-21 08:26:28 +00:00