nginx-auth-ldap
nginx-auth-ldap copied to clipboard
segmentation fault in module
I have random segfaults in module nginx-auth-ldap Some debug data: nginx -V
nginx version: nginx/1.9.5
built by gcc 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --add-module=/var/lib/jenkins/workspace/Build_nginx/rpm-build/nginx-1.9.5/nginx-auth-ldap-master
/var/log/nginx/error.log:
2015/10/16 10:33:11 [notice] 1290#0: signal 17 (SIGCHLD) received
2015/10/16 10:33:11 [alert] 1290#0: worker process 2293 exited on signal 11
2015/10/16 10:33:11 [notice] 1290#0: start worker process 59706
nginx config:
http {
.......
ldap_server ld-ldap {
url "ldaps://ld-ldap.company.com/dc=company,dc=com?uid?sub?";
binddn "cn=Manager,dc=company,dc=com";
binddn_passwd "passwprd";
group_attribute member;
group_attribute_is_dn on;
require valid_user;
}
ldap_server ldap {
url "ldaps://ldap.company.com/dc=company,dc=com?uid?sub?";
binddn "cn=Manager,dc=company,dc=com";
binddn_passwd "password";
group_attribute member;
group_attribute_is_dn on;
require valid_user;
}
.......
server {
.......
auth_ldap "Forbidden";
auth_ldap_servers ld-ldap;
auth_ldap_servers ldap;
.......
}
dbg debugging:
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `nginx: worker process '.
Program terminated with signal 11, Segmentation fault.
#0 ngx_http_auth_ldap_return_connection (c=<optimized out>) at /usr/src/debug/nginx-1.9.5/nginx-auth-ldap-master/ngx_http_auth_ldap_module.c:1092
1092 ngx_queue_remove(q);
(gdb) bt
#0 ngx_http_auth_ldap_return_connection (c=<optimized out>) at /usr/src/debug/nginx-1.9.5/nginx-auth-ldap-master/ngx_http_auth_ldap_module.c:1092
#1 0x0000000000497551 in ngx_http_auth_ldap_authenticate (conf=0xe61db0, ctx=0xf032a0, r=0xed5820) at /usr/src/debug/nginx-1.9.5/nginx-auth-ldap-master/ngx_http_auth_ldap_module.c:1797
#2 ngx_http_auth_ldap_handler (r=0xed5820) at /usr/src/debug/nginx-1.9.5/nginx-auth-ldap-master/ngx_http_auth_ldap_module.c:1612
#3 0x0000000000437d6b in ngx_http_core_access_phase (r=<optimized out>, ph=0xe6aa88) at src/http/ngx_http_core_module.c:1066
#4 0x00000000004334e5 in ngx_http_core_run_phases (r=0xed5820) at src/http/ngx_http_core_module.c:840
#5 0x0000000000496324 in ngx_http_auth_ldap_read_handler (rev=0xea5870) at /usr/src/debug/nginx-1.9.5/nginx-auth-ldap-master/ngx_http_auth_ldap_module.c:1410
#6 0x00000000004295a7 in ngx_epoll_process_events (cycle=<optimized out>, timer=<optimized out>, flags=<optimized out>) at src/event/modules/ngx_epoll_module.c:822
#7 0x0000000000421b03 in ngx_process_events_and_timers (cycle=cycle@entry=0xe3b880) at src/event/ngx_event.c:242
#8 0x00000000004276c1 in ngx_worker_process_cycle (cycle=cycle@entry=0xe3b880, data=data@entry=0x0) at src/os/unix/ngx_process_cycle.c:753
#9 0x0000000000426104 in ngx_spawn_process (cycle=cycle@entry=0xe3b880, proc=0x427640 <ngx_worker_process_cycle>, data=0x0, name=0x49c106 "worker process", respawn=respawn@entry=0)
at src/os/unix/ngx_process.c:198
#10 0x0000000000428832 in ngx_reap_children (cycle=0xe3b880) at src/os/unix/ngx_process_cycle.c:621
#11 ngx_master_process_cycle (cycle=cycle@entry=0xe3b880) at src/os/unix/ngx_process_cycle.c:174
#12 0x0000000000407b0f in main (argc=<optimized out>, argv=<optimized out>) at src/core/nginx.c:415
(gdb) bt full
#0 ngx_http_auth_ldap_return_connection (c=<optimized out>) at /usr/src/debug/nginx-1.9.5/nginx-auth-ldap-master/ngx_http_auth_ldap_module.c:1092
q = 0xed5950
#1 0x0000000000497551 in ngx_http_auth_ldap_authenticate (conf=0xe61db0, ctx=0xf032a0, r=0xed5820) at /usr/src/debug/nginx-1.9.5/nginx-auth-ldap-master/ngx_http_auth_ldap_module.c:1797
No locals.
#2 ngx_http_auth_ldap_handler (r=0xed5820) at /usr/src/debug/nginx-1.9.5/nginx-auth-ldap-master/ngx_http_auth_ldap_module.c:1612
alcf = 0xe61db0
ctx = 0xf032a0
rc = <optimized out>
#3 0x0000000000437d6b in ngx_http_core_access_phase (r=<optimized out>, ph=0xe6aa88) at src/http/ngx_http_core_module.c:1066
rc = <optimized out>
clcf = <optimized out>
#4 0x00000000004334e5 in ngx_http_core_run_phases (r=0xed5820) at src/http/ngx_http_core_module.c:840
rc = <optimized out>
ph = 0xe6a9c8
cmcf = <optimized out>
#5 0x0000000000496324 in ngx_http_auth_ldap_read_handler (rev=0xea5870) at /usr/src/debug/nginx-1.9.5/nginx-auth-ldap-master/ngx_http_auth_ldap_module.c:1410
conn = 0xe6f950
c = 0xe6acf0
rc = 0
timeout = {tv_sec = 0, tv_usec = 0}
result = 0xf14630
error_code = 0
error_msg = 0x0
dn = <optimized out>
#6 0x00000000004295a7 in ngx_epoll_process_events (cycle=<optimized out>, timer=<optimized out>, flags=<optimized out>) at src/event/modules/ngx_epoll_module.c:822
events = 1
revents = 5
instance = <optimized out>
i = 0
level = <optimized out>
err = <optimized out>
rev = <optimized out>
wev = <optimized out>
queue = <optimized out>
c = 0xe6f950
#7 0x0000000000421b03 in ngx_process_events_and_timers (cycle=cycle@entry=0xe3b880) at src/event/ngx_event.c:242
flags = <optimized out>
timer = <optimized out>
delta = 1444917074915
#8 0x00000000004276c1 in ngx_worker_process_cycle (cycle=cycle@entry=0xe3b880, data=data@entry=0x0) at src/os/unix/ngx_process_cycle.c:753
worker = 0
#9 0x0000000000426104 in ngx_spawn_process (cycle=cycle@entry=0xe3b880, proc=0x427640 <ngx_worker_process_cycle>, data=0x0, name=0x49c106 "worker process", respawn=respawn@entry=0)
at src/os/unix/ngx_process.c:198
on = 1
pid = 0
s = 0
#10 0x0000000000428832 in ngx_reap_children (cycle=0xe3b880) at src/os/unix/ngx_process_cycle.c:621
i = 0
live = 0
n = <optimized out>
ch = {command = 2, pid = 63681, slot = 0, fd = -1}
ccf = <optimized out>
#11 ngx_master_process_cycle (cycle=cycle@entry=0xe3b880) at src/os/unix/ngx_process_cycle.c:174
title = <optimized out>
p = <optimized out>
size = <optimized out>
i = <optimized out>
n = <optimized out>
sigio = 0
set = {__val = {0 <repeats 16 times>}}
itv = {it_interval = {tv_sec = 9, tv_usec = 18}, it_value = {tv_sec = 14929147, tv_usec = 0}}
live = <optimized out>
delay = 0
ls = <optimized out>
ccf = 0xe3ca40
#12 0x0000000000407b0f in main (argc=<optimized out>, argv=<optimized out>) at src/core/nginx.c:415
b = <optimized out>
log = 0x6d50a0 <ngx_log>
i = <optimized out>
cycle = 0xe3b880
init_cycle = {conf_ctx = 0x0, pool = 0xe3b340, log = 0x6d50a0 <ngx_log>, new_log = {log_level = 0, file = 0x0, connection = 0, disk_full_time = 0, handler = 0x0, data = 0x0,
writer = 0x0, wdata = 0x0, action = 0x0, next = 0x0}, log_use_stderr = 0, files = 0x0, free_connections = 0x0, free_connection_n = 0, reusable_connections_queue = {prev = 0x0,
next = 0x0}, listening = {elts = 0x0, nelts = 0, size = 0, nalloc = 0, pool = 0x0}, paths = {elts = 0x0, nelts = 0, size = 0, nalloc = 0, pool = 0x0}, config_dump = {elts = 0x0,
nelts = 0, size = 0, nalloc = 0, pool = 0x0}, open_files = {last = 0x0, part = {elts = 0x0, nelts = 0, next = 0x0}, size = 0, nalloc = 0, pool = 0x0}, shared_memory = {
last = 0x0, part = {elts = 0x0, nelts = 0, next = 0x0}, size = 0, nalloc = 0, pool = 0x0}, connection_n = 0, files_n = 0, connections = 0x0, read_events = 0x0,
write_events = 0x0, old_cycle = 0x0, conf_file = {len = 21, data = 0x7fff9ab5df8a "ss"}, conf_param = {len = 0, data = 0x0}, conf_prefix = {len = 11, data = 0x7fff9ab5df8a "ss"},
prefix = {len = 11, data = 0x498ae1 "/etc/nginx/"}, lock_file = {len = 0, data = 0x0}, hostname = {len = 0, data = 0x0}}
cd = <optimized out>
ccf = <optimized out>
@kivarun Do you think this may be related to my errors reported in #99?
@augustf I think that we can find out if you make coredump analiz.
Looks like I'm hitting this as well. @augustf did you get to the bottom of it?
(gdb) bt
#0 0x00000000004824f7 in ngx_http_auth_ldap_return_connection (c=0x2434dc0) at /root/nginx-auth-ldap/ngx_http_auth_ldap_module.c:1103
#1 0x0000000000485287 in ngx_http_auth_ldap_authenticate (conf=<optimized out>, ctx=0x2481890, r=0x24808b0) at /root/nginx-auth-ldap/ngx_http_auth_ldap_module.c:1861
#2 ngx_http_auth_ldap_handler (r=0x24808b0) at /root/nginx-auth-ldap/ngx_http_auth_ldap_module.c:1676
#3 0x0000000000437c1a in ngx_http_core_access_phase (r=<optimized out>, ph=0x2434b80) at src/http/ngx_http_core_module.c:1066
#4 0x00000000004338e6 in ngx_http_core_run_phases (r=r@entry=0x24808b0) at src/http/ngx_http_core_module.c:840
#5 0x000000000048243b in ngx_http_auth_ldap_wake_request (r=0x24808b0) at /root/nginx-auth-ldap/ngx_http_auth_ldap_module.c:1049
#6 0x00000000004825c8 in ngx_http_auth_ldap_reply_connection (c=c@entry=0x2434dc0, error_code=0, error_msg=<optimized out>) at /root/nginx-auth-ldap/ngx_http_auth_ldap_module.c:1127
#7 0x0000000000485ffe in ngx_http_auth_ldap_read_handler (rev=0x7fba5ffd7130) at /root/nginx-auth-ldap/ngx_http_auth_ldap_module.c:1445
#8 0x00000000004297f4 in ngx_epoll_process_events (cycle=0x2403520, timer=<optimized out>, flags=<optimized out>) at src/event/modules/ngx_epoll_module.c:822
#9 0x0000000000420a3c in ngx_process_events_and_timers (cycle=cycle@entry=0x2403520) at src/event/ngx_event.c:242
#10 0x000000000042782c in ngx_worker_process_cycle (cycle=cycle@entry=0x2403520, data=data@entry=0x1) at src/os/unix/ngx_process_cycle.c:753
#11 0x0000000000425f43 in ngx_spawn_process (cycle=cycle@entry=0x2403520, proc=proc@entry=0x427789 <ngx_worker_process_cycle>, data=data@entry=0x1, name=name@entry=0x48b206 "worker process",
respawn=respawn@entry=-3) at src/os/unix/ngx_process.c:198
#12 0x0000000000426af1 in ngx_start_worker_processes (cycle=cycle@entry=0x2403520, n=8, type=type@entry=-3) at src/os/unix/ngx_process_cycle.c:358
#13 0x0000000000428133 in ngx_master_process_cycle (cycle=cycle@entry=0x2403520) at src/os/unix/ngx_process_cycle.c:130
#14 0x000000000040842e in main (argc=<optimized out>, argv=<optimized out>) at src/core/nginx.c:359
+1
#0 0x0000000000482729 in ngx_http_auth_ldap_return_connection (c=0x2588900) at /opt/app/software/nginx/nginx-auth-ldap//ngx_http_auth_ldap_module.c:1103
#1 0x00000000004854dc in ngx_http_auth_ldap_authenticate (conf=
looks like I am having a similar issue here:
root@security-monkey-nginx-auth-4e8f:/tmp# gdb /usr/share/nginx/sbin/nginx /tmp/core.XXXX-nginx-auth-4e8f.nginx.10030
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/share/nginx/sbin/nginx...done.
[New LWP 10030]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `nginx: worker process '.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 ngx_http_auth_ldap_authenticate (conf=0x1df47c8, ctx=0x1e39320, r=0x1e38340) at /root/nginx-auth-ldap//ngx_http_auth_ldap_module.c:1756
1756 ctx->server = ((ngx_http_auth_ldap_server_t **) conf->servers->elts)[ctx->server_index];
(gdb) backtrace full
#0 ngx_http_auth_ldap_authenticate (conf=0x1df47c8, ctx=0x1e39320, r=0x1e38340) at /root/nginx-auth-ldap//ngx_http_auth_ldap_module.c:1756
No locals.
#1 ngx_http_auth_ldap_handler (r=0x1e38340) at /root/nginx-auth-ldap//ngx_http_auth_ldap_module.c:1717
alcf = 0x1df47c8
ctx = 0x1e39320
rc =
And my nginx installation is
root@security-monkey-nginx-auth-4e8f:/tmp# nginx -V nginx version: nginx/1.4.6 built by gcc 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) TLS SNI support enabled configure arguments: --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_spdy_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --add-module=/root/nginx-auth-ldap/ root@security-monkey-nginx-auth-4e8f:/tmp#
Is this related to any specific version or options built for nginx? Anyone knows any working specs with nginx-ldap-auth?
Thanks!
here is another core dump I encountered by using the latest nginx:
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/share/nginx/sbin/nginx...done.
[New LWP 9043]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `nginx: worker process '.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 ngx_http_auth_ldap_authenticate (conf=0x271e340, ctx=0x27509e0, r=0x274f9d0) at /root/nginx-auth-ldap//ngx_http_auth_ldap_module.c:1756
1756 ctx->server = ((ngx_http_auth_ldap_server_t **) conf->servers->elts)[ctx->server_index];
(gdb) bt full
#0 ngx_http_auth_ldap_authenticate (conf=0x271e340, ctx=0x27509e0, r=0x274f9d0) at /root/nginx-auth-ldap//ngx_http_auth_ldap_module.c:1756
No locals.
#1 ngx_http_auth_ldap_handler (r=0x274f9d0) at /root/nginx-auth-ldap//ngx_http_auth_ldap_module.c:1717
alcf = 0x271e340
ctx = 0x27509e0
rc =
still experiencing same issue, has anyone ever solved this?
Still have the same issue after config max_down_retries. If no max_down_retries, it keeps log error message: http_auth_ldap: ldap_result() failed (-1: Can't contact LDAP server)