Вопрос

I'm running a set of tests using NUnit. Each test does connect to PostgreSQL database and does something there.

Sometimes I'm getting NullReferenceException with this stack trace:

 at Devart.Data.PostgreSql.o.a(Byte[] A_0, Int32 A_1, Int32 A_2, Int32 A_3)
   at Devart.Data.PostgreSql.o.b(Byte[] A_0, Int32 A_1, Int32 A_2)
   at Devart.Data.PostgreSql.o.a(Char A_0)
   at Devart.Data.PostgreSql.r.b(Char A_0)
   at Devart.Data.PostgreSql.r.d(af A_0)
   at Devart.Data.PostgreSql.i.a(af A_0, Boolean A_1, Boolean A_2, Boolean A_3)
   at Devart.Data.PostgreSql.i.a(af A_0, Boolean A_1, Boolean A_2)
   at Devart.Data.PostgreSql.i.a(af A_0, Boolean A_1)
   at Devart.Data.PostgreSql.af.n()
   at Devart.Data.PostgreSql.ag.a(af A_0, Boolean A_1)
   at Devart.Data.PostgreSql.ag.a(af A_0)
   at Devart.Data.PostgreSql.ag.o()
   at Devart.Data.PostgreSql.ag.a()
   at Devart.Common.DbConnectionInternal.ao()
   at Devart.Common.DbConnectionFactory.a(DbConnectionBase A_0)
   at Devart.Common.DbConnectionClosed.Open(DbConnectionBase outerConnection)
   at Devart.Common.DbConnectionBase.Open()
   at Devart.Data.PostgreSql.PgSqlConnection.Open()
   at SAserviceTest.ScriptInvocations.ScriptInvoker.ExecuteSqlScript(String sqlFileName, Object[] parameters) in 

In PostgreSQL log I found entries like:

2012-12-13 15:04:41 CET DZIENNIK:  Could not receive data from client: Unknown winsock error 10061
2012-12-13 15:04:41 CET DZIENNIK:  Unexpected EOF on client connection

I have no idea what is causing those random errors. The same happens on my machine with local PostgreSQL server and on a remote build server with a remote PostgreSQL server.

Errors are truly random and never occur while running a single test - I have to run a bunch of tests one after another for this error to occur. There are no RAM/disk space/hardware issues involved.

Это было полезно?

Решение

This is pretty obviously an issue with the TCP connection unexpectedly closing from the server's perspective. The question is why. It sounds like something is closing the TCP connection or the state is getting corrupted. Either way this sounds like it is happening at a lower level than your own code.

Reading the stack dump, it makes me wonder if devart is implementing some sort of connection pool internally and the connection is getting closed too early. Given that this never occurs at the same place in your code, my thinking is that this is a case where a bug report filed with the Devart developers is likely to be the most productive way to get this resolved.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top