{"action":"opened","issue":{"url":"https://api.github.com/repos/SuaveIO/suave/issues/360","labels_url":"https://api.github.com/repos/SuaveIO/suave/issues/360/labels{/name}","comments_url":"https://api.github.com/repos/SuaveIO/suave/issues/360/comments","events_url":"https://api.github.com/repos/SuaveIO/suave/issues/360/events","html_url":"https://github.com/SuaveIO/suave/issues/360","id":122453482,"number":360,"title":"Errors under load for LibUvServerFactory","user":{"login":"hodzanassredin","id":40375,"avatar_url":"https://avatars.githubusercontent.com/u/40375?v=3","gravatar_id":"","url":"https://api.github.com/users/hodzanassredin","html_url":"https://github.com/hodzanassredin","followers_url":"https://api.github.com/users/hodzanassredin/followers","following_url":"https://api.github.com/users/hodzanassredin/following{/other_user}","gists_url":"https://api.github.com/users/hodzanassredin/gists{/gist_id}","starred_url":"https://api.github.com/users/hodzanassredin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hodzanassredin/subscriptions","organizations_url":"https://api.github.com/users/hodzanassredin/orgs","repos_url":"https://api.github.com/users/hodzanassredin/repos","events_url":"https://api.github.com/users/hodzanassredin/events{/privacy}","received_events_url":"https://api.github.com/users/hodzanassredin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-16T08:35:53Z","updated_at":"2015-12-16T08:35:53Z","closed_at":null,"body":"Trying to do load tests with Yandex.Tank rps_schedule=line(100,40000,2m)\r\nwith DefaultTcpServerFactory everything is ok and no errors at all. Ubuntu vm can handle to 4k rps.\r\nBut when I try to use LibUvServerFactory exceptions start to occur when load is more than 1400 rps and virtual users more than 31.\r\nI need to note that kestrel which also uses libuv also does'n work well, it doesnt show errors and works but it cant handle more than 200 rps on the same machine. So probably there is a problem in config.\r\nI installed libuv as described here https://docs.asp.net/en/latest/getting-started/installing-on-linux.html\r\nI tested both suave versions from nuget and from master branch. \r\n    let port = 80\r\n    let conf  = { defaultConfig with bindings = [ HttpBinding.mkSimple HTTP \"0.0.0.0\" port ];\r\n                                 tcpServerFactory = LibUvServerFactory()\r\n                                 bufferSize            = 2048\r\n                                 maxOps                = 100}\r\n    \r\n<img width=\"732\" alt=\"benchs\" src=\"https://cloud.githubusercontent.com/assets/40375/11836067/2846eea6-a3e9-11e5-8881-a794d2f09b79.png\">\r\nstartWebServer conf (OK \"Hello Suave\")\r\n\r\n\r\n[W] 2015-12-16T08:13:47.5331920Z: tcp request processing failed [Suave.Tcp.job] exn:\r\nSystem.InvalidOperationException: Stack empty.\r\n  at System.ThrowHelper.ThrowInvalidOperationException (ExceptionResource resource) <0x41a57190 + 0x00027> in <filename unknown>:0\r\n  at System.Collections.Generic.Stack`1[T].Pop () <0x41a06040 + 0x0001f> in <filename unknown>:0\r\n  at Suave.Sockets.BufferManager.PopBuffer (Microsoft.FSharp.Core.FSharpOption`1 context) <0x41a059a0 + 0x0005b> in <filename unknown>:0\r\n  at Suave.Web+ParsingAndControl+readMoreData@115.Invoke (Microsoft.FSharp.Core.Unit unitVar) <0x41a11830 + 0x00087> in <filename unknown>:0\r\n  at Microsoft.FSharp.Control.AsyncBuilderImpl+callA@851[b,a].Invoke (Microsoft.FSharp.Control.AsyncParams`1 args) <0x419f9510 + 0x0015a> in <filename unknown>:0\r\n\r\nUnhandled Exception:\r\nSystem.InvalidOperationException: Stack empty.\r\n  at System.ThrowHelper.ThrowInvalidOperationException (ExceptionResource resource) <0x41a57190 + 0x00027> in <filename unknown>:0\r\n  at System.Collections.Generic.Stack`1[T].Pop () <0x41a06040 + 0x0001f> in <filename unknown>:0\r\n  at Suave.Sockets.BufferManager.PopBuffer (Microsoft.FSharp.Core.FSharpOption`1 context) <0x41a059a0 + 0x0005b> in <filename unknown>:0\r\n  at Suave.Tcp+job@108.Invoke (Microsoft.FSharp.Core.Unit unitVar) <0x41a053f0 + 0x00217> in <filename unknown>:0\r\n  at Microsoft.FSharp.Control.AsyncBuilderImpl+callA@851[b,a].Invoke (Microsoft.FSharp.Control.AsyncParams`1 args) <0x419f9510 + 0x0015a> in <filename unknown>:0\r\n--- End of stack trace from previous location where exception was thrown ---\r\n  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7fc7d44016d0 + 0x00029> in <filename unknown>:0\r\n  at Microsoft.FSharp.Control.CancellationTokenOps+Start@1268-1.Invoke (System.Runtime.ExceptionServices.ExceptionDispatchInfo edi) <0x41a57900 + 0x0001e> in <filename unknown>:0\r\n  at Microsoft.FSharp.Control.AsyncBuilderImpl+callA@851[b,a].Invoke (Microsoft.FSharp.Control.AsyncParams`1 args) <0x419f9510 + 0x0040c> in <filename unknown>:0\r\n  at Microsoft.FSharp.Control.AsyncBuilderImpl+queueAsync@763[a].Invoke (Microsoft.FSharp.Core.Unit unitVar0) <0x419f7120 + 0x000e6> in <filename unknown>:0\r\n  at <StartupCode$FSharp-Core>.$Control.loop@430-54 (Microsoft.FSharp.Control.Trampoline this, Microsoft.FSharp.Core.FSharpFunc`2 action) <0x419f70b0 + 0x00032> in <filename unknown>:0\r\n  at Microsoft.FSharp.Control.Trampoline.ExecuteAction (Microsoft.FSharp.Core.FSharpFunc`2 firstAction) <0x419f6fd0 + 0x00067> in <filename unknown>:0\r\n  at Microsoft.FSharp.Control.TrampolineHolder.Protect (Microsoft.FSharp.Core.FSharpFunc`2 firstAction) <0x419f6e50 + 0x0009b> in <filename unknown>:0\r\n  at <StartupCode$FSharp-Core>.$Control+-ctor@516-1.Invoke (System.Object state) <0x419f6ae0 + 0x0004b> in <filename unknown>:0\r\n  at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) <0x7fc7d44b5720 + 0x00048> in <filename unknown>:0\r\n  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, Boolean preserveSyncCtx) <0x7fc7d44af850 + 0x0016e> in <filename unknown>:0\r\n  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, Boolean preserveSyncCtx) <0x7fc7d44af820 + 0x00020> in <filename unknown>:0\r\n  at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () <0x7fc7d44b56b0 + 0x00053> in <filename unknown>:0\r\n  at System.Threading.ThreadPoolWorkQueue.Dispatch () <0x7fc7d44b3cc0 + 0x001d6> in <filename unknown>:0\r\n  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () <0x7fc7d44b5530 + 0x00008> in <filename unknown>:0\r\n\r\nUnhandled Exception:\r\nSystem.InvalidOperationException: Stack empty.\r\n  at System.ThrowHelper.ThrowInvalidOperationException (ExceptionResource resource) <0x41a57190 + 0x00027> in <filename unknown>:0\r\n  at System.Collections.Generic.Stack`1[T].Pop () <0x41a06040 + 0x0001f> in <filename unknown>:0\r\n  at Suave.Sockets.BufferManager.PopBuffer (Microsoft.FSharp.Core.FSharpOption`1 context) <0x41a059a0 + 0x0005b> in <filename unknown>:0\r\n  at Suave.Tcp+job@108.Invoke (Microsoft.FSharp.Core.Unit unitVar) <0x41a053f0 + 0x00217> in <filename unknown>:0\r\n  at Microsoft.FSharp.Control.AsyncBuilderImpl+callA@851[b,a].Invoke (Microsoft.FSharp.Control.AsyncParams`1 args) <0x419f9510 + 0x0015a> in <filename unknown>:0\r\n--- End of stack trace from previous location where exception was thrown ---\r\n  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7fc7d44016d0 + 0x00029> in <filename unknown>:0\r\n  at Microsoft.FSharp.Control.CancellationTokenOps+Start@1268-1.Invoke (System.Runtime.ExceptionServices.ExceptionDispatchInfo edi) <0x41a57900 + 0x0001e> in <filename unknown>:0\r\n  at Microsoft.FSharp.Control.AsyncBuilderImpl+callA@851[b,a].Invoke (Microsoft.FSharp.Control.AsyncParams`1 args) <0x419f9510 + 0x0040c> in <filename unknown>:0\r\n  at Microsoft.FSharp.Control.AsyncBuilderImpl+queueAsync@763[a].Invoke (Microsoft.FSharp.Core.Unit unitVar0) <0x419f7120 + 0x000e6> in <filename unknown>:0\r\n  at <StartupCode$FSharp-Core>.$Control.loop@430-54 (Microsoft.FSharp.Control.Trampoline this, Microsoft.FSharp.Core.FSharpFunc`2 action) <0x419f70b0 + 0x00032> in <filename unknown>:0\r\n  at Microsoft.FSharp.Control.Trampoline.ExecuteAction (Microsoft.FSharp.Core.FSharpFunc`2 firstAction) <0x419f6fd0 + 0x00067> in <filename unknown>:0\r\n  at Microsoft.FSharp.Control.TrampolineHolder.Protect (Microsoft.FSharp.Core.FSharpFunc`2 firstAction) <0x419f6e50 + 0x0009b> in <filename unknown>:0\r\n  at <StartupCode$FSharp-Core>.$Control+-ctor@516-1.Invoke (System.Object state) <0x419f6ae0 + 0x0004b> in <filename unknown>:0\r\n  at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) <0x7fc7d44b5720 + 0x00048> in <filename unknown>:0\r\n  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, Boolean preserveSyncCtx) <0x7fc7d44af850 + 0x0016e> in <filename unknown>:0\r\n  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, Boolean preserveSyncCtx) <0x7fc7d44af820 + 0x00020> in <filename unknown>:0\r\n  at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () <0x7fc7d44b56b0 + 0x00053> in <filename unknown>:0\r\n  at System.Threading.ThreadPoolWorkQueue.Dispatch () <0x7fc7d44b3cc0 + 0x001d6> in <filename unknown>:0\r\n  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () <0x7fc7d44b5530 + 0x00008> in <filename unknown>:0\r\n\r\nUnhandled Exception:\r\nSystem.InvalidOperationException: Stack empty.\r\n  at System.ThrowHelper.ThrowInvalidOperationException (ExceptionResource resource) <0x41a57190 + 0x00027> in <filename unknown>:0\r\n  at System.Collections.Generic.Stack`1[T].Pop () <0x41a06040 + 0x0001f> in <filename unknown>:0\r\n  at Suave.Sockets.BufferManager.PopBuffer (Microsoft.FSharp.Core.FSharpOption`1 context) <0x41a059a0 + 0x0005b> in <filename unknown>:0\r\n  at Suave.Tcp+job@108.Invoke (Microsoft.FSharp.Core.Unit unitVar) <0x41a053f0 + 0x00217> in <filename unknown>:0\r\n  at Microsoft.FSharp.Control.AsyncBuilderImpl+callA@851[b,a].Invoke (Microsoft.FSharp.Control.AsyncParams`1 args) <0x419f9510 + 0x0015a> in <filename unknown>:0\r\n--- End of stack trace from previous location where exception was thrown ---\r\n  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7fc7d44016d0 + 0x00029> in <filename unknown>:0\r\n  at Microsoft.FSharp.Control.CancellationTokenOps+Start@1268-1.Invoke (System.Runtime.ExceptionServices.ExceptionDispatchInfo edi) <0x41a57900 + 0x0001e> in <filename unknown>:0\r\n  at Microsoft.FSharp.Control.AsyncBuilderImpl+callA@851[b,a].Invoke (Microsoft.FSharp.Control.AsyncParams`1 args) <0x419f9510 + 0x0040c> in <filename unknown>:0\r\n  at Microsoft.FSharp.Control.AsyncBuilderImpl+queueAsync@763[a].Invoke (Microsoft.FSharp.Core.Unit unitVar0) <0x419f7120 + 0x000e6> in <filename unknown>:0\r\n  at <StartupCode$FSharp-Core>.$Control.loop@430-54 (Microsoft.FSharp.Control.Trampoline this, Microsoft.FSharp.Core.FSharpFunc`2 action) <0x419f70b0 + 0x00032> in <filename unknown>:0\r\n  at Microsoft.FSharp.Control.Trampoline.ExecuteAction (Microsoft.FSharp.Core.FSharpFunc`2 firstAction) <0x419f6fd0 + 0x00067> in <filename unknown>:0\r\n  at Microsoft.FSharp.Control.TrampolineHolder.Protect (Microsoft.FSharp.Core.FSharpFunc`2 firstAction) <0x419f6e50 + 0x0009b> in <filename unknown>:0\r\n  at <StartupCode$FSharp-Core>.$Control+-ctor@516-1.Invoke (System.Object state) <0x419f6ae0 + 0x0004b> in <filename unknown>:0\r\n  at System.Thr\r\n"}}