Bug 18518 - WCF Service crash
Summary: WCF Service crash
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies (show other bugs)
Version: 3.2.x
Hardware: Other Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-03-21 13:39 UTC by Michael Ayvazyan
Modified: 2015-10-01 10:28 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Michael Ayvazyan 2014-03-21 13:39:30 UTC
If some client send bad soap request, WCF service will crash, so that the whole app hosting that service will crash.
You would send the following request to any WCF service hosted on mono to prove the issue.

------------- REQUEST --------------------------
POST http://192.168.1.7:81/service HTTP/1.1
SOAPAction: "http://example.com/MyAction"
Accept-Encoding: gzip, deflate
Content-Type: text/xml; charset=utf-8
Host: 192.168.1.7:81
Content-Length: 9
Expect: 100-continue
Connection: Keep-Alive

wrong xml
------------- REQUEST --------------------------


------------- Unhandled Exception Stack Trace --------------------------

Unhandled Exception:
System.Xml.XmlException: Text node cannot appear in this state.  Line 1, position 1.
  at Mono.Xml2.XmlTextReader.ReadText (Boolean notWhitespace) [0x00000] in <filename unknown>:0
  at Mono.Xml2.XmlTextReader.ReadContent () [0x00000] in <filename unknown>:0
  at Mono.Xml2.XmlTextReader.Read () [0x00000] in <filename unknown>:0
  at System.Xml.XmlTextReader.Read () [0x00000] in <filename unknown>:0
  at System.Xml.XmlSimpleDictionaryReader.Read () [0x00000] in <filename unknown>:0
  at System.Xml.XmlReader.MoveToContent () [0x00000] in <filename unknown>:0
  at System.ServiceModel.Channels.XmlReaderMessage.ReadEnvelopeStart () [0x00000] in <filename unknown>:0
  at System.ServiceModel.Channels.XmlReaderMessage..ctor (System.ServiceModel.Channels.MessageVersion version, System.Xml.XmlDictionaryReader reader, Int32 maxSizeOfHeaders) [0x00000] in <filename unknown>:0
  at System.ServiceModel.Channels.Message.CreateMessage (System.Xml.XmlDictionaryReader envelopeReader, Int32 maxSizeOfHeaders, System.ServiceModel.Channels.MessageVersion version) [0x00000] in <filename unknown>:0
  at System.ServiceModel.Channels.TextMessageEncoder.ReadMessage (System.IO.Stream stream, Int32 maxSizeOfHeaders, System.String contentType) [0x00000] in <filename unknown>:0
  at System.ServiceModel.Channels.Http.HttpReplyChannel.CreatePostMessage (System.ServiceModel.Channels.Http.HttpContextInfo ctxi) [0x00000] in <filename unknown>:0
  at System.ServiceModel.Channels.Http.HttpReplyChannel.TryReceiveRequest (TimeSpan timeout, System.ServiceModel.Channels.RequestContext& context) [0x00000] in <filename unknown>:0
  at System.ServiceModel.Channels.ReplyChannelBase.<BeginTryReceiveRequest>m__0 (TimeSpan tout, System.ServiceModel.Channels.RequestContext& ctx) [0x00000] in <filename unknown>:0

------------- Unhandled Exception Stack Trace --------------------------


Linux raspberrypi 3.10.33+ #654 PREEMPT Fri Mar 7 16:32:08 GMT 2014 armv6l GNU/Linux
Mono JIT compiler version 3.2.8 (tarball Thu Mar 13 08:03:10 UTC 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp+hard
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen
Comment 1 Michael Ayvazyan 2014-03-21 13:41:32 UTC
Forgot to mention that the same issue (application crash) occurs if WCF service client disconnects unexpectedly.

CurrentDomainUnhandledException System.NullReferenceException: Object reference
not set to an instance of an object
  at
System.ServiceModel.Channels.Http.HttpStandaloneRequestInfo.get_ClientIPAddress
() [0x00000] in <filename unknown>:0
  at System.ServiceModel.Channels.Http.HttpReplyChannel.CreatePostMessage
(System.ServiceModel.Channels.Http.HttpContextInfo ctxi) [0x00000] in <filename
unknown>:0
  at System.ServiceModel.Channels.Http.HttpReplyChannel.TryReceiveRequest
(TimeSpan timeout, System.ServiceModel.Channels.RequestContext& context)
[0x00000] in <filename unknown>:0
  at System.ServiceModel.Channels.ReplyChannelBase.<BeginTryReceiveRequest>m__0
(TimeSpan tout, System.ServiceModel.Channels.RequestContext& ctx) [0x00000] in
<filename unknown>:0
2014-03-14 15:00:23.8998 Fatal
VendorsExchange.OVP.ESB.NodeConsole.Program.CurrentDomainUnhandledException
IsTerminating: True
Comment 2 Colin MacKenzie 2014-10-10 11:02:20 UTC
Having a similar issue here. Using a SOAP11 xmlns:schema on a SOAP12 service causes a crash. Wow. No way of catching these exceptions seem to work. So much for a hardened SOAP server. If our clients breath on it wrong it crashes.
Comment 3 Daniele Parisi 2015-10-01 10:28:44 UTC
I've a similar issue. I call a wcf web service and I have the following error
The bug is already unsolved?

01/10/2015 15:43 - Error : Text node cannot appear in this state.  Line 2, position 1.  at Mono.Xml2.XmlTextReader.ReadText (Boolean notWhitespace) [0x00000] in <filename unknown>:0 
  at Mono.Xml2.XmlTextReader.ReadContent () [0x00000] in <filename unknown>:0 
  at Mono.Xml2.XmlTextReader.Read () [0x00000] in <filename unknown>:0 
  at System.Xml.XmlTextReader.Read () [0x00000] in <filename unknown>:0 
  at System.Xml.XmlSimpleDictionaryReader.Read () [0x00000] in <filename unknown>:0 
  at System.Xml.XmlReader.MoveToContent () [0x00000] in <filename unknown>:0 
  at System.ServiceModel.Channels.XmlReaderMessage.ReadEnvelopeStart () [0x00000] in <filename unknown>:0 
  at System.ServiceModel.Channels.XmlReaderMessage..ctor (System.ServiceModel.Channels.MessageVersion version, System.Xml.XmlDictionaryReader reader, Int32 maxSizeOfHeaders) [0x00000] in <filename unknown>:0 
  at System.ServiceModel.Channels.Message.CreateMessage (System.Xml.XmlDictionaryReader envelopeReader, Int32 maxSizeOfHeaders, System.ServiceModel.Channels.MessageVersion version) [0x00000] in <filename unknown>:0 
  at System.ServiceModel.Channels.TextMessageEncoder.ReadMessage (System.IO.Stream stream, Int32 maxSizeOfHeaders, System.String contentType) [0x00000] in <filename unknown>:0 
  at System.ServiceModel.Channels.HttpRequestChannel.GotResponse (IAsyncResult result) [0x00000] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[Mobile.Shared.WebServices.SvcUpdateService.GetAppIosLastVersionInfoCompletedEventArgs].GetResult () [0x00000] in <filename unknown>:0 
  at Mobile.Shared.WebServices.Managers.ArxServiceManager+<GetLastAppIosVersionAvailable>d__245.MoveNext () [0x00000] in <filename unknown>:0 -- Source: mscorlib-- Target Site: Throw----------------------
01/10/2015 15:43 - Error : Text node cannot appear in this state.  Line 2, position 1.  at Mono.Xml2.XmlTextReader.ReadText (Boolean notWhitespace) [0x00000] in <filename unknown>:0 
  at Mono.Xml2.XmlTextReader.ReadContent () [0x00000] in <filename unknown>:0 
  at Mono.Xml2.XmlTextReader.Read () [0x00000] in <filename unknown>:0 
  at System.Xml.XmlTextReader.Read () [0x00000] in <filename unknown>:0 
  at System.Xml.XmlSimpleDictionaryReader.Read () [0x00000] in <filename unknown>:0 
  at System.Xml.XmlReader.MoveToContent () [0x00000] in <filename unknown>:0 
  at System.ServiceModel.Channels.XmlReaderMessage.ReadEnvelopeStart () [0x00000] in <filename unknown>:0 
  at System.ServiceModel.Channels.XmlReaderMessage..ctor (System.ServiceModel.Channels.MessageVersion version, System.Xml.XmlDictionaryReader reader, Int32 maxSizeOfHeaders) [0x00000] in <filename unknown>:0 
  at System.ServiceModel.Channels.Message.CreateMessage (System.Xml.XmlDictionaryReader envelopeReader, Int32 maxSizeOfHeaders, System.ServiceModel.Channels.MessageVersion version) [0x00000] in <filename unknown>:0 
  at System.ServiceModel.Channels.TextMessageEncoder.ReadMessage (System.IO.Stream stream, Int32 maxSizeOfHeaders, System.String contentType) [0x00000] in <filename unknown>:0 
  at System.ServiceModel.Channels.HttpRequestChannel.GotResponse (IAsyncResult result) [0x00000] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[Mobile.Shared.WebServices.SvcUpdateService.GetAppIosLastVersionInfoCompletedEventArgs].GetResult () [0x00000] in <filename unknown>:0 
  at Mobile.Shared.WebServices.Managers.ArxServiceManager+<GetLastAppIosVersionAvailable>d__245.MoveNext () [0x00000] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[Mobile.Shared.WebServices.SvcUpdateService.AppVersionInfo].GetResult () [0x00000] in <filename unknown>:0 
  at AppHelper+<UpdateAvailable>d__8.MoveNext () [0x00000] in <filename unknown>:0 -- Source: mscorlib-- Target Site: Throw----------------------

Note You need to log in before you can comment on or make changes to this bug.