SCM

Forum: help

Monitor Forum | Start New Thread Start New Thread
RE: Npgsql RC2 - Open Operation not allowed [ reply ]
By: Richard Wheeling on 2006-08-08 14:31
[forum:1001624]
Hi Josh,

I built a variant of RC2 with the fix from CVS. I ran this variant on two machines last night and did not see any failures.

Thanks for the fix.

Rchard

RE: Npgsql RC2 - Open Operation not allowed [ reply ]
By: Josh Cooley on 2006-08-05 04:16
[forum:1001614]
Richard,

I was able to create a test case and subsequently discover the root of the problem. It was a threading problem that allowed unopened sockets to be passed to the NetworkStream.

I've checked in a fix to CVS. If you get an opportunity to test it, please let me know how it goes.

Josh

RE: Npgsql RC2 - Open Operation not allowed [ reply ]
By: Richard Wheeling on 2006-08-04 14:25
[forum:1001611]
Hi Francisco,

Thanks for the quick reply.

I'm not passing a timeout in the connection string. I did try a version that set the timeout to 60 seconds but that test also failed.

We are definitely in the right area of the source code. Out of curiosity, I built a variant of RC2 that included NpgsqlClosed.cs from RC1. I ran this variant on two machines last night and did not see any failures.

Here is the connection string that I'm using:

Server=127.0.0.1;Port=5432;User Id=myuser;Password=mypassword;Database=mydb;Encoding=UNICODE;Pooling=False;

Richard

RE: Npgsql RC2 - Open Operation not allowed [ reply ]
By: Francisco Figueiredo jr. on 2006-08-04 03:07
[forum:1001607]


Hi Richard.

We changed the way we establish connection o RC2 to provide support for connection timeout. We now connect asynchronously. It seems that Npgsql is trying to create a networkstream before connecting socket. But this is very strange as it would only get there when connection has been established. See an exerpt of NpgsqlClosedState.cs where connection is made:

socket.BeginConnect(new IPEndPoint(ResolveIPHost(context.Host), context.Port), new AsyncCallback(ConnectionDone), socket);

if (!connectDone.WaitOne(context.ConnectionTimeout*1000, true))
{
socket.Close();
throw new Exception(resman.GetString("Exception_ConnectionTimeout"));
}

if (asyncConnectException != null)
throw new NpgsqlException(asyncConnectException.Message, asyncConnectException);

Stream stream = new NetworkStream(socket, true);


Are you passing any timeout parameter in your connection string?


RE: Npgsql RC2 - Open Operation not allowed [ reply ]
By: Richard Wheeling on 2006-08-03 17:57
[forum:1001605]
Here is some addtional information on that exception:

Message: Operation not allowed on non-connected sockets.
== Stack Trace ==
Stack Trace: at System.Net.Sockets.NetworkStream.InitNetworkStream(Socket socket, FileAccess Access)
at System.Net.Sockets.NetworkStream..ctor(Socket socket, Boolean ownsSocket)
at Npgsql.NpgsqlClosedState.Open(NpgsqlConnector context)
== Complete Exception ==
Exception Text: System.IO.IOException: Operation not allowed on non-connected sockets.
at System.Net.Sockets.NetworkStream.InitNetworkStream(Socket socket, FileAccess Access)
at System.Net.Sockets.NetworkStream..ctor(Socket socket, Boolean ownsSocket)
at Npgsql.NpgsqlClosedState.Open(NpgsqlConnector context)

Richard

Npgsql RC2 - Open Operation not allowed [ reply ]
By: Richard Wheeling on 2006-08-03 15:34
[forum:1001604]
Hi,

I recently upgraded my database application from Npgsql RC1 to Npgsql RC2. We're running the MS .NET 1.1 version. I've discovered an exception in RC2 that I did not see in RC1. The exception follows:


Npgsql.NpgsqlException:
Operation not allowed on non-connected sockets.
at Npgsql.NpgsqlClosedState.Open(NpgsqlConnector context)
at Npgsql.NpgsqlConnector.Open()
at Npgsql.NpgsqlConnectorPool.GetNonPooledConnector(NpgsqlConnection Connection)
at Npgsql.NpgsqlConnectorPool.RequestConnector(NpgsqlConnection Connection)
at Npgsql.NpgsqlConnection.Open()
at Services.AddressBook.AddressBookBase.Open()
--- End of inner exception stack trace ---
at Services.AddressBook.AddressBookBase.Open()
at Services.AddressBook.AddressBookControl.ClearDatabase()
at Services.Test.TestHarnessForm.ExecuteTestCase(TestCaseObject testobj)


This exception is extremely hard to reproduce. The other thing I noticed is that the PostgreSQL 8.1.4 log
contains a line "LOG: incomplete startup packet".

Any help would be greatly appreciated.

Thanks,
Richard

Powered By FusionForge