Bug 38068 - При запуске gnucash: terminate called without an active exception: getrandom: ENOSYS
Summary: При запуске gnucash: terminate called without an active exception: getrandom:...
Status: CLOSED WONTFIX
Alias: None
Product: Branch p9
Classification: Distributions
Component: boost-devel-headers (show other bugs)
Version: не указана
Hardware: x86_64 Linux
: P5 normal
Assignee: Vitaly Lipatov
QA Contact: qa-p9@altlinux.org
URL: https://github.com/boostorg/uuid/issu...
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-10 18:17 MSK by Vitaly Lipatov
Modified: 2020-02-12 03:13 MSK (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vitaly Lipatov 2020-02-10 18:17:31 MSK
После обновления до p9 (с gnucash-2.6.17-alt0.M80P.1 до gnucash-3.6-alt1) ранее открывавшийся файл стал вызывать падение с сообщением

$ gnucash TEST.gnucash
Found Finance::Quote version 1.47.
terminate called without an active exception

$ gdb gnucash
Thread 1 "gnucash" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	  return ret;
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff6c13515 in __GI_abort () at abort.c:79
#2  0x00007ffff65ad9d7 in __gnu_cxx::__verbose_terminate_handler () at ../../../../libstdc++-v3/libsupc++/vterminate.cc:95
#3  0x00007ffff65d14d6 in __cxxabiv1::__terminate (handler=<optimized out>) at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:47
#4  0x00007ffff65d1511 in std::terminate () at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:57
#5  0x00007ffff6e5ac5b in gnc::GUID::create_random () at /usr/include/c++/8/ext/new_allocator.h:86
#6  0x00007ffff6ee7e92 in guid_replace (guid=guid@entry=0x7a3400) at /usr/src/debug/gnucash-3.6/libgnucash/engine/guid.cpp:147
#7  0x00007ffff6f0d5fd in qof_instance_init_data (inst=inst@entry=0x7a3450, type=type@entry=0x7ffff6f7f1a8 "Book", book=book@entry=0x7a3450) at /usr/src/debug/gnucash-3.6/libgnucash/engine/qofinstance.cpp:301
#8  0x00007ffff6f0616d in qof_book_init (book=0x7a3450) at /usr/src/debug/gnucash-3.6/libgnucash/engine/qofbook.cpp:135
#9  qof_book_init (book=0x7a3450) at /usr/src/debug/gnucash-3.6/libgnucash/engine/qofbook.cpp:126
#10 0x00007ffff71782d7 in g_type_create_instance (type=<optimized out>) at ../gobject/gtype.c:1864
#11 0x00007ffff715a718 in g_object_new_internal (class=class@entry=0x1a13a10, params=params@entry=0x0, n_params=n_params@entry=0) at ../gobject/gobject.c:1805
#12 0x00007ffff715be95 in g_object_new_with_properties (object_type=27342544, n_properties=0, names=names@entry=0x0, values=values@entry=0x0) at ../gobject/gobject.c:1973
#13 0x00007ffff715c901 in g_object_new (object_type=<optimized out>, first_property_name=first_property_name@entry=0x0) at ../gobject/gobject.c:1645
#14 0x00007ffff6f06507 in qof_book_new () at /usr/src/debug/gnucash-3.6/libgnucash/engine/qofbook.cpp:390
#15 0x00007ffff6f1a6f9 in QofSessionImpl::QofSessionImpl (this=0x1a0e850) at /usr/src/debug/gnucash-3.6/libgnucash/engine/qofsession.cpp:121
#16 0x00007ffff6f1a756 in qof_session_new () at /usr/src/debug/gnucash-3.6/libgnucash/engine/qofsession.cpp:150
#17 0x00007ffff709d9bf in gnc_post_file_open (parent=0x792260, filename=filename@entry=0x1531b40 "TEST.gnucash", is_readonly=is_readonly@entry=0)
    at /usr/src/debug/gnucash-3.6/gnucash/gnome-utils/gnc-file.c:738
#18 0x00007ffff709e372 in gnc_file_open_file (open_readonly=0, newfile=0x1531b40 "TEST.gnucash", parent=<optimized out>)
    at /usr/src/debug/gnucash-3.6/gnucash/gnome-utils/gnc-file.c:1088
#19 gnc_file_open_file (parent=<optimized out>, newfile=newfile@entry=0x1531b40 "TEST.gnucash", open_readonly=open_readonly@entry=0)
    at /usr/src/debug/gnucash-3.6/gnucash/gnome-utils/gnc-file.c:1081
#20 0x0000000000403fc5 in inner_main (closure=<optimized out>, argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/gnucash-3.6/gnucash/gnucash-bin.c:651
#21 0x00007ffff7be25ad in invoke_main_func (body_data=0x7fffffffe0c0) at init.c:340
#22 0x00007ffff7bc4c4a in c_body (d=0x7fffffffe000) at continuations.c:422
#23 0x00007ffff7c46317 in vm_regular_engine (thread=0x2, vp=0xb3ff30, registers=0x0, resume=-1) at vm-engine.c:786
#24 0x00007ffff7c48b47 in scm_call_n (proc=proc@entry=0xaef820, argv=argv@entry=0x0, nargs=nargs@entry=0) at vm.c:1257
#25 0x00007ffff7bca889 in scm_call_0 (proc=proc@entry=0xaef820) at eval.c:481
#26 0x00007ffff7c376e2 in catch (tag=tag@entry=0x404, thunk=0xaef820, handler=0xaef800, pre_unwind_handler=0xaef7a0) at throw.c:137
#27 0x00007ffff7c379d5 in scm_catch_with_pre_unwind_handler (key=key@entry=0x404, thunk=<optimized out>, handler=<optimized out>, pre_unwind_handler=<optimized out>) at throw.c:254
#28 0x00007ffff7c37b9f in scm_c_catch (tag=tag@entry=0x404, body=body@entry=0x7ffff7bc4c40 <c_body>, body_data=body_data@entry=0x7fffffffe000, handler=handler@entry=0x7ffff7bc4ed0 <c_handler>, handler_data=handler_data@entry=0x7fffffffe000, 
    pre_unwind_handler=pre_unwind_handler@entry=0x7ffff7bc4d30 <pre_unwind_handler>, pre_unwind_handler_data=0xb3abc0) at throw.c:377
#29 0x00007ffff7bc5230 in scm_i_with_continuation_barrier (body=body@entry=0x7ffff7bc4c40 <c_body>, body_data=body_data@entry=0x7fffffffe000, handler=handler@entry=0x7ffff7bc4ed0 <c_handler>, handler_data=handler_data@entry=0x7fffffffe000, 
    pre_unwind_handler=pre_unwind_handler@entry=0x7ffff7bc4d30 <pre_unwind_handler>, pre_unwind_handler_data=0xb3abc0) at continuations.c:360
#30 0x00007ffff7bc52c5 in scm_c_with_continuation_barrier (func=<optimized out>, data=<optimized out>) at continuations.c:456
#31 0x00007ffff7c3632c in with_guile (base=base@entry=0x7fffffffe068, data=data@entry=0x7fffffffe090) at threads.c:661
#32 0x00007ffff6221aa8 in GC_call_with_stack_base (fn=fn@entry=0x7ffff7c362e0 <with_guile>, arg=arg@entry=0x7fffffffe090) at misc.c:1965
#33 0x00007ffff7c36648 in scm_i_with_guile (dynamic_state=<optimized out>, data=data@entry=0x7fffffffe090, func=func@entry=0x7ffff7be2590 <invoke_main_func>) at threads.c:704
#34 scm_with_guile (func=func@entry=0x7ffff7be2590 <invoke_main_func>, data=data@entry=0x7fffffffe0c0) at threads.c:710
#35 0x00007ffff7be2742 in scm_boot_guile (argc=1, argv=0x7fffffffe228, main_func=0x403e10 <inner_main>, closure=0x0) at init.c:323
#36 0x00000000004039d8 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/gnucash-3.6/gnucash/gnucash-bin.c:919
Comment 1 Vitaly Lipatov 2020-02-10 18:23:23 MSK
Установка gnucash-3.7-alt1 (пересобраннного из Сизифа) ничего не дало:

Thread 1 "gnucash" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	  return ret;
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff6c10515 in __GI_abort () at abort.c:79
#2  0x00007ffff65a99d7 in __gnu_cxx::__verbose_terminate_handler () at ../../../../libstdc++-v3/libsupc++/vterminate.cc:95
#3  0x00007ffff65cd4d6 in __cxxabiv1::__terminate (handler=<optimized out>) at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:47
#4  0x00007ffff65cd511 in std::terminate () at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:57
#5  0x00007ffff6e58cab in gnc::GUID::create_random () at /usr/include/c++/8/ext/new_allocator.h:86
#6  0x00007ffff6ee6002 in guid_replace (guid=guid@entry=0x7a4400) at /usr/src/debug/gnucash-3.7/libgnucash/engine/guid.cpp:147
#7  0x00007ffff6f0b85d in qof_instance_init_data (inst=inst@entry=0x7a4450, type=type@entry=0x7ffff6f7d368 "Book", book=book@entry=0x7a4450) at /usr/src/debug/gnucash-3.7/libgnucash/engine/qofinstance.cpp:301
#8  0x00007ffff6f0435d in qof_book_init (book=0x7a4450) at /usr/src/debug/gnucash-3.7/libgnucash/engine/qofbook.cpp:135
Comment 2 Andrey Cherepanov 2020-02-10 18:38:09 MSK
Ну да, gnucash - падучее недоразумение.
Comment 3 Vitaly Lipatov 2020-02-10 19:19:33 MSK
(Ответ для Andrey Cherepanov на комментарий #2)
> Ну да, gnucash - падучее недоразумение.
В данном случае это ядро openvz-2.6.32 и getrandom

strace:
getrandom(0x7ffd6ea4c6b0, 16, 0)        = -1 ENOSYS (Функция не реализована)
write(2, "terminate called after throwing "..., 48terminate called after throwing an instance of ') = 48

для тестовой программы
#include <boost/uuid/uuid.hpp>            // uuid class
#include <boost/uuid/uuid_generators.hpp> // generators
#include <boost/uuid/uuid_io.hpp>         // streaming operators etc.

#include <iostream>

int main()
{
    boost::uuids::uuid uuid = boost::uuids::random_generator()();
    std::cout << uuid << std::endl;
}
Comment 4 Vitaly Lipatov 2020-02-10 19:55:35 MSK
#7  0x0000000000402c1b in void boost::exception_detail::throw_exception_<boost::uuids::entropy_error>(boost::uuids::entropy_error const&, char const*, char const*, int) ()
#8  0x000000000040292d in boost::uuids::detail::random_provider_base::get_random_bytes(void*, unsigned long) ()
#9  0x00000000004029bb in boost::uuids::random_generator_pure::operator()() ()


После отладки get_random_bytes выяснилось, что это библиотечная getentropy не работает:
#include <unistd.h>
#include <stdio.h>

int main()
{
    char buf[100];
    int res = getentropy(buf,100);
    printf("getentropy result=%d\n", res);
}

strace:
getrandom(0x7ffe6b1d76c0, 100, 0)       = -1 ENOSYS (Функция не реализована)
Comment 5 Vitaly Lipatov 2020-02-10 22:59:15 MSK
Подобная проблема была с python:
https://bugzilla.altlinux.org/show_bug.cgi?id=33356

boost сейчас тоже не парится, если glibc >=2.25, использует getentropy:
#elif BOOST_LIB_C_GNU >= BOOST_VERSION_NUMBER(2, 25, 0) && !defined(BOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX)
# define BOOST_UUID_RANDOM_PROVIDER_GETENTROPY
# define BOOST_UUID_RANDOM_PROVIDER_NAME getentropy
Comment 6 Vitaly Lipatov 2020-02-12 03:13:00 MSK
Ядро 2.6.32-ovz-el не поддерживается.
Если в каком-то случае проблема будет актуальна, можно применять свою реализацию getrandom по аналогии с https://github.com/Etersoft/ignoreflock