jgauffin / Griffin.Framework

Application framework for Business Applications
http://griffinframework.net
168 stars 63 forks source link

NRE in HttpMessageDecoder OnHeader #45

Closed PhonicUK closed 9 years ago

PhonicUK commented 9 years ago

I'm getting reports of a NRE in the above method, stack trace from an end-user follows:

System.NullReferenceException: Object reference not set to an instance of an object
  at Griffin.Net.Protocols.Http.HttpMessageDecoder.OnHeader (System.String name, System.String value) <0x413c9200 + 0x00026> in <filename unknown>:0 
  at Griffin.Net.Protocols.Http.Messages.HeaderParser.Value_CompletedOrMultiLine (Char ch) <0x413c9040 + 0x000f8> in <filename unknown>:0 
  at Griffin.Net.Protocols.Http.Messages.HeaderParser.Parse (ISocketBuffer buffer, Int32 offset) <0x413c70e0 + 0x0003d> in <filename unknown>:0 
  at Griffin.Net.Protocols.Http.HttpMessageDecoder.ProcessReadBytes (ISocketBuffer buffer) <0x413c6e40 + 0x0007f> in <filename unknown>:0 
  at Griffin.Net.Channels.TcpChannel.OnReadCompleted (System.Object sender, System.Net.Sockets.SocketAsyncEventArgs e) <0x413c6be0 + 0x00166> in <filename unknown>:0 

I'm having a hard time reproducing the issue locally, but it seems that there may be a case where _message is being set to NULL before the request completes.

jgauffin commented 9 years ago

Probably a malformed HTTP message.I've added en internal server error exception which is thrown if the same thing happens (including the current state of the http header parser).