Bug 258552 - java/openjdk11: core dump under FreeBSD-13.0-RELEASE with Chinese locale
Summary: java/openjdk11: core dump under FreeBSD-13.0-RELEASE with Chinese locale
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-java (Nobody)
Depends on:
Reported: 2021-09-17 00:53 UTC by huanghwh
Modified: 2022-08-05 02:14 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (java)

hs_err_pid11277.log (45.88 KB, text/plain)
2021-09-17 00:53 UTC, huanghwh
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description huanghwh 2021-09-17 00:53:16 UTC
Created attachment 227956 [details]

with Chinese locale zh_CN.UTF-8, openjdk11 can core dump quickly:

export LANG;
export LC_ALL;
while [ 1 ]; do
	java -version

without Chinese locale is fine.
Comment 1 Michael Osipov 2021-09-17 15:51:51 UTC
Comment on attachment 227956 [details]

Seems to be a FreeBSD bug after all:
> Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
> C  [libc.so.7+0xc8dae]  localeconv_l+0xbe
> C  [libc.so.7+0x1200a7]  vfprintf_l+0x3c7
> C  [libc.so.7+0x12b519]  vsnprintf+0x139
> V  [libjvm.so+0xd90b02]  JVM_RaiseSignal+0x264242

Try to load the core dump into LLDB and find the offending line in localeconv().
Comment 2 huanghwh 2021-09-18 11:48:54 UTC
# gdb -core java.core /usr/local/openjdk11/bin/java
GNU gdb (GDB) 10.2 [GDB v10.2 for FreeBSD]
Copyright (C) 2021 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-portbld-freebsd13.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
Find the GDB manual and other documentation resources online at:

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/openjdk11/bin/java...
[New LWP 351507]
[New LWP 102946]
[New LWP 351499]
[New LWP 351500]
[New LWP 351501]
[New LWP 351502]
[New LWP 351503]
[New LWP 351504]
[New LWP 351505]
[New LWP 351506]
Core was generated by `/usr/local/openjdk11/bin/java -version'.
Program terminated with signal SIGABRT, Aborted.
#0  thr_kill () at thr_kill.S:4
4	thr_kill.S: No such file or directory.
[Current thread is 1 (LWP 351507)]
(gdb) bt
#0  thr_kill () at thr_kill.S:4
#1  0x000000080116b064 in __raise (s=s@entry=6) at /usr/src/lib/libc/gen/raise.c:52
#2  0x000000080121ff29 in abort () at /usr/src/lib/libc/stdlib/abort.c:67
#3  0x0000000802b892d1 in os::abort(bool, void*, void const*) () from /usr/local/openjdk11/lib/server/libjvm.so
#4  0x0000000802da35c5 in VMError::report_and_die(int, char const*, char const*, __va_list_tag*, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long) () from /usr/local/openjdk11/lib/server/libjvm.so
#5  0x0000000802da2a14 in VMError::report_and_die(Thread*, unsigned int, unsigned char*, void*, void*, char const*, ...) ()
   from /usr/local/openjdk11/lib/server/libjvm.so
#6  0x0000000802da3681 in VMError::report_and_die(Thread*, unsigned int, unsigned char*, void*, void*) ()
   from /usr/local/openjdk11/lib/server/libjvm.so
#7  0x0000000802b8e260 in JVM_handle_bsd_signal () from /usr/local/openjdk11/lib/server/libjvm.so
#8  0x0000000802b8b20d in signalHandler(int, __siginfo*, void*) () from /usr/local/openjdk11/lib/server/libjvm.so
#9  0x00000008010a8e0e in handle_signal (actp=actp@entry=0x7fffdf7f50c0, sig=sig@entry=11, info=info@entry=0x7fffdf7f54b0, 
    ucp=ucp@entry=0x7fffdf7f5140) at /usr/src/lib/libthr/thread/thr_sig.c:301
#10 0x00000008010a83cf in thr_sighandler (sig=11, info=0x7fffdf7f54b0, _ucp=0x7fffdf7f5140) at /usr/src/lib/libthr/thread/thr_sig.c:246
#11 <signal handler called>
#12 0x0000000801184dae in localeconv_l (loc=loc@entry=0x80129ded8 <__xlocale_global_locale>) at /usr/src/lib/libc/locale/localeconv.c:91
#13 0x00000008011dc0a7 in __vfprintf (fp=0x7fffdf7f61b8, locale=0x80129ded8 <__xlocale_global_locale>, fmt0=0x8020db6bc " done", 
    ap=0x7fffdf7f6420) at /usr/src/lib/libc/stdio/vfprintf.c:480
#14 0x00000008011e7519 in vsnprintf_l (str=<optimized out>, n=34379287216, locale=0x80129ded8 <__xlocale_global_locale>, 
    fmt=<optimized out>, ap=<optimized out>) at /usr/src/lib/libc/stdio/vsnprintf.c:80
#15 vsnprintf (str=0x7fffdf7f64ba "", n=222, fmt=0x8020db6bc " done", ap=0x7fffdf7f6420) at /usr/src/lib/libc/stdio/vsnprintf.c:89
#16 0x0000000802b90b02 in os::vsnprintf(char*, unsigned long, char const*, __va_list_tag*) () from /usr/local/openjdk11/lib/server/libjvm.so
#17 0x0000000802914903 in jio_vsnprintf () from /usr/local/openjdk11/lib/server/libjvm.so
#18 0x0000000802675460 in FormatBuffer<256ul>::append(char const*, ...) () from /usr/local/openjdk11/lib/server/libjvm.so
#19 0x00000008027801c3 in EventMark::~EventMark() () from /usr/local/openjdk11/lib/server/libjvm.so
#20 0x0000000802659220 in ClassLoader::load_class(Symbol*, bool, Thread*) () from /usr/local/openjdk11/lib/server/libjvm.so
#21 0x0000000802d03fdf in SystemDictionary::load_instance_class(Symbol*, Handle, Thread*) () from /usr/local/openjdk11/lib/server/libjvm.so
#22 0x0000000802d02fd2 in SystemDictionary::resolve_instance_class_or_null(Symbol*, Handle, Handle, Thread*) ()
   from /usr/local/openjdk11/lib/server/libjvm.so
#23 0x0000000802d0221b in SystemDictionary::resolve_or_fail(Symbol*, Handle, Handle, bool, Thread*) ()
   from /usr/local/openjdk11/lib/server/libjvm.so
#24 0x00000008026e39ec in ConstantPool::klass_at_impl(constantPoolHandle const&, int, bool, Thread*) ()
   from /usr/local/openjdk11/lib/server/libjvm.so
#25 0x00000008026e8693 in ConstantPool::klass_at(int, Thread*) () from /usr/local/openjdk11/lib/server/libjvm.so
#26 0x0000000802a2c333 in LinkInfo::LinkInfo(constantPoolHandle const&, int, Thread*) () from /usr/local/openjdk11/lib/server/libjvm.so
#27 0x0000000802a30a47 in LinkResolver::resolve_invoke(CallInfo&, Handle, constantPoolHandle const&, int, Bytecodes::Code, Thread*) ()
   from /usr/local/openjdk11/lib/server/libjvm.so
#28 0x000000080286e3fb in InterpreterRuntime::resolve_invoke(JavaThread*, Bytecodes::Code) () from /usr/local/openjdk11/lib/server/libjvm.so
#29 0x000000080286eae8 in InterpreterRuntime::resolve_from_cache(JavaThread*, Bytecodes::Code) ()
--Type <RET> for more, q to quit, c to continue without paging--q
(gdb) up 12
#12 0x0000000801184dae in localeconv_l (loc=loc@entry=0x80129ded8 <__xlocale_global_locale>) at /usr/src/lib/libc/locale/localeconv.c:91
warning: Source file is more recent than executable.
91		M_ASSIGN_CHAR(int_p_cs_precedes);
(gdb) list
86		M_ASSIGN_CHAR(p_sep_by_space);
87		M_ASSIGN_CHAR(n_cs_precedes);
88		M_ASSIGN_CHAR(n_sep_by_space);
89		M_ASSIGN_CHAR(p_sign_posn);
90		M_ASSIGN_CHAR(n_sign_posn);
91		M_ASSIGN_CHAR(int_p_cs_precedes);
92		M_ASSIGN_CHAR(int_n_cs_precedes);
93		M_ASSIGN_CHAR(int_p_sep_by_space);
94		M_ASSIGN_CHAR(int_n_sep_by_space);
95		M_ASSIGN_CHAR(int_p_sign_posn);
Comment 3 Ronald Klop 2021-09-19 08:45:51 UTC
Is this related to bug #258360 ?
Comment 4 Greg Lewis freebsd_committer 2022-08-05 02:14:49 UTC
I can't repro this on my machine, but it is FreeBSD 12 and it looks like maybe the bug is only on 13?  Is it reproducible on 13.1?  I expect to update sometime soon and can try it then.