[Mono-devel-list] Npgsql possible bug

yoros at wanadoo.es yoros at wanadoo.es
Sat Dec 27 19:28:16 EST 2003


On Sat, Dec 27, 2003 at 09:09:35PM -0300, Francisco Figueiredo Jr. wrote:
>  --- yoros at wanadoo.es escreveu: > On Thu, Dec 25, 2003 at 11:37:06PM +0100,
> Jaroslaw Kowalski wrote:
> > > Hi all!
> > > 
> 
> Hi Jaroslaw!
> 
> > > This is my first post to nant-devel-list, so please excuse any "formal"
> > > mistakes. I'm in progress of porting my O/R mapping solution to
> > > Mono/PostgreSQL and I've encountered the bug in Npgsql. Is this the right
> > > list to report this problem to?
> > > 
> 
> Yeap. This list is the right place to report it.
> Also, there are the npgsql-general and npgsql-hackers list at gborg:
> http://gborg.postgresql.org/mailman/listinfo/npgsql
> 
> > > The problem is related to the fact that NpgsqlCommand calls
> > > connection.Dispose() in it's Dispose method. This causes problems with
> > > constructs like the following, which are legal in MS.NET with MSSQL:
> 
> > 
> > Yes, that code shouldn't be there but when we use NpgsqlDataAdapter with
> > DataSet, DataTable, etc... the connection is not closed:
> > 
> > 	LOG:  pq_recvbuf: unexpected EOF on client connection
> > 
> > I think that when a command is disposed, it's underlying connection
> > shouldn't be disposed too but the physical connection can be closed and
> > the connection changes its inner state. In this way the connection can
> > be reopenend...
> > 
> > Please take care of what I said and, if you have time...
> > 
> 
> I also think the connection shouldn't be disposing the connection. As, Jaroslaw
> said, you could use the connection with other commands.
> 
> Unfortunately I'm not using my development machine right now, and so, I can't
> check it better, but I think we may be missing something in the
> NpgsqlDataAdapter to close the connection when using commands, maybe specifing
> the CloseConnection behavior as Jaroslaw said.
> 

Be careful with that because it's possible to create a new
NpgsqlDataAdapter with a connection in the constructor... this let us to
construct a DataAdapter with a shared connection and that connection
shouldn't be closed by the DataAdapter. I think that NpgsqlDataAdapter
should close only the connection it created.

In the other hand, researching MS.NET behaviour I noticed that it opens
and closes the physical connection for each "DataSet.Update()" call. I
think that's the best way to handle unmanaged resources in managed world
because we can't ensure the Finalizer/Dispose call by the client of our
classes.

I'll be working in this as soon as I could...

Regards,

    Pedro

-- 
Pedro Martínez Juliá
\  yoros at terra.es
)|    yoros at wanadoo.es
/        http://yoros.dyndns.org
Socio HispaLinux #311
Usuario Linux #275438 - http://counter.li.org
GnuPG public information:  pub  1024D/74F1D3AC
Key fingerprint = 8431 7B47 D2B4 5A46 5F8E  534F 588B E285 74F1 D3AC



More information about the Mono-devel-list mailing list