Issue Details (XML | Word | Printable)

Key: CORE-3194
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Alexander Peshkov
Reporter: Philippe Makowski
Votes: 0
Watchers: 2

If you were logged in you would be able to see more operations.
Firebird Core

Number of connections to linux superclassic has limit equal 508

Created: 22/Oct/10 08:46 AM   Updated: 18/Jan/16 05:08 PM
Component/s: Engine
Affects Version/s: 2.5.0
Fix Version/s: 2.5.1, 3.0 Alpha 1

Environment: SuperClassic Linux

QA Status: No test

 Description  « Hide
Per each connection superclassic needs 2 handles - one for a socket, next for a database file.

SC stops to open files exactly after reaching 1024 limit. This limit is a glibc standard limit.

This lead to the fact that you can't have more that 508 simultaneous connctions to the same database using SuperClassic under Linux.
Windows is not affected, neither Classic or SuperServer, they can each 1000 simultaneous connections if there are enough ressources on the box.

Possible solution :
- patch glibc raising #define __FD_SETSIZE 1024 to build Firebird (not the best solution)
- use pool() instead of select()
- not re-opening database file each time database is opened, but using instead existing descriptor

here a little Python script to raise the problem :

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import kinterbasdb
from kinterbasdb import services
svcCon = services.connect(host='localhost',user='sysdba', password='masterkey')

l = []
for i in range(1000):
    con = kinterbasdb.connect(dsn='localhost:employee', user='sysdba',
    cur = con.cursor()
    cur.execute("select FIRST 1 * from COUNTRY")
    print i
    print cur.fetchall()
    print 'Nb connexions :', svcCon.getConnectionCount()

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Alexander Peshkov added a comment - 28/Jan/11 04:53 PM
In 2.5 I do not change anything except replacing select() with poll().

Alexander Peshkov added a comment - 28/Jan/11 05:58 PM
Issues with opening database file one or many times should be left till solution with shared cache.