Subject | Re: [firebird-support] Re: An existing connection was forcibly closed by the remote host (FB1.53/Win2003) |
---|---|
Author | David Johnson |
Post date | 2006-03-27T23:06:22Z |
On Mon, 2006-03-27 at 14:01 +0000, Glebas wrote:
regular keep-alive transactions on the connection. Say, once every 15
minutes. To keep from sending spurious transactions, reset the timer
every time you issue a genuine transaction.
I am not sure if a simple {startTransaction ();commit();} would do the
trick, or if you would actually need to issue some sort of work - say
select the current timestamp or a generator value or something.
In a multi-threaded app, where the connection runs in its own thread,
wake every connection thread up and have the thread mainline code smart
enough to recognize that when there is no pending transaction from a
user it still needs to run the keep-alive transaction.
In a single threaded app, set up an OS or JVM level timer (depending on
your environment - Delphi TTimer is an OS timer) so whenever it fires it
invokes the dummy transaction on the connections. Set up a semaphore to
protect the connection so that only the timer or the application may
actually try to run a transaction at any time. Reset the timer after
every successful or failed request.
> --- In firebird-support@yahoogroups.com, David JohnsonMake sure that, even when there is no application activity, you issue
> <johnson_d@...> wrote:
> >
> > Sockets timeout on the server?
> >
> > If there is no activity, the OS will close the socket. An open but
> > unused socket is a potential security hole.
>
> Ok, and how to fix that? :)
regular keep-alive transactions on the connection. Say, once every 15
minutes. To keep from sending spurious transactions, reset the timer
every time you issue a genuine transaction.
I am not sure if a simple {startTransaction ();commit();} would do the
trick, or if you would actually need to issue some sort of work - say
select the current timestamp or a generator value or something.
In a multi-threaded app, where the connection runs in its own thread,
wake every connection thread up and have the thread mainline code smart
enough to recognize that when there is no pending transaction from a
user it still needs to run the keep-alive transaction.
In a single threaded app, set up an OS or JVM level timer (depending on
your environment - Delphi TTimer is an OS timer) so whenever it fires it
invokes the dummy transaction on the connections. Set up a semaphore to
protect the connection so that only the timer or the application may
actually try to run a transaction at any time. Reset the timer after
every successful or failed request.