Error opening a second connection (used to work with older versions)

28 views
Skip to first unread message

bk...@runmyaccounts.com

unread,
May 27, 2015, 3:06:12 AM5/27/15
to npgsq...@googlegroups.com

Hi

I've recently updated Npgsql to the actual version 2.2.5.0 - and now a strange problem popped up: I can still open & use a single connection, but if i try to open a connection to a second db on the same server, connX.Open() fails with an authentification error ('Fehler bei Authentifizierung, da die Gegenseite den Transportstream geschlossen hat.').

This used to be no problem with an earlier version of npgsql.dll (2.0.10.0).

Here is the test code, conn2.Open() fails:

var conn1 = new Npgsql.NpgsqlConnection();
conn1.ConnectionString = @"Server=kvm123;Port=5432;User Id=...;Password=...;Database=db1;Ssl=true;";
conn1.Open();

var conn2 = new Npgsql.NpgsqlConnection();
conn2.ConnectionString = @"Server=kvm123;Port=5432;User Id=...;Password=...;Database=db2;Ssl=true;";
conn2.Open();

It is always the second connection that fails; if I switch the two blocks, conn1.Open() fails.

Any idea?

Best regards, Benjamin

Francisco Figueiredo Jr.

unread,
May 27, 2015, 2:14:27 PM5/27/15
to npgsq...@googlegroups.com, bk...@runmyaccounts.com, bk...@runmyaccounts.com


Hi, Benjamin!

Can you post the stack trace of the error?

If you remove the ssl=true from your connection string, does the second connection work?

Thanks in advance.

benjam...@gmx.ch

unread,
May 27, 2015, 2:25:49 PM5/27/15
to npgsq...@googlegroups.com, bk...@runmyaccounts.com

Hi Francisco,

thanx for answering to this!

- turning off ssl on the second connection results in
FATAL: 28000: no pg_hba.conf entry for host "x.x.x.x", user "...", database "db1", SSL off

- here's a stack trace of the original error:
bei Npgsql.NpgsqlClosedState.Open(NpgsqlConnector context, Int32 timeout)
bei Npgsql.NpgsqlConnector.Open()
bei Npgsql.NpgsqlConnectorPool.GetPooledConnector(NpgsqlConnection Connection)
bei Npgsql.NpgsqlConnectorPool.RequestPooledConnectorInternal(NpgsqlConnection Connection)
bei Npgsql.NpgsqlConnectorPool.RequestConnector(NpgsqlConnection Connection)
bei Npgsql.NpgsqlConnection.Open()
bei npgsql_Test.MainWindow.Window_Loaded(Object sender, RoutedEventArgs e) in u:\bkoch\WPF\npgsql Test\MainWindow.xaml.cs:Zeile 37.
bei System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
bei System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
bei System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
bei System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
bei System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
bei System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
bei MS.Internal.LoadedOrUnloadedOperation.DoWork()
bei System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
bei System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
bei System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
bei System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
bei System.Windows.Media.MediaContext.Resize(ICompositionTarget resizedCompositionTarget)
bei System.Windows.Interop.HwndTarget.OnResize()
bei System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
bei MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
bei MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
bei MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
bei System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
bei MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

Best regards,
Benjamin

Francisco Figueiredo Jr.

unread,
May 27, 2015, 2:51:32 PM5/27/15
to npgsq...@googlegroups.com, benjam...@gmx.ch, benjam...@gmx.ch, bk...@runmyaccounts.com

No problem...

You will need to configure your pg_hba.conf file to allow non ssl connections.

Would you mind to try another version of Npgsql? Maybe 2.2.4 or 2.2.3 and see if the problem occurs?

Thanks in advance.

bk...@runmyaccounts.com

unread,
May 28, 2015, 4:55:00 AM5/28/15
to npgsq...@googlegroups.com, bk...@runmyaccounts.com

Francisco,

I have checked the versions:
- 2.0.11 works
- 2.1.0 works
- 2.2.0 and above: produces the error

Best,
Benjamin
Reply all
Reply to author
Forward
0 new messages