[Switching to LWP 1772723] 0x00007fffabe44696 in __ctype_init () from /usr/lib/libc.so.6 (gdb) bt #0 0x00007fffabe44696 in __ctype_init () from /usr/lib/libc.so.6 #1 0x00007fffabf785d1 in __libc_early_init () from /usr/lib/libc.so.6 #2 0x000000000118729f in dl_open_worker_begin () #3 0x000000000113a7b8 in _dl_catch_exception () #4 0x0000000001186469 in dl_open_worker () #5 0x000000000113a7b8 in _dl_catch_exception () #6 0x000000000118681b in _dl_open () #7 0x000000000113a8f6 in do_dlopen () #8 0x000000000113a7b8 in _dl_catch_exception () #9 0x000000000113a883 in _dl_catch_error () #10 0x000000000113aa74 in __libc_dlopen_mode () #11 0x0000000001128eb5 in module_load () #12 0x0000000001129315 in __nss_module_get_function () #13 0x0000000001118fec in getaddrinfo () #14 0x0000000001099119 in _cgo_04fbb8f65a5f_C2func_getaddrinfo (v=0xc00013ca90) at cgo-gcc-prolog:60 #15 0x0000000000481f84 in runtime.asmcgocall () at /root/.go/src/runtime/asm_amd64.s:923 #16 0x000000c0001048c0 in ?? () #17 0x000000000048045a in runtime.morestack () at /root/.go/src/runtime/asm_amd64.s:621 #18 0x47681163f543b200 in ?? () #19 0x0100000000000016 in ?? () #20 0x0000000000800000 in net.(*sysDialer).dialSerial (sd=0x0, ctx=..., ras=..., ~r0=..., ~r1=...) at /root/.go/src/net/dial.go:630 #21 0x0000000000000000 in ?? ()
#0 0x00007fffb0044696 in __GI___ctype_init () at ctype-info.c:31 #1 0x00007fffb01785d1 in __libc_early_init (initial=false) at libc_early_init.c:35 #2 0x000000000059549f in dl_open_worker_begin () #3 0x000000000054a5e8 in _dl_catch_exception () #4 0x0000000000594669 in dl_open_worker () #5 0x000000000054a5e8 in _dl_catch_exception () #6 0x0000000000594a1b in _dl_open () #7 0x000000000054a726 in do_dlopen () #8 0x000000000054a5e8 in _dl_catch_exception () #9 0x000000000054a6b3 in _dl_catch_error () #10 0x000000000054a8a4 in __libc_dlopen_mode () #11 0x0000000000538ce5 in module_load () #12 0x0000000000539145 in __nss_module_get_function () #13 0x000000000052aa3c in getaddrinfo () #14 0x00000000004da549 in _cgo_04fbb8f65a5f_C2func_getaddrinfo (v=0xc0001acdd0) at /tmp/go-build/cgo-gcc-prolog:60 #15 0x0000000000471204 in runtime.asmcgocall () at /root/.go/src/runtime/asm_amd64.s:923 #16 0x000000c0001868c0 in ?? ()
struct __locale_data { constchar *name; constchar *filedata; /* Region mapping the file data. */ off_t filesize; /* Size of the file (and the region). */ enum /* Flavorofstorageusedforthose. */ { ld_malloced, /* Both are malloc'd. */ ld_mapped, /* name is malloc'd, filedata mmap'd */ ld_archive /* Both point into mmap'd archive regions. */ } alloc;
/* This provides a slot for category-specific code to cache data computed about this locale. That code can set a cleanup function to deallocate the data. */ struct { void (*cleanup) (struct __locale_data *); union { void *data; structlc_time_data *time; conststructgconv_fcts *ctype; }; } private;
unsignedint usage_count; /* Counter for users. */
int use_translit; /* Nonzero if the mb*towv*() and wc*tomb() functions should use transliteration. */
unsignedint nstrings; /* Number of strings below. */ unionlocale_data_value { constuint32_t *wstr; constchar *string; unsignedint word; /* Note endian issues vs 64-bit pointers. */ } values __flexarr; /* Items, usually pointers into `filedata'. */ };
//v2.40
struct __locale_data { constchar *name; constchar *filedata; /* Region mapping the file data. */ off_t filesize; /* Size of the file (and the region). */ enum /* Flavorofstorageusedforthose. */ { ld_malloced, /* Both are malloc'd. */ ld_mapped, /* name is malloc'd, filedata mmap'd */ ld_archive /* Both point into mmap'd archive regions. */ } alloc;
/* This provides a slot for category-specific code to cache data computed about this locale. Type of the data pointed to: LC_CTYPE struct lc_ctype_data (_nl_intern_locale_data) LC_TIME struct lc_time_data (_nl_init_alt_digit, _nl_init_era_entries) This data deallocated at the start of _nl_unload_locale. */ void *private;
unsignedint usage_count; /* Counter for users. */
int use_translit; /* Nonzero if the mb*towv*() and wc*tomb() functions should use transliteration. */
unsignedint nstrings; /* Number of strings below. */ unionlocale_data_value { constuint32_t *wstr; constchar *string; unsignedint word; /* Note endian issues vs 64-bit pointers. */ } values __flexarr; /* Items, usually pointers into `filedata'. */ };
那么我们问题的 Root cause 也就得到了确定,整个问题的因果链如下
我们项目使用引入 Gin,来作为 HTTP Server
我们使用 localhost 来作为默认的监听地址
localhost 在服务端启动监听的时候触发了 DNS Lookup 行为
CGO_ENABLED=1 的情况下,Golang 默认使用 glibc 中的 getaddrinfo 进行 DNS lookup