[freetds] Connection Pool - Max number of fields in a select query

Shaun Craig s.craig at andronics.com
Thu Oct 6 08:16:18 EDT 2005


Think I may have cracked it, well I hope so.  In the following file the 
blocksize was manually set to 512 which was the reason my query was 
failing as its size was over it.  The following files have been set to 
512 and I changed them to 1024 and my query run through ok with no problems.

files:

/* src/pool/member.c
       tds_set_packet(login, 512); //changed to 1024
       tds = tds_alloc_socket(context, 512); //changed to 1024

/* src/pool/user.c
       tds_env_change(tds, 4, NULL, "512"); //changed to 1024

/* src/pool/pool.h
       #define BLOCKSIZ 512 //changed to 1024

Whats confusing me is when I run the pool and watch the query going 
through it, the pool still says block size 512 although now we go past 
the 01f0 and up.

Is there any danger me changing the blocksize to 1024 or have I changed 
it in to many places?

Shaun.


Shaun Craig wrote:

> Yep.  I don't use the pool myself, but it looks like you need to change
> "max pool conn" in pool.conf. 
> $ grep MAX_POOL_CONN include/* src/*/*.c
> src/pool/config.c:#define POOL_STR_MAX_POOL_CONN        "max pool conn"
> src/pool/config.c:      } else if (!strcmp(option,
> POOL_STR_MAX_POOL_CONN)) {
> src/pool/member.c:      fprintf(stderr, "No idle members left, increase
> MAX_POOL_CONN\n");
>
> $ grep pool.conf include/* src/*/*.c
> include/tds_configs.h:#define FREETDS_POOLCONFFILE FREETDS_SYSCONFDIR
> TDS_SDIR_SEPARATOR "pool.conf"
>
> --jkl
>
>
>
> I've tried uping my max pool connections but the query still fails, 
> I've looked at the data going through the pool and noticed something.
>
> 0000  01 01 01 fa 00 00 00 00 53 45 4c 45 43 54 20 56   
> |........SELECT....|
> 0010  65 68 69 63 6c 65 73 2e 56 65 68 69 63 6c 65 49   |...stuff 
> here....|
> 0020  44 2c 20 56 65 68 69 63 6c 65 73 2e 43 75 73 74   |...stuff 
> here....|
> 0030  6f 6d 65 72 49 44 2c 20 4c 61 74 69 74 75 64 65   |...stuff 
> here....|
> 0040  2c 20 4c 6f 6e 67 69 74 75 64 65 2c 20 4e 53 45   |...stuff 
> here....|
> 0050  57 2c 20 4f 64 6f 6d 65 74 65 72 2c 20 43 61 6c   |...stuff 
> here....|
> 0060  6c 53 69 67 6e 2c 20 45 6d 61 69 6c 2c 20 53 4d   |...stuff 
> here....|
> 0070  53 45 6d 61 69 6c 2c 20 44 54 2c 20 53 74 6f 70   |...stuff 
> here....|
> 0080  70 65 64 52 65 70 6f 72 74 54 69 6d 65 2c 20 55   |...stuff 
> here....|
> 0090  73 65 64 49 6e 44 65 6d 6f 2c 20 43 75 73 74 6f   |...stuff 
> here....|
> 00a0  6d 65 72 2e 54 69 6d 65 5a 6f 6e 65 49 44 2c 20   |...stuff 
> here.... |
> 00b0  56 65 68 69 63 6c 65 73 2e 52 65 70 6f 72 74 49   |...stuff 
> here....|
> 00c0  6e 74 65 72 76 61 6c 2c 20 43 75 73 74 6f 6d 65   |...stuff 
> here....|
> 00d0  72 2e 4e 61 6d 65 2c 20 43 75 73 74 6f 6d 65 72   |...stuff 
> here....|
> 00e0  2e 4a 6f 75 72 6e 65 79 54 79 70 65 2c 20 56 65   |...stuff 
> here....|
> 00f0  68 69 63 6c 65 73 2e 53 68 6f 77 4a 6f 75 72 6e   |...stuff 
> here....|
> 0100  65 79 54 79 70 65 20 46 52 4f 4d 20 56 65 68 69   |...stuff 
> here....|
> 0110  63 6c 65 53 74 61 74 75 73 2c 20 56 65 68 69 63   |...stuff 
> here....|
> 0120  6c 65 73 2c 20 4d 6f 64 65 6d 2c 20 43 75 73 74   |...stuff 
> here....|
> 0130  6f 6d 65 72 20 57 48 45 52 45 20 56 65 68 69 63   |...stuff 
> here....|
> 0140  6c 65 73 2e 56 65 68 69 63 6c 65 49 44 20 3d 20   |...stuff 
> here.... |
> 0150  56 65 68 69 63 6c 65 53 74 61 74 75 73 2e 56 65   |...stuff 
> here....|
> 0160  68 69 63 6c 65 49 44 20 41 4e 44 20 56 65 68 69   |...stuff 
> here....|
> 0170  63 6c 65 73 2e 43 75 73 74 6f 6d 65 72 49 44 20   |...stuff 
> here.... |
> 0180  3d 20 43 75 73 74 6f 6d 65 72 2e 43 75 73 74 6f   |...stuff 
> here....|
> 0190  6d 65 72 49 44 20 41 4e 44 20 28 4d 6f 64 65 6d   |...stuff 
> here....|
> 01a0  31 49 44 20 3d 20 4d 6f 64 65 6d 49 44 20 4f 52   |...stuff 
> here....|
> 01b0  20 4d 6f 64 65 6d 32 49 44 20 3d 20 4d 6f 64 65   | ...stuff 
> here....|
> 01c0  6d 49 44 20 4f 52 20 4d 6f 64 65 6d 33 49 44 20   |...stuff 
> here.... |
> 01d0  3d 20 4d 6f 64 65 6d 49 44 29 20 41 4e 44 20 41   |...stuff 
> here....|
> 01e0  64 64 72 65 73 73 20 3d 20 27 33 35 30 33 38 39   |..stuff = 
> '350389|
> *01f0*  38 33 34 36 34 33 39 38 36 27                     |834643986'|
>
> A query will run ok as long as it fits inside the line *01f0*, but if 
> I increase the fields and past this line it starts another part from 
> 0000 again and the query fails at dbsqlexec(dbconn), below is an 
> example of what I mean.
>
> 0000  01 01 01 fa 00 00 00 00 53 45 4c 45 43 54 20 56   
> |........SELECT....|
> 0010  65 68 69 63 6c 65 73 2e 56 65 68 69 63 6c 65 49   |...stuff 
> here....|
> etc..........
> 01e0  44 20 3d 20 4d 6f 64 65 6d 49 44 29 20 41 4e 44   |...stuff 
> here....|
> *01f0*  20 41 64 64 72 65 73 73 20 3d 20 27 33 35 30 33   |...stuff = 
> '3503|
>
> *0000*  01 01 00 14 00 00 00 00 38 39 38 33 34 36 34 33   
> |........89834643|
> 0010  39 38 36 27                                       |986'|
>
> No open connections left, opening member number 1
> deassigning user from member 1
>
> I know believe its the size of the query the connection pool cant 
> handle, uping the connections doesnt matter as the query still fails.  
> I've looked at changing a few things in freetds.conf but havn't had 
> any success.  There must be a size set somewhere in the connection 
> pool code setting a max size of 01f0 (496).  I could be wrong but 
> there's something fishy if the query can pass through tsql ok and not 
> the pool.
>
> Shaun.
>
>
>
> ------------------------------------------------------------------------
>
> Subject:
> Connection Pool - Max number of fields in a select query
> From:
> Shaun Craig <s.craig at andronics.com>
> Date:
> Wed, 05 Oct 2005 16:29:13 +0100
> To:
> FreeTDS Development Group <freetds at lists.ibiblio.org>
>
> To:
> FreeTDS Development Group <freetds at lists.ibiblio.org>
>
>
> Hi,
>
> I'm running a multi table select query with 17 fields through my 
> connection pool which works fine, when I try add another few fields to 
> the query the connection pool hangs with message:
>
> No idle members left, increase MAX_POOL_CONN
> Not enough free members...placing user in WAIT
>
> The new query with extra fields executes no problem through tsql so I 
> take it some setting somewhere needs to be changed for my connection 
> pool, I've had a look at freetds.conf, pool.conf files but not sure 
> thats what I have to change.
>
> Any help would be appreciated.
>
> Shaun.
>
>------------------------------------------------------------------------
>
>_______________________________________________
>FreeTDS mailing list
>FreeTDS at lists.ibiblio.org
>http://lists.ibiblio.org/mailman/listinfo/freetds
>  
>


-- 
Shaun Craig
Andronics Ltd. 
Tel: 02871273118
Web: http://www.andronics.co.uk



More information about the FreeTDS mailing list