Why maxconn value can have a negative value?

2018-03-25 Thread Nikhil Kapoor
Hi,

When negative value is given for maxconn(-1,-2...-9, 10.) parameter in global 
section of haproxy.cfg. It is observed that haproxy service starts with 
successful health check up of backend servers.
But when larger negative value is given then haproxy fails to start and Alert 
message is shown.

For e.g. set maxconn value as "-1" in global section of haproxy.cfg and haproxy 
service is started.
By using the command:- "echo "show info" | socat 
unix-connect:/var/run/haproxy.stat stdio"
Output:-
Name: HAProxy
Version: 1.8.1
Release_date: 2017/12/03
Nbproc: 1
Ulimit-n: 30
Maxsock: 30
Maxconn: 4294967295
Hard_maxconn: 4294967295
...
...

Above output shows that maxconn value is "4294967295" which is taken randomly.
Is this a bug? If not then why haproxy behaves abnormally for these values?
Can we enhance the check for which will prompt user from not having a negative 
value of "maxconn" as done for others(such as "inter")?

Regards

Nikhil Kapoor



RE: BUG/MINOR: limiting the value of "inter" parameter for Health check

2018-03-21 Thread Nikhil Kapoor
Hi Willy,

>-Original Message-
>From: Nikhil Kapoor 
>Sent: Tuesday, March 20, 2018 5:09 PM
>To: 'Willy Tarreau' ; Jonathan Matthews 
>Cc: haproxy@formilux.org
>Subject: RE: BUG/MINOR: limiting the value of "inter" parameter for Health 
>check

>Hi Willy,

>-Original Message-
>From: Willy Tarreau [mailto:w...@1wt.eu]
>Sent: Thursday, March 8, 2018 10:18 PM
>To: Jonathan Matthews 
>Cc: Nikhil Kapoor ; haproxy@formilux.org
>Subject: Re: BUG/MINOR: limiting the value of "inter" parameter for Health 
>check

>Hi Jonathan,

>On Wed, Mar 07, 2018 at 09:38:00PM +, Jonathan Matthews wrote:
>> On Wed, 7 Mar 2018 at 09:50, Nikhil Kapoor  
>> wrote
>> 
>> > As currently, no parsing error is displayed when larger value is 
>> > given to "inter" parameter in config file.
>> >
>> > After applying this patch the maximum value of "inter" is set to 24h (i.e.
>> > 8640 ms).
>> >
> 
>>> I regret to inform you, with no little embarrassment, that some years 
>>> ago I designed a system which relied upon this parameter being set 
>>> higher than 24 hours.
> 
>>> I was not proud of this system, and it served absolutely minimal 
>>> quantities of traffic ... but it was a valid setup.
> 
> >What's the rationale for having *any* maximum value here - saving 
> >folks from unintentional misconfigurations, or something else?

>>I agree with you here. In fact what we should do is instead strengthen 
>
>>the timeout parser to emit errors when the parsed number >overflows. 
>>The timer wraps around 49.7 days with a sliding window of half of it 
>>allowing
>>24.85 usable days to always be possible. That would be preferable and it 
>>wouldn't set any arbitrary had limits.


>After analyzing the code on the given problem, I found that the check is based 
>on INT_MAX value and will only be executed when >"stick-table" option is 
>included in haproxy.cfg file.

>However for a user, if "stick-table" option is not used in haproxy.cfg file 
>then there is no other limit(24.85 days) in the haproxy code.
>I believe the below check should not be based on "stick-table" option and 
>should run every time when haproxy is started. 
>Please let me know if there is any gap in understanding and we can perform the 
>code change as mentioned.

>File-> cfgparse.c
>-->  if (val > INT_MAX ) {
ha_alert("parsing [%s:%d] : Expire 
value [%u]ms exceeds maxmimum value of 24.85 days.\n",
 file, linenum, val);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;


Along with the above understanding I am starting with the patch creation. 
Please let me know if there is any gap.  

Regards
Nikhil Kapoor












RE: BUG/MINOR: limiting the value of "inter" parameter for Health check

2018-03-20 Thread Nikhil Kapoor
Hi Willy,

-Original Message-
From: Willy Tarreau [mailto:w...@1wt.eu] 
Sent: Thursday, March 8, 2018 10:18 PM
To: Jonathan Matthews 
Cc: Nikhil Kapoor ; haproxy@formilux.org
Subject: Re: BUG/MINOR: limiting the value of "inter" parameter for Health check

Hi Jonathan,

On Wed, Mar 07, 2018 at 09:38:00PM +, Jonathan Matthews wrote:
> On Wed, 7 Mar 2018 at 09:50, Nikhil Kapoor  
> wrote
> 
> > As currently, no parsing error is displayed when larger value is 
> > given to "inter" parameter in config file.
> >
> > After applying this patch the maximum value of "inter" is set to 24h (i.e.
> > 8640 ms).
> >
> 
> I regret to inform you, with no little embarrassment, that some years 
> ago I designed a system which relied upon this parameter being set 
> higher than 24 hours.
> 
> I was not proud of this system, and it served absolutely minimal 
> quantities of traffic ... but it was a valid setup.
> 
> What's the rationale for having *any* maximum value here - saving 
> folks from unintentional misconfigurations, or something else?

>I agree with you here. In fact what we should do is instead strengthen the 
>timeout parser to emit errors when the parsed number >overflows. The timer 
>wraps around 49.7 days with a sliding window of half of it allowing
>24.85 usable days to always be possible. That would be preferable and it 
>wouldn't set any arbitrary had limits.


After analyzing the code on the given problem, I found that the check is based 
on INT_MAX value and will only be executed when "stick-table" option is 
included in haproxy.cfg file.

However for a user, if "stick-table" option is not used in haproxy.cfg file 
then there is no other limit(24.85 days) in the haproxy code.
I believe the below check should not be based on "stick-table" option and 
should run every time when haproxy is started. 
Please let me know if there is any gap in understanding and we can perform the 
code change as mentioned.

File-> cfgparse.c 
-->  if (val > INT_MAX ) {
ha_alert("parsing [%s:%d] : Expire 
value [%u]ms exceeds maxmimum value of 24.85 days.\n",
         file, linenum, val);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;

Regards 
Nikhil Kapoor 













Backporting of minor bug in haproxy 1.8/1.8.4 version

2018-03-20 Thread Nikhil Kapoor
Hi

I was going through the known bugs of 1.7.9 version. I found a minor bug 
"BUG/MINOR: lua: Fix default value for pattern in 
Socket.receive<http://git.haproxy.org/?p=haproxy-1.7.git;a=commitdiff;h=07fe2d9>"
 which is not backported in 1.8/1.8.4 versions. So, are there any plans to 
backport it or any other reason for not backporting it?

Link: http://git.haproxy.org/?p=haproxy-1.7.git;a=commitdiff;h=07fe2d9

Regards
Nikhil Kapoor



Need help?

2018-03-17 Thread Nikhil Kapoor
Hi,

I hope u all are doing well. It feels great to be a part of haproxy community. 

Actually, I just wanted to deeply understand the code of haproxy. So just 
wanted to know which tool should i use in order to understand the code. Is it 
only gdb that you all use or any other?

Please help me as i am willing to contribute to haproxy. 

Regards
Nikhil Kapoor


BUG/MINOR: limiting the value of "inter" parameter for Health check

2018-03-07 Thread Nikhil Kapoor
Hi Everyone,

There is no limit for the value of inter parameter.
Same query was asked in the community :- 
https://discourse.haproxy.org/t/maximum-value-for-inter-parameter/2142

Here, I have created a patch (Version - 1.8.1) for limiting the maximum value 
of "inter" parameter.

As currently, no parsing error is displayed when larger value is given to 
"inter" parameter in config file.
After applying this patch the maximum value of "inter" is set to 24h (i.e. 
8640 ms).
If user enter any value > 24h then parsing error would be displayed.

Please let me know if the patch is fine and can be merged to the main branch.

Thanks
Nikhil Kapoor


inter_max_check.patch
Description: inter_max_check.patch
Problem:- No parsing error is displayed when larger value is given to "inter" 
parameter in config file.

A parsing error should be displayed on the screen.

Detailed steps:

1.Create 3 nodes setup(node1, node3 as backend servers, HAProxy is installed on 
node2.
2.Set 'inter 100'in haproxy.config 
3.Start Haproxy (systemctl restart haproxy)and check status of haproxy 
(#systemctl status haproxy)

When value of 'inter' parameter is "100" in haproxy.cfg and haproxy 
service is started, no parsing error is displayed.

Solution:- 
A check has been extended in parse_server() of server.c file, to verify the 
parameter value and display the parsing error if a value is greater than 
24h(8640 ms) process termination.


< /* The value of 'inter' parameter cannot be 
greater than 24 hours */
<   if (val <= 0 || val >8640) {
---
>   if (val <= 0 ) {




Maximum value for inter parameter?

2018-02-26 Thread Nikhil Kapoor
Hi

Please respond to the query on discourse:
https://discourse.haproxy.org/t/maximum-value-for-inter-parameter/2142

Thanks
Nikhil Kapoor