{"action":"created","issue":{"url":"https://api.github.com/repos/npgsql/npgsql/issues/439","labels_url":"https://api.github.com/repos/npgsql/npgsql/issues/439/labels{/name}","comments_url":"https://api.github.com/repos/npgsql/npgsql/issues/439/comments","events_url":"https://api.github.com/repos/npgsql/npgsql/issues/439/events","html_url":"https://github.com/npgsql/npgsql/issues/439","id":52939448,"number":439,"title":"Constructor for NpgsqlConnection invokes caller repeatedly until stack overflow","user":{"login":"webarchymeta","id":3250215,"avatar_url":"https://avatars.githubusercontent.com/u/3250215?v=3","gravatar_id":"","url":"https://api.github.com/users/webarchymeta","html_url":"https://github.com/webarchymeta","followers_url":"https://api.github.com/users/webarchymeta/followers","following_url":"https://api.github.com/users/webarchymeta/following{/other_user}","gists_url":"https://api.github.com/users/webarchymeta/gists{/gist_id}","starred_url":"https://api.github.com/users/webarchymeta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webarchymeta/subscriptions","organizations_url":"https://api.github.com/users/webarchymeta/orgs","repos_url":"https://api.github.com/users/webarchymeta/repos","events_url":"https://api.github.com/users/webarchymeta/events{/privacy}","received_events_url":"https://api.github.com/users/webarchymeta/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-12-26T21:21:17Z","updated_at":"2015-08-12T03:11:42Z","closed_at":"2015-08-12T03:11:42Z","body":"We are developing a [nodejs](http://nodejs.org/) data server that uses [edgejs](https://github.com/tjanczuk/edge) to invoke .Net or Mono services that are backed by a few relational database engines. There is no problem in .Net environment on Windows. For Mono environment in a Ubuntu (14.04) server (and probably all linux based systems), we had problems using PostgreSql database base on Npgsql driver (tried Npgsql2.0.12.0 and Npgsql2.2.3). \r\n\r\nThe other database we are using is the MySql database base on the MySql.Data driver, it is fine so far in both .Net and Mono environments.So this makes it quite possible that the problems originate from the Npgsql driver.\r\n\r\n### Mono Runtime Entry Point: \r\n  \r\n    public async Task<object> LoadEntityByNature(object callParams)\r\n    {\r\n        return await Task.Factory.StartNew(() => {\r\n            var callObj = callParams as IDictionary<string, object>;\r\n            CallContext cntx;\r\n            string json = (string)callObj[\"cntx\"];\r\n            cntx = JsonConvert.DeserializeObject<CallContext>(json);\r\n            string _Name = (string)callObj[\"_Name\"];\r\n            var val = svc.LoadEntityByNature(cntx, _Name);\r\n            return JsonConvert.SerializeObject(val, msFormatSettings);\r\n        });\r\n    }\r\n  \r\n### The Invoker\r\n\r\nAfter entry, and a few intermediate methods, the constructor for Npgsql's __NpgsqlConnection__ is invoked by the caller:\r\n  \r\n    public override void OpenRepoConnection(CallContext cntx, string connStr)\r\n    {\r\n        if (cntx.CurrentConnection == null)\r\n        {\r\n            NpgsqlConnection conn = new NpgsqlConnection(connStr);\r\n        \r\n            // the code never reaches here but repeats to invoke the caller (namely the \"__OpenRepoConnection__\" above),\r\n            // which is unknown to the Npgsql driver, until stack overflow!\r\n        \r\n            conn.Open();\r\n            ....\r\n        }\r\n    }\r\n\r\nThe code never leaves the constructor but repeats to invoke the client caller (namely the \"__OpenRepoConnection__\" method above), which is unknown to the Npgsql driver, from within until stack overflow! I don't know if this is mono compiler's bug or Npgsql's.\r\n\r\n### The following is the stack trace:\r\n\r\n    info: Server successfully signed in backend data services ...\r\n    Stack overflow in unmanaged: IP: 0x7fceb219d4d4, fault addr: 0x7fceaad36d50\r\n    Stack overflow in unmanaged: IP: 0x7fceb219d4d4, fault addr: 0x7fceaad34f10\r\n    Stack overflow in unmanaged: IP: 0x7fceb219d4d4, fault addr: 0x7fceaad33e50\r\n    Stack overflow in unmanaged: IP: 0x7fceb219d4d4, fault addr: 0x7fceaad32dd0\r\n    Stack overflow in unmanaged: IP: 0x7fceb219d4d4, fault addr: 0x7fceaad31e90\r\n    Stack overflow in unmanaged: IP: 0x7fceb219d4d4, fault addr: 0x7fceaad30b90\r\n    Stack overflow in unmanaged: IP: 0x7fceb219d4d4, fault addr: 0x7fceaad2fd10\r\n    Stack overflow: IP: 0x7fceb219d4d4, fault addr: 0x7fceaad2ef10\r\n    Stacktrace:\r\n      at <unknown> <0xffffffff>\r\n      at string.SubstringUnchecked (int,int) <0x0003b>\r\n      <...>\r\n      at string.SplitByCharacters (char[],int,bool) <0x003fb>\r\n      at string.Split (char[],int,System.StringSplitOptions) <0x000d7>\r\n      at string.Split (char[]) <0x0001b>\r\n      at Npgsql.NpgsqlConnectionString.ParseConnectionString (string) <0x00097>\r\n      at Npgsql.NpgsqlConnection..ctor (string) <0x0004b>\r\n      at (wrapper remoting-invoke-with-check) Npgsql.NpgsqlConnection..ctor (string) <0xffffffff>\r\n      at [namespace].PostgreSql.MembershipPlusRepo.OpenRepoConnection (<namespace>.CallContext,string) <0x000ef>\r\n      at [namespace].PostgreSql.MembershipPlusRepo.OpenRepoConnection (<namespace>.CallContext,string) <0x0010d>\r\n      at [namespace].PostgreSql.MembershipPlusRepo.OpenRepoConnection (<namespace>.CallContext,string) <0x0010d>\r\n      at [namespace].PostgreSql.MembershipPlusRepo.OpenRepoConnection (<namespace>.CallContext,string) <0x0010d>\r\n\r\n      ... more than 32 thousand lines of the same content ...\r\n\r\n      at [namespace].PostgreSql.MembershipPlusRepo.OpenRepoConnection ([namespace].CallContext,string) <0x0010d>\r\n      at [namespace].Application_ServiceImpl._LoadEntityByNature ([namespace].CallContext,string) <0x000a2>\r\n      at [namespace].Application_ServiceImpl.LoadEntityByNature ([namespace].CallContext,string) <0x0008b>\r\n      at (wrapper remoting-invoke-with-check) [namespace].Application_ServiceImpl.LoadEntityByNature ([namespace].CallContext,string) <0xffffffff>\r\n      at [namespace].Application_NodeJsApi/<LoadEntityByNature>c__async27/<LoadEntityByNature>c__AnonStorey51.<>m__0 () <0x0018b>\r\n      at System.Threading.Tasks.TaskActionInvoker/FuncInvoke`1.Invoke (System.Threading.Tasks.Task,object,System.Threading.Tasks.Task) <0x00043>\r\n      at System.Threading.Tasks.Task.InnerInvoke () <0x0006c>\r\n      at System.Threading.Tasks.Task.ThreadStart () <0x00307>\r\n      at System.Threading.Tasks.Task.Execute () <0x0000f>\r\n      at System.Threading.Tasks.TpScheduler.TaskExecuterCallback (object) <0x00047>\r\n      at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <0xffffffff>"},"comment":{"url":"https://api.github.com/repos/npgsql/npgsql/issues/comments/130144318","html_url":"https://github.com/npgsql/npgsql/issues/439#issuecomment-130144318","issue_url":"https://api.github.com/repos/npgsql/npgsql/issues/439","id":130144318,"user":{"login":"roji","id":1862641,"avatar_url":"https://avatars.githubusercontent.com/u/1862641?v=3","gravatar_id":"","url":"https://api.github.com/users/roji","html_url":"https://github.com/roji","followers_url":"https://api.github.com/users/roji/followers","following_url":"https://api.github.com/users/roji/following{/other_user}","gists_url":"https://api.github.com/users/roji/gists{/gist_id}","starred_url":"https://api.github.com/users/roji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roji/subscriptions","organizations_url":"https://api.github.com/users/roji/orgs","repos_url":"https://api.github.com/users/roji/repos","events_url":"https://api.github.com/users/roji/events{/privacy}","received_events_url":"https://api.github.com/users/roji/received_events","type":"User","site_admin":false},"created_at":"2015-08-12T03:11:42Z","updated_at":"2015-08-12T03:11:42Z","body":"Any chance you can test again to see if this still happens with Npgsql 3.0 and the latest version of mono?\r\n\r\nAs this is a relatively old issue I'm going to go ahead and close, but please feel free to reopen if you're still running into it."}}