blueprint-freespeech / ricochet-refresh

Anonymous peer-to-peer instant messaging
https://www.ricochetrefresh.net
Other
157 stars 27 forks source link

TorControl occasionally aborts with a failed assertion during startup #157

Closed wfr closed 2 years ago

wfr commented 2 years ago

ricochet-refresh v3.0.12 occasionally crashes with an assertion during startup: ASSERT: "q->torVersionAsNewAs(QStringLiteral("0.3.5"))". Not reproducible in v3.0.11.

Normal log:

torctrl: Authentication successful
torctrl: Sent "TAKEOWNERSHIP"
torctrl: Sent "RESETCONF __OwningControllerProcess"
torctrl: Sent "SETEVENTS STATUS_CLIENT"
torctrl: Sent "SETEVENTS HS_DESC STATUS_CLIENT"
torctrl: Sent "GETINFO status/circuit-established status/bootstrap-phase net/listeners/socks version"
tor: "May 25 01:55:24.000 [notice] DisableNetwork is set. Tor will not make or accept non-control network connections. Shutting down all existing connections."
version:  "0.4.7.7"
torctrl: Sent "RESETCONF Bridge HTTPSProxy HTTPSProxyAuthenticator ReachableAddresses Socks4Proxy Socks5Proxy Socks5ProxyPassword Socks5ProxyUsername UseBridges"

Occasional crash log:

torctrl: Authentication successful
torctrl: Sent "TAKEOWNERSHIP"
torctrl: Sent "RESETCONF __OwningControllerProcess"
torctrl: Sent "SETEVENTS STATUS_CLIENT"
torctrl: Sent "SETEVENTS STATUS_CLIENT HS_DESC"
torctrl: Sent "GETINFO status/circuit-established status/bootstrap-phase net/listeners/socks version"
tor: "May 25 01:55:22.000 [notice] DisableNetwork is set. Tor will not make or accept non-control network connections. Shutting down all existing connections."
torctrl: Sent "RESETCONF Bridge HTTPSProxy HTTPSProxyAuthenticator ReachableAddresses Socks4Proxy Socks5Proxy Socks5ProxyPassword Socks5ProxyUsername UseBridges"
ASSERT: "q->torVersionAsNewAs(QStringLiteral("0.3.5"))" in file /home/user/ricochet-refresh/src/libtego/source/tor/TorControl.cpp, line 415
Aborted

It appears as if void TorControlPrivate::publishService() is called too early, before Tor transmits its version number. gdb backtrace:

(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49
#1  0x00007ffff558c546 in __GI_abort () at abort.c:79
#2  0x00007ffff5a2fb51 in  () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#3  0x00007ffff5a2efd8 in qt_assert_x(char const*, char const*, char const*, int) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x0000555555614fc8 in Tor::TorControlPrivate::publishService() (this=0x555555ad40f0) at /home/user/ricochet-refresh/src/libtego/source/tor/TorControl.cpp:415
#5  0x0000555555614eb2 in Tor::TorControl::publishHiddenService() (this=0x555555acd6d0) at /home/user/ricochet-refresh/src/libtego/source/tor/TorControl.cpp:405
#6  0x00005555555d3a78 in UserIdentity::setupService(QString const&) (this=0x5555560ebd60, serviceID=...)
    at /home/user/ricochet-refresh/src/libtego/source/core/UserIdentity.cpp:116
#7  0x00005555555d32d5 in UserIdentity::UserIdentity(int, QString const&, QObject*) (this=0x5555560ebd60, id=0, serviceID=..., parent=0x555555eae960)
    at /home/user/ricochet-refresh/src/libtego/source/core/UserIdentity.cpp:57
#8  0x00005555555cb452 in IdentityManager::IdentityManager(QString const&, QObject*) (this=0x555555eae960, serviceID=..., parent=0x0)
    at /home/user/ricochet-refresh/src/libtego/source/core/IdentityManager.cpp:51
#9  0x0000555555583eff in tego_context::start_service(tego_ed25519_private_key const*, tego_user_id const* const*, tego_user_type_t*, unsigned long)
    (this=0x555555a21160, hostPrivateKey=0x555555e0b2c0, userBuffer=0x555555d1b7d0, userTypeBuffer=0x555555eb0580, userCount=2)
    at /home/user/ricochet-refresh/src/libtego/source/context.cpp:246
#10 0x000055555558b81d in operator()() const (__closure=0x7fffffffd380) at /home/user/ricochet-refresh/src/libtego/source/context.cpp:916
#11 0x00005555555909d0 in tego::translateExceptions<tego_context_start_service(tego_context_t*, const tego_ed25519_private_key_t*, const tego_user_id_t* const*, tego_user_type_t*, size_t, tego_error_t**)::<lambda()> >(struct {...} &&, tego_error_t **) (fn=..., out_error=0x7fffffffd6e8)
    at /home/user/ricochet-refresh/src/libtego/source/error.hpp:17
#12 0x000055555558b931 in tego_context_start_service(tego_context_t*, tego_ed25519_private_key_t const*, tego_user_id_t const* const*, tego_user_type_t*, size_t, tego_error_t**) (context=0x555555a21160, hostPrivateKey=0x555555e0b2c0, userBuffer=0x555555d1b7d0, userTypeBuffer=0x555555eb0580, userCount=2, error=0x7fffffffd6e8)
    at /home/user/ricochet-refresh/src/libtego/source/context.cpp:901
#13 0x0000555555579679 in operator()(int, int) const (__closure=0x555555c4c8e0, newStatus=3) at /home/user/ricochet-refresh/src/ricochet-refresh/main.cpp:234
#14 0x000055555557cca5 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0, 1>, QtPrivate::List<int, int>, void, main(int, char**)::<lambda(int, int)> >::call(struct {...} &, void **) (f=..., arg=0x7fffffffd8e0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:146
#15 0x000055555557cb7e in QtPrivate::Functor<main(int, char**)::<lambda(int, int)>, 2>::call<QtPrivate::List<int, int>, void>(struct {...} &, void *, void **)
    (f=..., arg=0x7fffffffd8e0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:256
#16 0x000055555557ca7a in QtPrivate::QFunctorSlotObject<main(int, char**)::<lambda(int, int)>, 2, QtPrivate::List<int, int>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=1, this_=0x555555c4c8d0, r=0x555555a74e80, a=0x7fffffffd8e0, ret=0x0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:443
#17 0x00007ffff5c85133 in  () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#18 0x00005555556c8827 in shims::TorControl::statusChanged(int, int) (this=0x555555a74e80, _t1=3, _t2=2)
    at /home/user/ricochet-refresh/build/libtego_ui/tego_ui_autogen/APLP4W4C2V/moc_TorControl.cpp:278
#19 0x00005555556ed9d7 in shims::TorControl::setStatus(shims::TorControl::Status) (this=0x555555a74e80, status=shims::TorControl::Connected)
    at /home/user/ricochet-refresh/src/libtego_ui/shims/TorControl.cpp:391
pospeselr commented 2 years ago

Ah thought I'd squashed the last of these race conditions. Should be an easy enough fix.

pospeselr commented 2 years ago

Should be fixed in 226d68b0256c2fccd1d7a03ebf747d811a293cd4