Subject Firebird randomly freezes while connecting to a databse
Author lyle.lasheimok
Hi all :)

Sometimes Firebird will freeze for about ten minutes when connecting to a large database file (1.7G). Constant hard disk activity, but no processor load.

The freeze happens independently of how we connect to the database, eg with FlameRobin or a Lazarus application. (Which means some our customers need to wait ten minutes for our application to start.)

Usually it happens when we connect to the database for the first time after a reboot. All subsequent connections will be lightning fast - until the next reboot.

From what we see it happens only on XP systems. We could reproduce it neither on Linux nor on Vista.

It does not seem to be related to any specific configuration. We tried to disable some services, and do some other stuff, and the freeze randomly (dis/re)appeared.

Our last try was to watch the hard disk activity when connecting normally and with a freeze, and that gave some clue:

When connecting to a database, it first reads some parts of the database file. Seeking forward and backward and reading a few pages here and there.

I guess it's reading the headers at that point.

In the freeze case, it then starts reading the entire file. Which of course takes some time when the file is 1.7G in size.

So now the question is: What triggers this reading of the entire file, and how can we prevent it?