Page 1 of 1

Got socket error when i set pooling to true

Posted: Wed 19 Oct 2011 13:54
by jnahphi
hi,i got socket error randomly when i use devart 5.0.0.228 connect to postgresql 8.3.10.

i uses ibatis.net + devart 5 + postgresql 8.3.10

connection string as below:



log :
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.Sockets.SocketException: A socket operation was attempted to an unreachable network.
at System.Net.Sockets.Socket.SetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, Int32 optionValue, Boolean silent)
at System.Net.Sockets.Socket.SetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, Int32 optionValue)
at Devart.Common.ae.a(Int32 A_0)
at Devart.Data.PostgreSql.PgSqlCommand.InternalPrepare(Boolean implicitPrepare, Int32 startRecord, Int32 maxRecords)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
at IBatisNet.DataMapper.Commands.DbCommandDecorator.System.Data.IDbCommand.ExecuteReader()
at IBatisNet.DataMapper.MappedStatements.MappedStatement.RunQueryForObject[T](RequestScope request, ISqlMapSession session, Object parameterObject, T resultObject)
at IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForObject[T](ISqlMapSession session, Object parameterObject, T resultObject)
at IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForObject[T](ISqlMapSession session, Object parameterObject)
at IBatisNet.DataMapper.SqlMapper.QueryForObject[T](String statementName, Object parameterObject)
at Banger.Dao.IbatisMapper.IbatisObjectMapper.QueryEntity(String statement, Object conds)
at Banger.Css.Common.CommonDao.QueryEntity(String statement, Object conds)
at Banger.Css.PermissionModule.Dao.UserDao.GetLoginedUser(String loginId, String password)
at Banger.Css.PermissionModule.Service.UserSessionService.UserLogin(String loginId, String password)
--- End of inner exception stack trace ---
at Banger.Corba.Orb.xb3d1bea9caff5c10.x72a590f282d553ee(x6520ec6400de036f xd1d55a56253db2df, OrbClient xc30cd6401e231d63, MethodInfo x1306445c04667cc7, OrbService x113c7c682316fcd2, Boolean xa18d4182f3bcfa12, Object[] x290a8cdbc9dbb3c1, Exception xc5f24384ad39b93a)
at Banger.Corba.Orb.xb3d1bea9caff5c10.x18dfca7c5fd2402f(x6520ec6400de036f xd1d55a56253db2df, OrbClient xc30cd6401e231d63)
at Banger.Corba.Orb.OrbClient.x352a50113e6fd6df()
at Banger.Corba.Orb.OrbServer.xbbe0e30c7a733996(AsyTcpConnector x54fc596d5a45962d, Byte[] x4a3f0a05c02f235f)


when i set pooling to false, i will never get this error again.
i thought is a bug, i need to use pooling,so how can i deal with this.

Posted: Thu 20 Oct 2011 01:56
by s.mingjun
hi,jnahphi
i got the same error, when i used connection in thread and never closed it.

you should check your code first.

me too I up you Ask Help Help Help Help Help

Posted: Fri 21 Oct 2011 08:34
by Yan_huali
me too I up you Ask Help Help Help Help Help

hi, mingjun

Posted: Fri 21 Oct 2011 08:38
by jnahphi
hi, mingjun. Thank you for your help. But I still not found the error. :(
Ask 'Devart Team' for help.

Thanks.

Posted: Fri 21 Oct 2011 12:11
by Shalex
1. Try setting the "Validate Connection=true;" connection string parameter to validate connections that are being got from the pool.
2. Try "Default Command Timeout=0;" if your command takes a lot of time to execute.

For more information about connection string parameters, refer to http://www.devart.com/dotconnect/postgr ... tring.html.

Posted: Fri 21 Oct 2011 13:27
by s.mingjun
hi,Shalex
i have the same problem too.

i have been already set "Validate Connection=true" in connection string, but seems it doesn't work. i still get this error randomly.
i thought it may be a bug of the pool connection.
i am so confused.

i debug the ibaits.net,every connection has been closed .
the worest thing is i can not reprocedure this bug as i want,it appears randomly.

could you help me to solve this problem?

fail

Posted: Mon 24 Oct 2011 12:34
by jnahphi
Now, I got the error when I setting the pooling is false.

Devart.Data.PostgreSql.PgSqlException: Unable to read data from the transport connection:

What can I do? :cry:

Posted: Tue 25 Oct 2011 16:18
by Shalex
s.mingjun, please post here the following information:
1) the version (x.xx.xxx) of your dotConnect for PostgreSQL. You can find it in the Tools > PostgreSQL > About menu of VS. Try using the latest (5.50.237) version;
2) there is no problem with "Pooling=false;", isn't it? Post here your connection string (roughly, without credentials);
3) if possible, send us a small test project to reproduce the issue in our environment. Otherwise:
- describe your application
- how are you working with connections?
- in which situations does the problem occur?
- show your call stack.
jnahphi wrote:Now, I got the error when I setting the pooling is false.

Devart.Data.PostgreSql.PgSqlException: Unable to read data from the transport connection:
jnahphi, are you getting this error on conn.Open()? Make sure that your server is running and available. If possible, send us a small test project.

Posted: Wed 26 Oct 2011 02:08
by s.mingjun
hi,Shalex
thanks for your help.

i have solve this problem. it's a multi thread problem.

In my system, every logined user exists as a user session which inherited from thread. The thread created after user login, destroyed after user logout. In the thread we will access the database and do some operation on db.
The bug is i do some operation on after the thread has been destroy.
So I think there’s must be some relation in thread while connecton pool is open .am I right?

Posted: Mon 31 Oct 2011 12:50
by Shalex
s.mingjun wrote:So I think there’s must be some relation in thread while connecton pool is open .am I right?
Could you please explain this question? If possible, give us (or post here) a small example.