回复: Segmentation fault sometimes

王 静凯 lywjk at outlook.com
Fri Nov 11 09:04:44 UTC 2022


Hi,
   Sorry I forget the mail I send before.
   Now the core file generate by nginx 1.22.0.
   It is meaningless to run nginx without third-party modules.
   I want to know if  it crash when calling functions in nginx ( not in third-party module ) , it is not the problem relate to third-party modules?  Or it also be likely to cause by third-party modules?

The print in gdb with ‘bt’ and ‘info local’:
````
Core was generated by `nginx: worker process                                '.
Program terminated with signal 11, Segmentation fault.
#0  0x0000000000464af6 in ngx_log_error_core (level=8, log=0x3f05518, err=<optimized out>, fmt=0x7ffdf20c6124 "") at src/core/ngx_log.c:168

warning: Source file is more recent than executable.
168              log->writer(log, level, errstr, p - errstr);
Missing separate debuginfos, use: debuginfo-install glibc-2.17-317.el7.x86_64 nss-softokn-freebl-3.34.0-2.el7.x86_64 sssd-client-1.16.0-19.el7.x86_64
(gdb) bt
#0  0x0000000000464af6 in ngx_log_error_core (level=8, log=0x3f05518, err=<optimized out>, fmt=0x7ffdf20c6124 "") at src/core/ngx_log.c:168
#1  0x00000000004873d7 in ngx_memalign (alignment=16, size=4096, log=0x3f05518) at src/os/unix/ngx_alloc.c:65
#2  0x000000000046508f in ngx_palloc_block (pool=0x4028770, size=72) at src/core/ngx_palloc.c:186
#3  0x000000000046527f in ngx_palloc_small (align=1, size=<optimized out>, pool=<optimized out>) at src/core/ngx_palloc.c:173
#4  ngx_palloc (pool=<optimized out>, size=<optimized out>) at src/core/ngx_palloc.c:127
#5  0x0000000000465342 in ngx_pcalloc (pool=<optimized out>, size=72) at src/core/ngx_palloc.c:302
#6  0x0000000000554834 in ngx_rtmp_shared_alloc_frame (size=4096, cl=0x402e830, mandatory=0) at ../nginx-rtmp-module/ngx_rtmp_shared_module.c:229
#7  0x000000000053c134 in ngx_rtmp_live_av (s=0x47d6eb0, h=0x47cee70, in=0x402e830) at ../nginx-rtmp-module/ngx_rtmp_live_module.c:773
#8  0x000000000053124a in ngx_rtmp_receive_message (s=0x47d6eb0, h=0x47cee70, in=0x402e830) at ../nginx-rtmp-module/ngx_rtmp_handler.c:875
#9  0x000000000053200e in ngx_rtmp_recv (rev=<optimized out>) at ../nginx-rtmp-module/ngx_rtmp_handler.c:486
#10 0x000000000048e148 in ngx_epoll_process_events (cycle=0x4470dd0, timer=<optimized out>, flags=<optimized out>) at src/event/modules/ngx_epoll_module.c:901
#11 0x0000000000483747 in ngx_process_events_and_timers (cycle=0x4470dd0) at src/event/ngx_event.c:248
#12 0x000000000048bc23 in ngx_worker_process_cycle (cycle=0x4470dd0, data=<optimized out>) at src/os/unix/ngx_process_cycle.c:721
#13 0x000000000048a310 in ngx_spawn_process (cycle=0x4470dd0, proc=0x48bb90 <ngx_worker_process_cycle>, data=0x0, name=0x7503bd "worker process", respawn=2)
    at src/os/unix/ngx_process.c:199
#14 0x000000000048c6ab in ngx_reap_children (cycle=0x4470dd0) at src/os/unix/ngx_process_cycle.c:598
#15 ngx_master_process_cycle (cycle=0x4470dd0) at src/os/unix/ngx_process_cycle.c:174
#16 0x0000000000463f1c in main (argc=<optimized out>, argv=<optimized out>) at src/core/nginx.c:383

(gdb) info local
args = {{gp_offset = 48, fp_offset = 48, overflow_arg_area = 0x7ffdf20c69d8, reg_save_area = 0x7ffdf20c68e0}}
p = 0x7ffdf20c6124 ""
last = 0x7ffdf20c68c0 "0"
msg = 0x7ffdf20c60fa "posix_memalign: 0000000003EBB6C0:4096 @16\n"
n = <optimized out>
wrote_stderr = <optimized out>
debug_connection = <optimized out>
errstr = "2022/11/07 16:31:26 [debug] 6668#0: *15946442335153920488 posix_memalign: 0000000003EBB6C0:4096 @16\n", '\000' <repeats 1947 times>
````

从 Windows 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>发送

________________________________
发件人: nginx <nginx-bounces at nginx.org> 代表 Sergey A. Osokin <osa at freebsd.org.ru>
发送时间: Tuesday, August 31, 2021 6:30:00 AM
收件人: nginx at nginx.org <nginx at nginx.org>
主题: Re: Segmentation fault sometimes

Hi there,

is it reproducible without the third-party module?
Could you try to reproduce the issue with the recent version from
the stable branch, i.e. 1.20.1.

Thanks.

--
Sergey Osokin

On Tue, Aug 24, 2021 at 08:37:47AM +0000, 王 静凯 wrote:
> Hi,
>
> The ‘nginx -V’ info:
> ````
> nginx version: nginx/1.20.0
> built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
> built with OpenSSL 1.1.1k  25 Mar 2021
> TLS SNI support enabled
> configure arguments: --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --error-log-path=/usr/local/nginx/logs/error.log --http-client-body-temp-path=/usr/local/nginx/client_temp --http-proxy-temp-path=/usr/local/nginx/proxy_temp --http-fastcgi-temp-path=/usr/local/nginx/fastcgi_temp --http-uwsgi-temp-path=/usr/local/nginx/uwsgi_temp --http-scgi-temp-path=/usr/local/nginx/scgi_temp --user=nginx --group=nginx --add-module=../fastdfs-nginx-module-1.22/src --add-module=../nginx-client-module --add-module=../nginx-multiport-module --add-module=../nginx-toolkit-module --add-module=../nginx-rtmp-module --add-module=../nginx-ts-module --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-openssl=../openssl-1.1.1k --with-pcre=../pcre-8.44 --with-zlib=../zlib-1.2.11 --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 -fPIC' --with-debug
> ````
>
> The nginx compile with ‘https://apac01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpingostack%2Fpingos%25E2%2580%2599&data=04%7C01%7C%7C2b3c1ee12ca94586388f08d96c05c78c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637659594355757137%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=99WVAQjYt3ZNlu9omy4mNJfm6gaqa15KMDXjUKV%2BaQo%3D&reserved=0 project and ‘https://apac01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fhappyfish100%2Ffastdfs-nginx-module%25E2%2580%2599&data=04%7C01%7C%7C2b3c1ee12ca94586388f08d96c05c78c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637659594355757137%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=lNEJOyFUwjKytPl1Xo4f182Z6vR1QKa3Va6O8JFatzw%3D&reserved=0 project.
>
> Sometimes it crashed serveral times continuously. But then it works for a long time normally.
>
> It shows
> ````
> #0  0x0000006e6f697461 in ?? ()
> #1  0x0000000000464ed6 in ngx_log_error_core (level=level at entry=8, log=log at entry=0x3d27608, err=err at entry=0, fmt=fmt at entry=0x7a2816 "posix_memalign: %p:%uz @%uz")
>     at src/core/ngx_log.c:168
> #2  0x000000000048ab24 in ngx_memalign (alignment=alignment at entry=16, size=size at entry=4096, log=0x3d27608) at src/os/unix/ngx_alloc.c:65
> #3  0x0000000000465aa2 in ngx_palloc_block (pool=0x3bf9b50, size=72) at src/core/ngx_palloc.c:186
> #4  0x000000000046608e in ngx_pcalloc (pool=<optimized out>, size=size at entry=72) at src/core/ngx_palloc.c:302
> #5  0x0000000000582c73 in ngx_rtmp_shared_alloc_frame (size=4096, cl=cl at entry=0x3d3c960, mandatory=mandatory at entry=0)
>     at ../nginx-rtmp-module/ngx_rtmp_shared_module.c:225
> #6  0x00000000005689e9 in ngx_rtmp_live_av (s=0x3fb8bf0, h=0x3bb1290, in=0x3d3c960) at ../nginx-rtmp-module/ngx_rtmp_live_module.c:773
> #7  0x000000000055d1d8 in ngx_rtmp_receive_message (s=s at entry=0x3fb8bf0, h=h at entry=0x3bb1290, in=in at entry=0x3d3c960)
>     at ../nginx-rtmp-module/ngx_rtmp_handler.c:874
> #8  0x000000000055d991 in ngx_rtmp_recv (rev=<optimized out>) at ../nginx-rtmp-module/ngx_rtmp_handler.c:486
> #9  0x0000000000491f11 in ngx_epoll_process_events (cycle=0x43bde90, timer=<optimized out>, flags=<optimized out>) at src/event/modules/ngx_epoll_module.c:901
> #10 0x00000000004861d6 in ngx_process_events_and_timers (cycle=cycle at entry=0x43bde90) at src/event/ngx_event.c:247
> #11 0x000000000048f9e5 in ngx_worker_process_cycle (cycle=cycle at entry=0x43bde90, data=data at entry=0x0) at src/os/unix/ngx_process_cycle.c:719
> #12 0x000000000048df5f in ngx_spawn_process (cycle=cycle at entry=0x43bde90, proc=proc at entry=0x48f990 <ngx_worker_process_cycle>, data=data at entry=0x0,
>     name=name at entry=0x7a3486 "worker process", respawn=respawn at entry=-4) at src/os/unix/ngx_process.c:199
> ````
> Or
>
> ````
> (gdb) bt
> #0  0x0000000000464f13 in ngx_write_fd (n=100, buf=0x7ffd8d7ef2f0, fd=<error reading variable: Cannot access memory at address 0x66736e6172740064>)
>     at src/os/unix/ngx_files.h:147
> #1  ngx_log_error_core (level=level at entry=8, log=log at entry=0x3b94c58, err=err at entry=0, fmt=fmt at entry=0x7a2816 "posix_memalign: %p:%uz @%uz")
>     at src/core/ngx_log.c:183
> #2  0x000000000048ab24 in ngx_memalign (alignment=alignment at entry=16, size=size at entry=4096, log=0x3b94c58) at src/os/unix/ngx_alloc.c:65
> #3  0x0000000000465aa2 in ngx_palloc_block (pool=0x3c3c0b0, size=96) at src/core/ngx_palloc.c:186
> #4  0x000000000046608e in ngx_pcalloc (pool=<optimized out>, size=size at entry=96) at src/core/ngx_palloc.c:302
> ````
>
> In gdb

_______________________________________________
nginx mailing list
nginx at nginx.org
https://apac01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmailman.nginx.org%2Fmailman%2Flistinfo%2Fnginx&data=04%7C01%7C%7C2b3c1ee12ca94586388f08d96c05c78c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637659594355757137%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=BHHjltjAbdoSBaw2Sv8b2H6UAle%2BoALK57ZQ9F5dCIA%3D&reserved=0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20221111/b5a67f04/attachment.htm>


More information about the nginx mailing list