[freetds] Heavy load patch for net.c

Frediano Ziglio freddy77 at gmail.com
Thu Jan 10 16:01:40 EST 2008


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: vedi.diff.gz
Type: application/x-gzip
Size: 2363 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20080110/6480ab5e/attachment.bin 


More information about the FreeTDS mailing list