{"action":"created","issue":{"url":"https://api.github.com/repos/npgsql/npgsql/issues/1491","repository_url":"https://api.github.com/repos/npgsql/npgsql","labels_url":"https://api.github.com/repos/npgsql/npgsql/issues/1491/labels{/name}","comments_url":"https://api.github.com/repos/npgsql/npgsql/issues/1491/comments","events_url":"https://api.github.com/repos/npgsql/npgsql/issues/1491/events","html_url":"https://github.com/npgsql/npgsql/issues/1491","id":214111458,"number":1491,"title":"Async deadlocks in NpgsqlDataReader in single-threaded context","user":{"login":"kurtschelfthout","id":164917,"avatar_url":"https://avatars0.githubusercontent.com/u/164917?v=3","gravatar_id":"","url":"https://api.github.com/users/kurtschelfthout","html_url":"https://github.com/kurtschelfthout","followers_url":"https://api.github.com/users/kurtschelfthout/followers","following_url":"https://api.github.com/users/kurtschelfthout/following{/other_user}","gists_url":"https://api.github.com/users/kurtschelfthout/gists{/gist_id}","starred_url":"https://api.github.com/users/kurtschelfthout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kurtschelfthout/subscriptions","organizations_url":"https://api.github.com/users/kurtschelfthout/orgs","repos_url":"https://api.github.com/users/kurtschelfthout/repos","events_url":"https://api.github.com/users/kurtschelfthout/events{/privacy}","received_events_url":"https://api.github.com/users/kurtschelfthout/received_events","type":"User","site_admin":false},"labels":[{"id":69978383,"url":"https://api.github.com/repos/npgsql/npgsql/labels/bug","name":"bug","color":"e11d21","default":true}],"state":"closed","locked":false,"assignee":{"login":"kurtschelfthout","id":164917,"avatar_url":"https://avatars0.githubusercontent.com/u/164917?v=3","gravatar_id":"","url":"https://api.github.com/users/kurtschelfthout","html_url":"https://github.com/kurtschelfthout","followers_url":"https://api.github.com/users/kurtschelfthout/followers","following_url":"https://api.github.com/users/kurtschelfthout/following{/other_user}","gists_url":"https://api.github.com/users/kurtschelfthout/gists{/gist_id}","starred_url":"https://api.github.com/users/kurtschelfthout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kurtschelfthout/subscriptions","organizations_url":"https://api.github.com/users/kurtschelfthout/orgs","repos_url":"https://api.github.com/users/kurtschelfthout/repos","events_url":"https://api.github.com/users/kurtschelfthout/events{/privacy}","received_events_url":"https://api.github.com/users/kurtschelfthout/received_events","type":"User","site_admin":false},"assignees":[{"login":"kurtschelfthout","id":164917,"avatar_url":"https://avatars0.githubusercontent.com/u/164917?v=3","gravatar_id":"","url":"https://api.github.com/users/kurtschelfthout","html_url":"https://github.com/kurtschelfthout","followers_url":"https://api.github.com/users/kurtschelfthout/followers","following_url":"https://api.github.com/users/kurtschelfthout/following{/other_user}","gists_url":"https://api.github.com/users/kurtschelfthout/gists{/gist_id}","starred_url":"https://api.github.com/users/kurtschelfthout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kurtschelfthout/subscriptions","organizations_url":"https://api.github.com/users/kurtschelfthout/orgs","repos_url":"https://api.github.com/users/kurtschelfthout/repos","events_url":"https://api.github.com/users/kurtschelfthout/events{/privacy}","received_events_url":"https://api.github.com/users/kurtschelfthout/received_events","type":"User","site_admin":false},{"login":"roji","id":1862641,"avatar_url":"https://avatars3.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}],"milestone":{"url":"https://api.github.com/repos/npgsql/npgsql/milestones/41","html_url":"https://github.com/npgsql/npgsql/milestone/41","labels_url":"https://api.github.com/repos/npgsql/npgsql/milestones/41/labels","id":2322167,"number":41,"title":"3.2.2","description":"","creator":{"login":"roji","id":1862641,"avatar_url":"https://avatars3.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},"open_issues":0,"closed_issues":14,"state":"closed","created_at":"2017-02-14T16:14:36Z","updated_at":"2017-03-22T10:34:36Z","due_on":null,"closed_at":"2017-03-22T10:34:36Z"},"comments":3,"created_at":"2017-03-14T15:33:22Z","updated_at":"2017-05-10T23:50:41Z","closed_at":"2017-03-14T15:45:03Z","body":"### The issue\r\n\r\nBecause of the call to `Result` here:\r\n\r\nhttps://github.com/npgsql/npgsql/blob/0f491c80831d8fc177244616f02cfec49d1069df/src/Npgsql/NpgsqlDataReader.cs#L1344\r\n\r\nif you try to read from an `NpgsqlDataReader` in a single threaded context (say on a UI thread or something along those lines - in our case it's a custom dispatcher that marshals calls on a single thread to deal with some non-threadsafe code) a deadlock occurs. This situation is explained in detail here: http://blog.stephencleary.com/2012/07/dont-block-on-async-code.html\r\n\r\nOn the face of it, should that call to `ReadColumn` pass `false` for the `async` argument?\r\n\r\n### Further technical details\r\n\r\nNpgsql version: 3.2.1\r\nPostgreSQL version: 9.6.1\r\nOperating system: Windows\r\n\r\nUsed to work in 3.1.9.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/npgsql/npgsql/issues/comments/300643782","html_url":"https://github.com/npgsql/npgsql/issues/1491#issuecomment-300643782","issue_url":"https://api.github.com/repos/npgsql/npgsql/issues/1491","id":300643782,"user":{"login":"lwansbrough","id":186674,"avatar_url":"https://avatars3.githubusercontent.com/u/186674?v=3","gravatar_id":"","url":"https://api.github.com/users/lwansbrough","html_url":"https://github.com/lwansbrough","followers_url":"https://api.github.com/users/lwansbrough/followers","following_url":"https://api.github.com/users/lwansbrough/following{/other_user}","gists_url":"https://api.github.com/users/lwansbrough/gists{/gist_id}","starred_url":"https://api.github.com/users/lwansbrough/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lwansbrough/subscriptions","organizations_url":"https://api.github.com/users/lwansbrough/orgs","repos_url":"https://api.github.com/users/lwansbrough/repos","events_url":"https://api.github.com/users/lwansbrough/events{/privacy}","received_events_url":"https://api.github.com/users/lwansbrough/received_events","type":"User","site_admin":false},"created_at":"2017-05-10T23:50:41Z","updated_at":"2017-05-10T23:50:41Z","body":"@roji - I have the same issue, though I think it's a different cause. In my case, the deadlock occurs in `NpgsqlDataReader.Cleanup`. Here's where I think the offending line is: https://github.com/npgsql/npgsql/blob/87e861e326e9df5282b2f35253ccca69db9791b0/src/Npgsql/NpgsqlDataReader.cs#L722\r\n\r\nAnd my stack trace:\r\n\r\n![](https://files.gitter.im/dotnet/orleans/IB1h/image.png)"}}
{"actor":{"display_login":"lwansbrough"}}