{"action":"created","issue":{"url":"https://api.github.com/repos/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/619","repository_url":"https://api.github.com/repos/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL","labels_url":"https://api.github.com/repos/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/619/labels{/name}","comments_url":"https://api.github.com/repos/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/619/comments","events_url":"https://api.github.com/repos/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/619/events","html_url":"https://github.com/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/619","id":354682969,"node_id":"MDU6SXNzdWUzNTQ2ODI5Njk=","number":619,"title":"Getting sporadic SocketExceptions/ExtendedSocketExceptions / Connection Refused using Docker","user":{"login":"mylifelineio","id":42376939,"node_id":"MDQ6VXNlcjQyMzc2OTM5","avatar_url":"https://avatars3.githubusercontent.com/u/42376939?v=4","gravatar_id":"","url":"https://api.github.com/users/mylifelineio","html_url":"https://github.com/mylifelineio","followers_url":"https://api.github.com/users/mylifelineio/followers","following_url":"https://api.github.com/users/mylifelineio/following{/other_user}","gists_url":"https://api.github.com/users/mylifelineio/gists{/gist_id}","starred_url":"https://api.github.com/users/mylifelineio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mylifelineio/subscriptions","organizations_url":"https://api.github.com/users/mylifelineio/orgs","repos_url":"https://api.github.com/users/mylifelineio/repos","events_url":"https://api.github.com/users/mylifelineio/events{/privacy}","received_events_url":"https://api.github.com/users/mylifelineio/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-08-28T11:12:30Z","updated_at":"2018-10-26T11:54:39Z","closed_at":"2018-08-29T12:43:26Z","author_association":"NONE","body":"Getting the below exception every now and then, any suggestions?\r\n\r\nVersions:\r\nASP.Net Core 2.1.3\r\nNpgsql... 2.1.1.1\r\nDocker-compose 3.4\r\n```\r\nDocker-compose:\r\npostgres_image:\r\n    image: mdillon/postgis\r\n    restart: always\r\n    volumes:\r\n      - pgdata:/var/lib/postgresql/data\r\n      - ./postgres/:/docker-entrypoint-initdb.d/\r\n    ports:\r\n      - \"5432\"\r\n```\r\nExceptions:\r\n\r\nFirst Exception:\r\n```\r\nType: ExtendedSocketException\r\nAn error occurred using the connection to database 'db' on server 'tcp://postgres_image:5432'.\r\n```\r\nFollowing Exception:\r\n\r\n```\r\nAn exception occurred in the database while iterating the results of a query for context type 'ApplicationDbContext'. \r\nSystem.Net.Internals.SocketExceptionFactory+ExtendedSocketException (111): Connection refused 172.18.0.4:5432 \r\nat System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) \r\nat System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization) \r\n--- End of stack trace from previous location where exception was thrown --- \r\nat Npgsql.TaskExtensions.WithCancellation(Task task, CancellationToken cancellationToken) \r\nat Npgsql.TaskExtensions.WithTimeout(Task task, NpgsqlTimeout timeout) \r\nat Npgsql.NpgsqlConnector.ConnectAsync(NpgsqlTimeout timeout, CancellationToken cancellationToken) \r\nat Npgsql.NpgsqlConnector.RawOpen(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) \r\nat Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) \r\nat Npgsql.ConnectorPool.AllocateLong(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) \r\nat Npgsql.NpgsqlConnection.<>c__DisplayClass32_0.<<Open>g__OpenLong|0>d.MoveNext() \r\n--- End of stack trace from previous location where exception was thrown --- \r\nat Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenDbConnectionAsync(Boolean errorsExpected, CancellationToken cancellationToken) \r\nat Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenAsync(CancellationToken cancellationToken, Boolean errorsExpected) \r\nat Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.BufferlessMoveNext(DbContext _, Boolean buffer, CancellationToken cancellationToken) \r\nat Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken) \r\nat Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.MoveNext(CancellationToken cancellationToken) \r\nat System.Linq.AsyncEnumerable.FirstOrDefault_[TSource](IAsyncEnumerable`1 source, CancellationToken cancellationToken) \r\nat Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.TaskResultAsyncEnumerable`1.Enumerator.MoveNext(CancellationToken cancellationToken) \r\nat System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.MoveNextCore(CancellationToken cancellationToken) at System.Linq.AsyncEnumerable.AsyncIterator`1.MoveNext(CancellationToken cancellationToken) \r\nat Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext(CancellationToken cancellationToken) \r\nat Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteSingletonAsyncQuery[TResult](QueryContext queryContext, Func`2 compiledQuery, IDiagnosticsLogger`1 logger, Type contextType)\r\n```"},"comment":{"url":"https://api.github.com/repos/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/comments/433383045","html_url":"https://github.com/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/619#issuecomment-433383045","issue_url":"https://api.github.com/repos/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/619","id":433383045,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMzM4MzA0NQ==","user":{"login":"ljani","id":1334470,"node_id":"MDQ6VXNlcjEzMzQ0NzA=","avatar_url":"https://avatars0.githubusercontent.com/u/1334470?v=4","gravatar_id":"","url":"https://api.github.com/users/ljani","html_url":"https://github.com/ljani","followers_url":"https://api.github.com/users/ljani/followers","following_url":"https://api.github.com/users/ljani/following{/other_user}","gists_url":"https://api.github.com/users/ljani/gists{/gist_id}","starred_url":"https://api.github.com/users/ljani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ljani/subscriptions","organizations_url":"https://api.github.com/users/ljani/orgs","repos_url":"https://api.github.com/users/ljani/repos","events_url":"https://api.github.com/users/ljani/events{/privacy}","received_events_url":"https://api.github.com/users/ljani/received_events","type":"User","site_admin":false},"created_at":"2018-10-26T11:54:39Z","updated_at":"2018-10-26T11:54:39Z","author_association":"NONE","body":"If anyone ends up searching for this, check your connection string. I faced a the following exception as well:\r\n\r\n```\r\nError Message:\r\n System.Net.Internals.SocketExceptionFactory+ExtendedSocketException : Resource temporarily unavailable\r\nStack Trace:\r\n   at System.Net.Dns.InternalGetHostByName(String hostName)\r\n   at System.Net.Dns.GetHostAddresses(String hostNameOrAddress)\r\n   at Npgsql.NpgsqlConnector.Connect(NpgsqlTimeout timeout) in C:\\projects\\npgsql\\src\\Npgsql\\NpgsqlConnector.cs:line 663\r\n   at Npgsql.NpgsqlConnector.RawOpen(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) in C:\\projects\\npgsql\\src\\Npgsql\\NpgsqlConnector.cs:line 555\r\n   at Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) in C:\\projects\\npgsql\\src\\Npgsql\\NpgsqlConnector.cs:line 414\r\n   at Npgsql.NpgsqlConnection.<>c__DisplayClass32_0.<<Open>g__OpenLong|0>d.MoveNext() in C:\\projects\\npgsql\\src\\Npgsql\\NpgsqlConnection.cs:line 274\r\n```\r\n\r\nIt was because I made a stupid mistake of having SQL Server like connection string `Server={host}:{port}` instead of the correct `Host={host};Port={port}` format."}}
{"actor":{"display_login":"ljani"}}