<div dir="ltr"><div dir="ltr"><div>Hi all:</div><div>    My cowboy server 
<span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-">occasionally crashe, <span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-">I suspect that the data of the query is too large, but I don't know how to view the content of memory using gdb to find the detail data.</span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><br></span></span></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-">```<br></span></span>

</span></span>

</div><div dir="ltr">sudo gdb /home/q/erlang1705/lib/erlang/erts-6.4/bin/beam.smp core.18269 <br>GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-80.el7<br>Copyright (C) 2013 Free Software Foundation, Inc.<br>License GPLv3+: GNU GPL version 3 or later <<a href="http://gnu.org/licenses/gpl.html">http://gnu.org/licenses/gpl.html</a>><br>This is free software: you are free to change and redistribute it.<br>There is NO WARRANTY, to the extent permitted by law.  Type "show copying"<br>and "show warranty" for details.<br>This GDB was configured as "x86_64-redhat-linux-gnu".<br>For bug reporting instructions, please see:<br><<a href="http://www.gnu.org/software/gdb/bugs/">http://www.gnu.org/software/gdb/bugs/</a>>...<br>Reading symbols from /home/q/erlang1705/lib/erlang/erts-6.4/bin/beam.smp...done.<br>[New LWP 18288]<br>[New LWP 18274]<br>[New LWP 18276]<br>[New LWP 18289]<br>[New LWP 18281]<br>[New LWP 18273]<br>[New LWP 18280]<br>[New LWP 18278]<br>[New LWP 18277]<br>[New LWP 18284]<br>[New LWP 18282]<br>[New LWP 18275]<br>[New LWP 18287]<br>[New LWP 18285]<br>[New LWP 18291]<br>[New LWP 18269]<br>[New LWP 18279]<br>[New LWP 18286]<br>[New LWP 18292]<br>[New LWP 18290]<br>[New LWP 18271]<br>[New LWP 18272]<br>[New LWP 18283]<br>[Thread debugging using libthread_db enabled]<br>Using host libthread_db library "/lib64/libthread_db.so.1".<br>Core was generated by `/home/q/erlang1705/lib/erlang/erts-6.4/bin/beam.smp -- -root /home/q/erlang1705'.<br>Program terminated with signal 6, Aborted.<br>#0  0x00007fda423b55f7 in raise () from /lib64/libc.so.6<br>Missing separate debuginfos, use: debuginfo-install glibc-2.17-106.el7_2.8.x86_64 ncurses-libs-5.9-13.20130511.el7.x86_64 zlib-1.2.7-15.el7.x86_64<br>(gdb) bt<br>#0  0x00007fda423b55f7 in raise () from /lib64/libc.so.6<br>#1  0x00007fda423b6ce8 in abort () from /lib64/libc.so.6<br>#2  0x000000000045806e in erl_exit_vv (n=1, flush_async=flush_async@entry=0, fmt=fmt@entry=0x5fbce8 "%s: Cannot %s %lu bytes of memory (of type \"%s\", thread %d).\n", args1=args1@entry=0x7fda361ba830, args2=args2@entry=0x7fda361ba848)<br>    at beam/erl_init.c:2123<br>#3  0x0000000000458308 in erl_exit (n=n@entry=1, fmt=fmt@entry=0x5fbce8 "%s: Cannot %s %lu bytes of memory (of type \"%s\", thread %d).\n") at beam/erl_init.c:2133<br>#4  0x000000000043c4c1 in erts_alc_fatal_error (error=error@entry=1, func=<optimized out>, func@entry=0, n=n@entry=155) at beam/erl_alloc.c:1875<br>#5  0x000000000043c507 in erts_alloc_n_enomem (n=n@entry=155, size=size@entry=4723591984) at beam/erl_alloc.c:1900<br>#6  0x0000000000529023 in erts_alloc (size=4723591984, type=19862) at beam/erl_alloc.h:228<br>#7  minor_collection (recl=<synthetic pointer>, nobj=2, objv=0x7fda415d0380, need=0, p=0x7fda40a46a58) at beam/erl_gc.c:852<br>#8  erts_garbage_collect (p=p@entry=0x7fda40a46a58, need=need@entry=0, objv=0x7fda415d0380, nobj=2) at beam/erl_gc.c:450<br>#9  0x00000000005291d5 in erts_gc_after_bif_call (p=0x7fda40a46a58, result=0, regs=<optimized out>, arity=<optimized out>) at beam/erl_gc.c:362<br>#10 0x000000000056e99c in process_main () at beam/beam_emu.c:3578<br>#11 0x00000000004a734a in sched_thread_func (vesdp=0x7fda398acd40) at beam/erl_process.c:7695<br>#12 0x00000000005f6eb5 in thr_wrapper (vtwd=0x7ffcbf9b3b70) at pthread/ethread.c:106<br>#13 0x00007fda42951dc5 in start_thread () from /lib64/libpthread.so.0<br>#14 0x00007fda42476ced in clone () from /lib64/libc.so.6<br>(gdb) 9<br>Undefined command: "9".  Try "help".<br>(gdb) f 9<br>#9  0x00000000005291d5 in erts_gc_after_bif_call (p=0x7fda40a46a58, result=0, regs=<optimized out>, arity=<optimized out>) at beam/erl_gc.c:362<br>362                 cost = erts_garbage_collect(p, 0, regs, p->arity);<br>(gdb) source /home/q/lffan.liu/download/otp_src_17.5/erts/etc/unix/<a href="http://etp-commands.in">etp-commands.in</a><br>%---------------------------------------------------------------------------<br>% Use etp-help for a command overview and general help.<br>%<br>% To use the Erlang support module, the environment variable ROOTDIR<br>% must be set to the toplevel installation directory of Erlang/OTP,<br>% so the etp-commands file becomes:<br>%     $ROOTDIR/erts/etc/unix/etp-commands<br>% Also, erl and erlc must be in the path.<br>%---------------------------------------------------------------------------<br>etp-set-max-depth 20<br>etp-set-max-string-length 100<br>--------------- System Information ---------------<br>OTP release: 17<br>ERTS version: 6.4<br>Compile date: Thu Apr 11 12:23:01 2019<br>Arch: x86_64-unknown-linux-gnu<br>Endianness: Little<br>Word size: 64-bit<br>Halfword: no<br>HiPE support: yes<br>SMP support: yes<br>Thread support: yes<br>Kernel poll: Supported but not used<br>Debug compiled: no<br>Lock checking: no<br>Lock counting: no<br>Node name: 'ejb_http_server@localhost'<br>Number of schedulers: 8<br>Number of async-threads: 10<br>--------------------------------------------------<br>(gdb) etp-stackdump p<br>% Stackdump (21): #Cp<lists:reverse/1+0x120>.<br>#Cp<rfc4627:encode/1+0x48>.<br>#Cp<http_utils:gen_result/4+0x130>.<br>#Cp<http_get_history:post_echo/3+0x770>.<br>#Cp<http_get_history:do_handle/2+0x1c8>.<br>{http_req,#Port<0.101737>,ranch_tcp,keepalive,<0.15468.5>,#SubBinary<0x4,0,0xde010000:0x13fffcd2>,'HTTP/1.1',{{10,88,193,24},13758},#SubBinary<0xf,0,0x10000:0x13fffd2a>,undefined,80,#SubBinary<0x13,0,0xde000000:0x13fffd5a>,undefined,#SubBinary<0x48,0,0xde010000:0x13fffd8a>,undefined,[],[{#SubBinary<0x4,0,0xde010000:0x13fffffa>,#SubBinary<0xf,0,0x10000:0x1400002a>},{0.000000,#HeapBinary<0x2,0xffff3839>},{#SubBinary<0xf,0,0xd5010000:0x1400026a>,#SubBinary<0xd,0,0x10000:0x1400029a>},{#SubBinary<0xf,0,0xde010000:0x14000382>,#SubBinary<0xa,0,0x10000:0x140003b2>},{#SubBinary<0xa,0,0x10000:0x140004c2>,#SubBinary<0xb,0,0x10000:0x140004f2>},{#SubBinary<0xc,0,0x10000:0x14000612>,#SubBinary<0x21,0,0x10000:0x14000642>},{#SubBinary<0x6,0,0xde010000:0x14000792>,#SubBinary<0x18,0,0x10000:0x140007c2>},{#SubBinary<0x9,0,0xde010000:0x14000912>,#SubBinary<0xe,0,0xde010000:0x14000942>},{#SubBinary<0xd,0,0xde010000:0x14000a72>,#SubBinary<0x5,0,0x10000:0x14000aa2>},{#SubBinary<0xf,0,0xde010000:0x14000bba>,#SubBinary<0xe,0,0x10000:0x14000bea>}],[{0.000000,98},{0.000000,undefined},{0.000000,98}],undefined,[],...}.<br>#Cp<cowboy_handler:handler_handle/4+0xb8>.<br>[].<br>undefined.<br>[].<br>#Cp<cowboy_protocol:execute/4+0xb0>.<br>[].<br>[].<br>undefined.<br>http_get_history.<br>{state,[{handler,http_get_history},{handler_opts,[]},{listener,http},{dispatch,[{'_',[],[{[#RefcBinary<0x8,0x13fffcd0,0x311dfa20,0x311dfa38,0>],[],http_getusers,[]},{[#RefcBinary<0x7,0x140006f8,0x311c3288,0x311c32a0,0>],[],http_getdeps,[]},{[#RefcBinary<0xb,0x14000878,0x311e9fc0,0x311e9fd8,0>],[],http_getmsgs,[]},{[#RefcBinary<0xd,0x140009d8,0x311c2d10,0x311c2d28,0>],[],http_getonlineuser,[]},{[#RefcBinary<0xe,0x14000b20,0x311c2d50,0x311c2d68,0>],[],http_getonlineuser2,[]},{[#RefcBinary<0xe,0x14000c18,0x311e9e40,0x311e9e58,0>],[],http_get_adjacentmsg,...},{[...],[],...},{[...],...},{...},...]}]},{max_connections,infinity}],false,0,5000,infinity,undefined,false}.<br>{http_req,#Port<0.101737>,ranch_tcp,keepalive,<0.15468.5>,#SubBinary<0x4,0,0xde010000:0x13fffcd2>,'HTTP/1.1',{{10,88,193,24},13758},#SubBinary<0xf,0,0x10000:0x13fffd2a>,undefined,80,#SubBinary<0x13,0,0xde000000:0x13fffd5a>,undefined,#SubBinary<0x48,0,0xde010000:0x13fffd8a>,undefined,[],[{#SubBinary<0x4,0,0xde010000:0x13fffffa>,#SubBinary<0xf,0,0x10000:0x1400002a>},{#SubBinary<0xe,0,0xde010000:0x140001ba>,#SubBinary<0x2,0,0xde010000:0x140001ea>},{#SubBinary<0xf,0,0xd5010000:0x1400026a>,#SubBinary<0xd,0,0x10000:0x1400029a>},{#SubBinary<0xf,0,0xde010000:0x14000382>,#SubBinary<0xa,0,0x10000:0x140003b2>},{#SubBinary<0xa,0,0x10000:0x140004c2>,#SubBinary<0xb,0,0x10000:0x140004f2>},{#SubBinary<0xc,0,0x10000:0x14000612>,#SubBinary<0x21,0,0x10000:0x14000642>},{#SubBinary<0x6,0,0xde010000:0x14000792>,#SubBinary<0x18,0,0x10000:0x140007c2>},{#SubBinary<0x9,0,0xde010000:0x14000912>,#SubBinary<0xe,0,0xde010000:0x14000942>},{#SubBinary<0xd,0,0xde010000:0x14000a72>,#SubBinary<0x5,0,0x10000:0x14000aa2>},{#SubBinary<0xf,0,0xde010000:0x14000bba>,#SubBinary<0xe,0,0x10000:0x14000bea>}],[{0.000000,98},{0.000000,[Cannot access memory at address 0x18<br>(gdb) etp-process<br>etp-process-info         etp-process-memory-info  etp-processes            etp-processes-memory     <br>(gdb) etp-process-info p<br>  Pid: <0.15468.5><br>  State: garbage-collecting | running | active | prq-prio-normal | usr-prio-normal | act-prio-normal<br>  Current function: lists:reverse/2<br>  CP: #Cp<lists:reverse/1+0x120><br>  I: #Cp<0x3ff50a70><br>  Heap size: 492040832<br>  Mbuf size: 160000<br>  Msgq len: 0 (inner=0, outer=0)<br>  Parent: <0.600.0><br>  Pointer: (Process *) 0x7fda40a46a58</div><div dir="ltr">```<br></div></div></div>