Skip to Content.
Sympa Menu

freetds - [freetds] Heavy load patch for net.c

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: [freetds] Heavy load patch for net.c
  • Date: Thu, 10 Jan 2008 22:01:40 +0100

Hi,
fixing stability problem for Asterisk (see Federico mail today) I
found that problem was related to select. select require some fd_set
structures wihich contains a bit fields with any file descriptor. Bits
are set with FD_SET that do not check for bounds so if descriptor is
greater or equal to FD_SETSIZE a buffer occur. The solution if fd_set is
implemented using a bitfield (under Windows is implemented as an array
of file descriptors so limit is the number of file, not value) is using
poll (if supported, if not probably system does not support much
files...).

I wrote the patch attached but there are some problems:
- is written quite fastly without many tests
- it change a critical part (one which required a lot of attention)
- there are still a select call in net.c to change (and perhaps patch
should be rewritten in another way)
- here (in Italy) is not time to make any commit :)

Any comment is welcome. Probably tds_select should be splitted in a
tds_poll and a tds_select where tds_poll accept a file descriptor
instead of a TDSSOCKET*. Perhaps should tds_poll be not static with
TDSSELxxx defined in tds.h so to use in another contexts (like pool
server) ??

freddy77

Attachment: vedi.diff.gz
Description: GNU Zip compressed data




Archive powered by MHonArc 2.6.24.

Top of Page