Maybe a better approach would be to catch the exception when writing to a
socket and in that case flush the pool?
Polling on every connection every 2 secs is a major overhead (especially
for server uses with many connections to multiple databases).

Cheers!
Michał

2015-01-27 12:56 GMT+01:00 Gerdus van Zyl <gerdusvan...@gmail.com>:

> The msdn docs do state: "The connection pooler removes a connection from
> the pool after it has been idle for a long time, *or if the pooler
> detects that the connection with the server has been severed*."
> So other database providers probably check periodically for broken
> connections.
>
> however the docs also say "If a connection exists to a server that has
> disappeared, this connection can be drawn from the pool *even if the
> connection pooler has not detected the severed connection and marked it as
> invalid. *This is the case because the overhead of checking that the
> connection is still valid would eliminate the benefits of having a pooler
> by causing another round trip to the server to occur. *When this occurs,
> the first attempt to use the connection will detect that the connection has
> been severed, and an exception is thrown.*"
>
> See attached patch(+ test program) that adds a connection check on idle
> connections in the connection pool cleanup code that is run every 2 seconds
> to remove old connections.
> Even with the patch if the server goes away between checks you can still
> get a broken connection as is the case with other database providers.
>
> This does cause a small network request for each idle connection in the
> pool every 2 seconds so don't know if this patch would be suitable for
> public use.
>
> On Mon, Jan 26, 2015 at 3:32 PM, Luciano Mendes <luronu...@gmail.com>
> wrote:
>
>> Let me copy, once again, the source code of the SW that is not work. Note
>> the
>> I am always open the Polling connection according the documentation (
>> https://msdn.microsoft.com/en-us/library/8xx3tyca(v=vs.100).aspx ) and it
>> was broken since the version 4.6.0.0:
>>
>> ===========================
>> using FirebirdSql.Data.FirebirdClient;
>>
>> public static bool ExecuteCommand(string DML)
>>         {
>>             using (FbConnection fbConnection = new
>> FbConnection(connectionString()))
>>             using (FbCommand fbCommand = new FbCommand(DML, fbConnection))
>>                 try
>>                 {
>>                     Cursor.Current = Cursors.WaitCursor;
>>                     fbCommand.Connection.Open();
>>                     fbCommand.ExecuteNonQuery();
>>                     return true;
>>                 }
>>                 catch (FbException ex)
>>                 {
>>                     return false;
>>                 }
>>                 finally
>>                 {
>>                     Cursor.Current = Cursors.Default;
>>                 }
>>         }
>>
>>
>>
>> --
>> View this message in context:
>> http://firebird.1100200.n4.nabble.com/Error-reading-data-from-the-connection-tp4638893p4638932.html
>> Sent from the firebird-net-provider mailing list archive at Nabble.com.
>>
>>
>> ------------------------------------------------------------------------------
>> Dive into the World of Parallel Programming. The Go Parallel Website,
>> sponsored by Intel and developed in partnership with Slashdot Media, is
>> your
>> hub for all things parallel software development, from weekly thought
>> leadership blogs to news, videos, case studies, tutorials and more. Take a
>> look and join the conversation now. http://goparallel.sourceforge.net/
>> _______________________________________________
>> Firebird-net-provider mailing list
>> Firebird-net-provider@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
>>
>
>
>
> --
> ------------------------------------------------------------------------
> Gerdus van Zyl
> www.infireal.com
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is
> your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Firebird-net-provider mailing list
> Firebird-net-provider@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
>
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to