Transport channel is closed

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
JORGEMAL
Posts: 171
Joined: Thu 03 Jul 2008 23:55

Transport channel is closed

Post by JORGEMAL » Tue 27 Nov 2012 01:27

We have a kind of long process which performs several operations on several database tables: insert, update and delete. Originally, such a process was designed without transactions in mind but I see that it is a good idea to include them, so I added the TransactionScope class. Now I am receiving an error message telling me that the "Transport channel is closed". I investigated a bit about it and I see that it could refer to a timeout in the transaction process, so I set it to zero as documented in MSDN as follows:

using (TransactionScope trnScope = new TransactionScope(TransactionScopeOption.Required, TimeSpan.Zero))

But the error stil appears. During the process, connections are opened and closed every time a database operationis performed, and such operations are implemented as methods in different classes. I am really lost with this issue so I want to ask for guidance to help me fix this situation. The overall process is structured as follows:

protected void MainControl()
{
using (TransactionScope trnScope = new TransactionScope(TransactionScopeOption.Required, TimeSpan.Zero))
{
process_01;
process_02;
process_03;
process_04;
process_05;
while (condition is true)
{
process_06;
process_07;
process_08;
process_09;
}
process_10;
process_11;
process_123;

if (no error is found)
trnScope.Complete();
}
}

Where each process calls one or more methods in a class library, each method performs operations to the database, and each operation opens and closes its own connection. There are no TransactionScope objects within each of the process, but only one as shown above.

We are using PostgreSQL 9.1 and dotConnect for PostgreSQL 6.0.6.0
I will very much appreciate any comment.

Respectfully,
Jorge Maldonado

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Transport channel is closed

Post by Pinturiccio » Thu 29 Nov 2012 15:13

We could not reproduce the issue. Please create and send us a small test project for reproducing the issue. Please also send us the DDL/DML scripts you use in your process and please specify the PostgreSQL database versions for each process. We will use the DDL/DML scripts on the corresponding servers.

JORGEMAL
Posts: 171
Joined: Thu 03 Jul 2008 23:55

Re: Transport channel is closed

Post by JORGEMAL » Fri 30 Nov 2012 15:29

I have some doubts about my code and I am thinking about doing some modifications, but I want to ask a question before I start. Is there a special preference from you between using PostgreSQL transactions and TransactionScope? My web app only uses PostgreSQL. I will very much appreciate your point of view.

With respect,
Jorge Maldonado

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Transport channel is closed

Post by Pinturiccio » Mon 03 Dec 2012 16:28

We do not tend to give preference either to PostgreSQL transactions or to TransactionScope. You can choose the transaction type that is more convenient for you to work with.

JORGEMAL
Posts: 171
Joined: Thu 03 Jul 2008 23:55

Re: Transport channel is closed

Post by JORGEMAL » Tue 04 Dec 2012 01:39

It is difficult to prepare a sample project because the process is quite complex. I am actually using DBMonitor to see what is going on and there are several "xx events rejected". What does this entry mean?

Regards,
Jorge Maldonado

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Transport channel is closed

Post by Pinturiccio » Wed 05 Dec 2012 16:06

The PgSqlMonitor class has the EventQueueLimit property. The default value of this property is 1000. The EventQueueLimit value is the maximum number of events that may be placed to a queue waiting to be processed by the dbMonitor application. If the number of unprocessed events exceeds EventQueueLimit, extra events are discarded. For more information, please refer to documentation

JORGEMAL
Posts: 171
Joined: Thu 03 Jul 2008 23:55

Re: Transport channel is closed

Post by JORGEMAL » Wed 05 Dec 2012 23:00

Maybe this post does not belong here anymore, I kindly ask to let me know.
I have been following the DB operations with DBMonitor and I noticed that many connections to the DB are left open in 2 operations that are performed by 2 C# recursive methods, a situation that does not happen when I take such recursive processes out of the TransactionScope.

Do you know about any special consideration that I need to be aware of when running recursive code within a TransactionScope?

Any comments will be of great help.

Respectfully,
Jorge Maldonado

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Transport channel is closed

Post by Pinturiccio » Mon 10 Dec 2012 14:21

Could you please create and send us a small test project with your two recursive methods and the corresponding DDL/DML scripts for reproducing the issue?

JORGEMAL
Posts: 171
Joined: Thu 03 Jul 2008 23:55

Re: Transport channel is closed

Post by JORGEMAL » Tue 07 May 2013 17:09

I want to consider this post again becasue I have not been able to solve it yet. Below I include the stack trace information for your consideration. Does it tell you anything?

The line of code at the end is an ExecuteNonQuery command of a simple UPDATE query located in a method of a class.

Regards,
Jorge Maldonado

Transport channel is closed. PgSqlException at Devart.Data.PostgreSql.aa.b(Exception A_0)
at Devart.Common.x.e(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Common.ab.b(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Data.PostgreSql.x.a(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Data.PostgreSql.x.h()
at Devart.Data.PostgreSql.ag.g(ad A_0)
at Devart.Data.PostgreSql.ag.f(ad A_0)
at Devart.Data.PostgreSql.ad.n()
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 Devart.Common.DbCommandBase.ExecuteNonQuery()
at ChartsClub.Listas.TempListaTitulos.CalculaTotalPuntos(String& strMensaje, String& strOrigen) in D:\Visual Studio 2010 Class Libraries\ChartsClub\ChartsClub.Mantenimiento\ChartsClub.Mantenimiento\Listas.cs:line 3339

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Transport channel is closed

Post by Pinturiccio » Wed 15 May 2013 08:13

The provided stack trace does not let us find the reason of the issue. Please create and send us a small test project with your two recursive methods and the corresponding DDL/DML scripts for reproducing the issue.

Post Reply