Subject Re: [firebird-support] Immediate Detection of Disconnected Clients on Classic
---In, <t.tyrakowski@...> wrote :

On 24.04.2017 o 10:41, atunccekic@... [firebird-support] wrote:

> We have some desktop applications which are connecting to firebird, started crashing for a while.
> These applications are mostly on our wireless link connected building so I'm suspicious about the network.
> Then I created a new test project. When I run the application, connect to the database, disconnect the client network just for a second and reconnect the network again, the database connection is broken and the application can't continue.
> Then I saw a new feature on firebird 2.5 like this:
> Immediate Detection of Disconnected Clients on Classic Vladyslav Khorsun
> The Classic server now detects immediately when a Classic process has been broken by a client disconnection. Its response is to terminate any pending activity, roll back the active transaction and close the network connection. Tracker reference CORE-818.
> Can this be the reason that a short interruption on the network causing the problems on the application?
> Can this feaure be disabled so that I can see if this is the problem or not?


My answer is based more on the way the networs work than the actual
knowledge of FB internals. If you work on a wired network and the
network interface is set up to auto detect the link availability (in
most cases it is), pulling the network plug out and connecting it back
causes the network interface to reset (all sockets are closed, the
interface is set up from zero). However, if the network is disrupted
somewhere in between the end points (your server and client) but both of
them have the physical link up, both the server and the client keep the
sockets open (eventually re-transmitting TCP packets after some
timeouts), because they simply can't know why there's no traffic on the
link - failure or just nothing to say ;). When the network gets
operatinal again, it's possible that the database connection actually is
still valid and the app keeps working like nothing happened.
In case of wireless, every disconnection is like pulling the plug - the
interface resets and all sockets are closed. That might explain why your
crashes occur mostly on clients connected via wifi.

  Very good and correct explanation

I don't actually think Firebird can detect client disconnection
"immediately" when there is no data exchange between the server and the
client (it would require some kind of heartbeat increasing traffic and
would be based on timeouts, which are tricky), otherwise byzantine
network partitions wouldn't be so nasty.

  Firebird can do it even if there is no data exchange because it always listens all
known client socket. When OS closed socket it is detected by Firebird listener.