Exception while reading from stream

who can answer me, thanks.

I use C# NpgsqlConnection to connect yugabytedb , it is ok. but today , my codes cannot connect to yugabytedb,display:exception while reading from stream.

Npgsql.NpgsqlException (0x80004005): Exception while reading from stream
 ---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.
   at Npgsql.NpgsqlReadBuffer.<>c__DisplayClass34_0.<<Ensure>g__EnsureLong|0>d.MoveNext()
   at Npgsql.NpgsqlReadBuffer.<>c__DisplayClass34_0.<<Ensure>g__EnsureLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessageLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Npgsql.NpgsqlConnector.Authenticate(String username, NpgsqlTimeout timeout, Boolean async)
   at Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
   at Npgsql.ConnectorPool.AllocateLong(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlConnection.<>c__DisplayClass32_0.<<Open>g__OpenLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Npgsql.NpgsqlConnection.Open()
   at TestYugaByte.Program.Read3() in D:\test\newsql\YugaByteDB\test\TestYugaByteDB\Program.cs:line 368

i can connect yugabytedb with docker command /home/yugabyte/bin/ysqlsh

D:>docker exec -it e9148ecac427 /home/yugabyte/bin/ysqlsh
ysqlsh (11.2-YB-2.7.1.1-b0)
Type “help” for help.

yugabyte=#

Can you connect by using ysqlsh from the host server (not inside the docker) with the same credentials ?

yes. I can connect with ysqlsh.

I rm the old docker container of yugabyte and create a new docker container yugabyte, and it is ok now.

But this problem happened 3 times within a week, and every time I had to rm the old and create a new one docker container.

[

梁永军

13168098175@163.com

](https://maas.mail.163.com/dashi-web-extend/html/proSignature.html?ftlId=1&name=梁永军&uid=13168098175%40163.com&iconUrl=https%3A%2F%2Fmail-online.nosdn.127.net%2Fqiyelogo%2FdefaultAvatar.png&items=["13168098175%40163.com"])

签名由网易邮箱大师定制

On 7/6/2021 20:05,Dorian Hoxha via Yugabyte Community Forumyugabyte@discoursemail.com wrote:

Then the problem may be in your C# code.
Have you tried asking in a C# forum ?
Or you can separate in a script the part that connects to the db and paste it here to see for any bugs.