[Home]

Summary:ASTERISK-18546: Receive WARNING[28319] res_odbc.c: Limit should be a number, not a boolean: '0'. Disabling ODBC class 'db_name'.
Reporter:Christopher Howard (cchasteria)Labels:
Date Opened:2011-09-13 23:20:31Date Closed:2011-09-14 08:04:55
Priority:MinorRegression?
Status:Closed/CompleteComponents:Resources/res_config_odbc
Versions:1.8.5.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Centos 6.0Attachments:
Description:When setting up res_odbc.conf if you enter Limit => 0 then you will get an error indicating the "Limit should be a number, not a boolean: '0'.  Disabling ODBC class 'db_name'."   Most configuration samples I have found use a value of zero for limit.   I assume that zero should be unlimited?  Below is a sample entry from res_odbc.conf:


[postgres]
enabled => yes
dsn => asterisk-connector
username => postgres
password =>
pooling => no
limit => 0
pre-connect => yes

The code is:

                                       sscanf(v->value, "%30d", &limit);
                                       if (ast_true(v->value) && !limit) {
                                               ast_log(LOG_WARNING, "Limit should be a number, not a boolean: '%s'.  Setting limit to 1023 for ODBC class '%s'.\n", v->value, cat);
                                               limit = 1023;
                                       } else if (ast_false(v->value)) {
                                               ast_log(LOG_WARNING, "Limit should be a number, not a boolean: '%s'.  Disabling ODBC class '%s'.\n", v->value, cat);
                                               enabled = 0;
                                               break;
                                       }

I'm not real sure what the code is trying to protect against but it seems to be wrong.




Comments:By: Leif Madsen (lmadsen) 2011-09-14 08:03:55.890-0500

You mean the configuration I wrote for Asterisk: The Definitive Guide? That is likely the only place you would have found a reference to zero because it was a typo/error in the documentation.

I just fixed errata for that on Monday, and the value should not be zero. A value of zero would not allow any connections.

By: Leif Madsen (lmadsen) 2011-09-14 08:04:44.036-0500

From res_odbc.conf.sample from the Asterisk source:

; If we aren't sharing connections, what is the maximum number of connections
; that we should attempt?
;limit => 5

By: Christopher Howard (cchasteria) 2011-09-14 08:11:24.662-0500

Leif,  You are correct it was from "Asterisk: The Definitive Guide".  I did not se the sample config file before posting the bug.  It makes sense that 0 should not be allowed but I still think the error is misleading.  Thanks for your reply.