These past 10 days, Josh Cooley fixed and helped to fix a lot of critical bugs on Npgsql! Here are they:
Josh Cooley fixed a bug when dealing with concurrent connection establishment using Npgsql RC2. When I implemented ConnectionTimeout support for connection establishment, I was incorrectly using an instance variable with a singleton object :(
This was leading to some nasty problems like this.
Here is the relevant stack trace:
Operation not allowed on non-connected sockets.
at Npgsql.NpgsqlClosedState.Open(NpgsqlConnector context)
at Npgsql.NpgsqlConnectorPool.GetNonPooledConnector(NpgsqlConnection Connection)
at Npgsql.NpgsqlConnectorPool.RequestConnector(NpgsqlConnection Connection)
Another problem, this time with async notification support, was that Npgsql wasn't handling correctly the notification message sent from server when async notification was off. This was leading to nasty exceptions from Npgsql about "this stream doesn't not support seek operation". More information about this bug can be found here. Josh Cooley had a critical role here as his observations about some details on code while struggling to fix this bug lead us to find the culpirit. Thank you, Josh! This is the root stack trace:
System.NotSupportedException: This stream does not
support seek operations.
at System.Net.Sockets.NetworkStream.Seek(Int64 offset, SeekOrigin origin)
at System.IO.BufferedStream.WriteByte(Byte value)
at Npgsql.NpgsqlQuery.WriteToStream(Stream outputStream, Encoding encoding)
at Npgsql.NpgsqlReadyState.Query(NpgsqlConnector context, NpgsqlCommand command)
at Npgsql.NpgsqlConnector.Query(NpgsqlCommand queryCommand)
One thing worth noting here is that if you look closer, this exception is caused because BufferedStream, when flusing the stream, calls Seek method! It seems FlushRead() doesn't check if the stream passed can seek or not. This error only happens on ms.net, 1.1 and 2.0.
Mono correctly checks if stream can seek when flushing the stream and doesn't throw the exception.
So, if you are being affected by some of these bugs ( or all of them :) ) and need an urgent fix, please grab a copy of cvs and give it a try. Otherwise, RC3 release is on the way with those fixes.
Sorry for any problem this may have caused to you.