very interesting — running the modified debug code on linux ( I mean clean,
compile on linux )
./haproxy -d -f /opt/haproxy/conf/lua.conf
::action_http_req_custom lua
::action_http_req_custom [0] set-method
::action_http_req_custom [1] set-path
::action_http_req_custom [2] set-query
::action_http_req_custom [3] set-uri
::action_http_req_custom [4] T?r
::action_http_req_custom [5] UH??ATSH??0H?}?H?uЉU?H?E?H????????u
?
::action_http_req_custom [6] UH??H?? H?}?H?u?H?E?H???`?????u
?
::action_http_req_custom [0] lua
Note: setting global.maxconn to 2000.
Available polling systems :
epoll : pref=300, test result OK
poll : pref=200, test result OK
select : pref=150, test result FAILED
Total: 3 (2 usable), will use epoll.
Using epoll() as the polling mechanism.
seems like kw_list is refering to wrong memory location after index 3 ??
> On 03 Apr 2015, at 10:44, gunay arslan <[email protected]> wrote:
>
> some more debug output - put some printfs — but could not find the reason
>
>
> lldb /usr/local/bin/haproxy-1.6-dev1-601a4d-55
> (lldb) target create "/usr/local/bin/haproxy-1.6-dev1-601a4d-55"
> Current executable set to '/usr/local/bin/haproxy-1.6-dev1-601a4d-55'
> (x86_64).
> (lldb) r -f lua.conf
> Process 64937 launched: '/usr/local/bin/haproxy-1.6-dev1-601a4d-55' (x86_64)
> ::action_http_req_custom lua
> ::action_http_req_custom [0] set-method
> ::action_http_req_custom [1] set-path
> ::action_http_req_custom [2] set-query
> ::action_http_req_custom [3] set-uri
> ::action_http_req_custom [4] x?
> ::action_http_req_custom [5] http_date
> Process 64937 stopped
> * thread #1: tid = 0xdf2e2c, 0x00007fff87196152 libsystem_c.dylib`strlen +
> 18, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1,
> address=0x10)
> frame #0: 0x00007fff87196152 libsystem_c.dylib`strlen + 18
> libsystem_c.dylib`strlen + 18:
> -> 0x7fff87196152: pcmpeqb (%rdi), %xmm0
> 0x7fff87196156: pmovmskb %xmm0, %esi
> 0x7fff8719615a: andq $0xf, %rcx
> 0x7fff8719615e: orq $-0x1, %rax
> (lldb) bt all
> * thread #1: tid = 0xdf2e2c, 0x00007fff87196152 libsystem_c.dylib`strlen +
> 18, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1,
> address=0x10)
> * frame #0: 0x00007fff87196152 libsystem_c.dylib`strlen + 18
> frame #1: 0x00007fff871daf02 libsystem_c.dylib`__vfprintf + 4887
> frame #2: 0x00007fff872039af libsystem_c.dylib`__v2printf + 679
> frame #3: 0x00007fff87203c44 libsystem_c.dylib`__xvprintf + 536
> frame #4: 0x00007fff871d9b72 libsystem_c.dylib`vfprintf_l + 54
> frame #5: 0x00007fff871d2600 libsystem_c.dylib`fprintf + 186
> frame #6: 0x000000010007b32d
> haproxy-1.6-dev1-601a4d-55`action_http_req_custom(kw=0x00007fff5fbfec9e) +
> 397 at proto_http.c:11791
> frame #7: 0x000000010007a673
> haproxy-1.6-dev1-601a4d-55`parse_http_req_cond(args=0x00007fff5fbfea88,
> file=0x00007fff5fbffaad, linenum=15, proxy=0x0000000101009400) + 6803 at
> proto_http.c:9306
> frame #8: 0x0000000100027ead
> haproxy-1.6-dev1-601a4d-55`cfg_parse_listen(file=0x00007fff5fbffaad,
> linenum=15, args=0x00007fff5fbfea80, kwm=0) + 18413 at cfgparse.c:3223
> frame #9: 0x0000000100034ad9
> haproxy-1.6-dev1-601a4d-55`readcfgfile(file=0x00007fff5fbffaad) + 2985 at
> cfgparse.c:6325
> frame #10: 0x0000000100002010 haproxy-1.6-dev1-601a4d-55`init(argc=0,
> argv=0x00007fff5fbff918) + 2928 at haproxy.c:719
> frame #11: 0x000000010000498f haproxy-1.6-dev1-601a4d-55`main(argc=3,
> argv=0x00007fff5fbff900) + 47 at haproxy.c:1530
> frame #12: 0x00007fff87e2c5c9 libdyld.dylib`start + 1
> (lldb)
>
>
>
> /*
> * Return the struct http_req_action_kw associated to a keyword.
> */
> struct http_req_action_kw *action_http_req_custom(const char *kw)
> {
> fprintf(stderr,"::action_http_req_custom %s\n",kw);
>
> if (!kw)
> return NULL;
>
> if (!LIST_ISEMPTY(&http_req_keywords.list)) {
> struct http_req_action_kw_list *kw_list;
> int i;
>
> list_for_each_entry(kw_list, &http_req_keywords.list, list) {
> for (i = 0; kw_list->kw[i].kw != NULL; i++) {
> if (kw && kw_list && kw_list->kw[i].kw)
> {fprintf(stderr,"::action_http_req_custom [%d] %s\n",i, kw_list->kw[i].kw ?
> kw_list->kw[i].kw:"NULL"); } <—11791 line
> if (kw && kw_list && kw_list->kw[i].kw &&
> !strcmp(kw, kw_list->kw[i].kw))
> return &kw_list->kw[i];
> }
> }
> }
> return NULL;
> }
>
>
>
>
>
>
>
>
>
>> On 03 Apr 2015, at 10:24, gunay arslan <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> Hope this can solve your needs
>>
>>
>>
>> lldb /usr/local/bin/haproxy-1.6-dev1-601a4d-55
>> (lldb) target create "/usr/local/bin/haproxy-1.6-dev1-601a4d-55"
>> Current executable set to '/usr/local/bin/haproxy-1.6-dev1-601a4d-55'
>> (x86_64).
>> (lldb) r -f lua.conf
>> Process 62345 launched: '/usr/local/bin/haproxy-1.6-dev1-601a4d-55' (x86_64)
>> Process 62345 stopped
>> * thread #1: tid = 0xdf06eb, 0x00007fff85a91b17
>> libsystem_platform.dylib`_platform_strcmp + 23, queue =
>> 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
>> frame #0: 0x00007fff85a91b17 libsystem_platform.dylib`_platform_strcmp +
>> 23
>> libsystem_platform.dylib`_platform_strcmp + 23:
>> -> 0x7fff85a91b17: movzbq (%rsi), %r8
>> 0x7fff85a91b1b: incq %rdi
>> 0x7fff85a91b1e: incq %rsi
>> 0x7fff85a91b21: subq %r8, %rax
>> (lldb) bt all
>> * thread #1: tid = 0xdf06eb, 0x00007fff85a91b17
>> libsystem_platform.dylib`_platform_strcmp + 23, queue =
>> 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
>> * frame #0: 0x00007fff85a91b17 libsystem_platform.dylib`_platform_strcmp +
>> 23
>> frame #1: 0x000000010007b3e1
>> haproxy-1.6-dev1-601a4d-55`action_http_req_custom(kw=0x00007fff5fbfec9e) +
>> 177 at proto_http.c:11786
>> frame #2: 0x000000010007a803
>> haproxy-1.6-dev1-601a4d-55`parse_http_req_cond(args=0x00007fff5fbfea88,
>> file=0x00007fff5fbffaad, linenum=15, proxy=0x0000000101019000) + 6803 at
>> proto_http.c:9306
>> frame #3: 0x000000010002803d
>> haproxy-1.6-dev1-601a4d-55`cfg_parse_listen(file=0x00007fff5fbffaad,
>> linenum=15, args=0x00007fff5fbfea80, kwm=0) + 18413 at cfgparse.c:3223
>> frame #4: 0x0000000100034c69
>> haproxy-1.6-dev1-601a4d-55`readcfgfile(file=0x00007fff5fbffaad) + 2985 at
>> cfgparse.c:6325
>> frame #5: 0x00000001000021a0 haproxy-1.6-dev1-601a4d-55`init(argc=0,
>> argv=0x00007fff5fbff918) + 2928 at haproxy.c:719
>> frame #6: 0x0000000100004b1f haproxy-1.6-dev1-601a4d-55`main(argc=3,
>> argv=0x00007fff5fbff900) + 47 at haproxy.c:1530
>> frame #7: 0x00007fff87e2c5c9 libdyld.dylib`start + 1
>> (lldb)
>>
>>
>>
>>
>>> On 03 Apr 2015, at 10:18, Willy Tarreau <[email protected] <mailto:[email protected]>>
>>> wrote:
>>>
>>> Hi Gunay,
>>>
>>> On Fri, Apr 03, 2015 at 08:46:50AM +0300, gunay arslan wrote:
>>>> HI Cyril
>>>>
>>>> my mistake, I forget to mention that before every build I am cleaning -
>>>> make clean
>>>>
>>>> and here is the lldb output too
>>>>
>>>>
>>>> lldb /usr/local/bin/haproxy-1.6-dev1-601a4d-55
>>>> (lldb) target create "/usr/local/bin/haproxy-1.6-dev1-601a4d-55"
>>>> Current executable set to '/usr/local/bin/haproxy-1.6-dev1-601a4d-55'
>>>> (x86_64).
>>>> (lldb) r -f lua.conf
>>>> Process 57497 launched: '/usr/local/bin/haproxy-1.6-dev1-601a4d-55'
>>>> (x86_64)
>>>> Process 57497 stopped
>>>> * thread #1: tid = 0xddc786, 0x00007fff85a91b17
>>>> libsystem_platform.dylib`_platform_strcmp + 23, queue =
>>>> 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1,
>>>> address=0x10)
>>>> frame #0: 0x00007fff85a91b17 libsystem_platform.dylib`_platform_strcmp
>>>> + 23
>>>> libsystem_platform.dylib`_platform_strcmp + 23:
>>>> -> 0x7fff85a91b17: movzbq (%rsi), %r8
>>>> 0x7fff85a91b1b: incq %rdi
>>>> 0x7fff85a91b1e: incq %rsi
>>>> 0x7fff85a91b21: subq %r8, %rax
>>>
>>> Do you have the equivalent of gdb's "bt full" in lldb ?
>>>
>>> Here we seem to be seeing that it crashes in strcmp() due to a bad
>>> pointer, so now we need to know who passes that bad pointer (I suspect
>>> a null check is missing somewhere hence the address 0x10 which probably
>>> corresponds to a string after two pointers in a struct).
>>>
>>> Regards,
>>> Willy
>>>
>>
>