Skip to content
This repository was archived by the owner on Aug 5, 2019. It is now read-only.
This repository was archived by the owner on Aug 5, 2019. It is now read-only.

corruption/threading issues in transport layer? #70

@mcleodia

Description

@mcleodia

Hi

tl/dr: reproducible example of instabilities: data corruption, assertions, null ref exceptions probably caused by bug within transport layer is attached.

I know you are deprecating this in favour of kestrel, but we were evaluating the library for use with an existing mono based server which needs to target quite a few obscure architectures (e.g. mono on qnap on various flavours of arm). I'm not sure that the kestrel stuff will work for us right now for that reason. A simple test of kestrel on mac using mono died horribly. I also didn't get as far as finding/porting the libuv stuff for qnap, so this project seemed like a good stopgap.

Anyway, long story short, some of our clients were experiencing receiving random connection closes from the server (we were never actively closing from the server!). So I wrote a stress test app (attached) and it seems to display quite a lot of instability.

I swapped out a couple of alternative server implementations (MSHttpListener and kestrel). They run stably, so I'm guessing that nowin is the culprit. The owin.websocket wrapper is fairly trivial and the errors all seem to be down at the transport layers.

Errors seen include null ref on _socket in SaeaLayerCallback - : _socket.ReceiveAsync(_receiveEvent); line 270.

I also saw an assertion followed by some corrupted websocket message data being passed up to the higher layers. Think the assertion was
Debug.Assert(StartBufferOffset + ReceiveBufferPos == offset || _waitingForRequest); in Transport2HttpHandler, line 1039.

Anyway, it's all a bit intermittent and probably all caused by a single low level bug down in the guts of the transport layers. I'll try and have a pop at it, but no guarantees I'll be able to find it :)

If you have any pointers towards helping me debug this / potentially weak areas etc I'd be really grateful for any input!

Cheers
Iain

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions