I wrote a programm which in infinite loop makes the following actions: queries the monitoring tables, commits transaction and sleeps for a second than repeat it again.
Very often, when this programm already being runned, if I would run at least two procceses, connected to the same database and which made a long time fetches, everything is hanging and it is impossible even to make a new connection to this database. The reason is that operation "-1" performed twice to the "monitoring" semaphore and because its value already zero when trying to perform this operation second time, "semop" system call waiting till it (semaphore) becames nonzero. So the only way to solve this problem is to use some external programm to perfom opertion "+1" or remove at all this semaphore.
May be this is the Linux-specific bug, because I failed to reproduce it when server running on Windows
I can attach test-files If needed