Skip to content

Commit

Permalink
Drop pure declaration from Proxy::signal_dispatch method
Browse files Browse the repository at this point in the history
This occasionally, but reproducibly, leads to SIGABRT with message

> pure virtual method called
> terminate called without an active exception
> Aborted (core dumped)

 Stack trace of thread 3330:
 #0  0x00007f0edf9e754c __pthread_kill_implementation (libc.so.6 + 0xa154c)
 GSI-CS-CO#1  0x00007f0edf99ad06 raise (libc.so.6 + 0x54d06)
 GSI-CS-CO#2  0x00007f0edf96e885 abort (libc.so.6 + 0x28885)
 GSI-CS-CO#3  0x00007f0edfce6a01 _ZN9__gnu_cxx27__verbose_terminate_handlerEv.cold (libstdc++.so.6 + 0xa1a01)
 GSI-CS-CO#4  0x00007f0edfcf237c _ZN10__cxxabiv111__terminateEPFvvE (libstdc++.so.6 + 0xad37c)
 GSI-CS-CO#5  0x00007f0edfcf23e7 _ZSt9terminatev (libstdc++.so.6 + 0xad3e7)
 GSI-CS-CO#6  0x00007f0edfcf3115 __cxa_pure_virtual (libstdc++.so.6 + 0xae115)
 GSI-CS-CO#7  0x00007f0edff1b250 _ZN7saftbus11SignalGroup19wait_for_one_signalEi (libsaftbus.so.10 + 0x14250)
 GSI-CS-CO#8  0x00007f0edff1b2cf _ZN7saftbus11SignalGroup15wait_for_signalEi (libsaftbus.so.10 + 0x142cf)
 GSI-CS-CO#9  0x00000000004f063a operator() (Genesys_DU + 0xf063a)
 GSI-CS-CO#10 0x00007f0edfd20924 execute_native_thread_routine (libstdc++.so.6 + 0xdb924)
 GSI-CS-CO#11 0x00007f0edf9e5802 start_thread (libc.so.6 + 0x9f802)
 GSI-CS-CO#12 0x00007f0edf985450 __clone3 (libc.so.6 + 0x3f450)

Presumably, a derived Proxy object receives a signal during destruction,
just when the object's vtable switched to the base class right before lifetime ends.

While this issue surely is a corner case only likely to happen for applications
that heavily create and destroy conditions, I can trigger that quickly with Genesys
during typical operation.

After removing the pure declaration I wasn't able to crash the DU.

N.B. C++ pure virtual methods are allowed to have methods defined.
Such a definition is present in saftbus/client.cpp.
Removing said definition had no influence on the matter.
  • Loading branch information
milo-gsi committed Feb 15, 2024
1 parent 0e55e2b commit 5bbe0a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion saftbus/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ namespace saftbus {
///
/// @param interface_no refers to the interface (the mapping can be obtained by interface_no_from_name).
/// @param signal_no refers to the signal of a given interface. Signals are numbered by their appearance in the source code.
virtual bool signal_dispatch(int interface_no, int signal_no, Deserializer &signal_content) = 0;
virtual bool signal_dispatch(int interface_no, int signal_no, Deserializer &signal_content);

/// @brief The signal group to which this proxy belongs.
///
Expand Down

0 comments on commit 5bbe0a3

Please sign in to comment.