dotnetcore / FreeSql

🦄 .NET aot orm, C# orm, VB.NET orm, Mysql orm, Postgresql orm, SqlServer orm, Oracle orm, Sqlite orm, Firebird orm, 达梦 orm, 人大金仓 orm, 神通 orm, 翰高 orm, 南大通用 orm, 虚谷 orm, 国产 orm, Clickhouse orm, DuckDB orm, TDengine orm, QuestDB orm, MsAccess orm.
https://freesql.net
MIT License
4.13k stars 859 forks source link

Npgsql.NpgsqlException (0x80004005) #1886

Open wjkhappy14 opened 2 months ago

wjkhappy14 commented 2 months ago

在大约1个小时内,没有获取的Http请求调用(访问数据库),然后再次请求,就会出现这个错误提示,再之后,就不会出现这个提示了

System.Exception: 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.g__EnsureLong|40_0(NpgsqlReadBuffer buffer, Int32 count, Boolean async, Boolean readingNotifications) at Npgsql.NpgsqlConnector.g__ReadMessageLong|201_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) at Npgsql.NpgsqlDataReader.NextResult() at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior) at FreeSql.Internal.CommonProvider.AdoProvider.ExecuteReaderMultiple(Int32 multipleResult, DbConnection connection, DbTransaction transaction, Action2 fetchHandler, Action2 schemaHandler, CommandType cmdType, String cmdText, Int32 cmdTimeout, DbParameter[] cmdParms) --- End of inner exception stack trace --- at FreeSql.Internal.CommonProvider.AdoProvider.LoggerException(IObjectPool1 pool, PrepareCommandResult pc, Exception ex, DateTime dt, StringBuilder logtxt, Boolean isThrowException) at FreeSql.Internal.CommonProvider.AdoProvider.ExecuteReaderMultiple(Int32 multipleResult, DbConnection connection, DbTransaction transaction, Action2 fetchHandler, Action2 schemaHandler, CommandType cmdType, String cmdText, Int32 cmdTimeout, DbParameter[] cmdParms) at FreeSql.Internal.CommonProvider.AdoProvider.ExecuteReader(DbConnection connection, DbTransaction transaction, Action1 fetchHandler, CommandType cmdType, String cmdText, Int32 cmdTimeout, DbParameter[] cmdParms) at FreeSql.Internal.CommonProvider.Select0Provider2.ToListAfPrivate(String sql, GetAllFieldExpressionTreeInfo af, ReadAnonymousTypeOtherInfo[] otherData) at FreeSql.Internal.CommonProvider.Select0Provider2.ToListPrivate(GetAllFieldExpressionTreeInfo af, ReadAnonymousTypeOtherInfo[] otherData) at FreeSql.Internal.CommonProvider.Select0Provider2.ToList(Boolean includeNestedMembers) at FreeSql.Internal.CommonProvider.Select1Provider1.ToList(Boolean includeNestedMembers) at FreeSql.Internal.CommonProvider.Select0Provider2.ToList() at FreeSql.Internal.CommonProvider.Select0Provider2.ToOne() at FreeSql.Internal.CommonProvider.Select0Provider`2.First()

// c# code

数据库版本

PostgreSQL 15.6 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit

安装的Nuget包

FreeSql Version=3.2.810 FreeSql.Provider.PostgreSQL Version=3.2.810

.net framework/. net core? 及具体版本

.NET 6.0

部署环境 K8S(kubesphere)

2881099 commented 2 months ago

npgsql 连接字符串

connection lifetime 有类似的连接串参数