Skip to content

Commit

Permalink
Universe shouldn't panic if thread is panicking (#2824)
Browse files Browse the repository at this point in the history
* Universe shouldn't panic if thread is panicking

If test fails with panic and universe drop is called it kills the test
runner instead of displaying the first panic.

Relates to #2766

* Fix format
  • Loading branch information
imotov authored Feb 16, 2023
1 parent 1f33df5 commit 22a4f0b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion quickwit/quickwit-actors/src/universe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

use std::thread;
use std::time::Duration;

use crate::mailbox::create_mailbox;
Expand Down Expand Up @@ -138,7 +139,10 @@ impl Universe {

impl Drop for Universe {
fn drop(&mut self) {
if cfg!(any(test, feature = "testsuite")) && !self.spawn_ctx.registry.is_empty() {
if cfg!(any(test, feature = "testsuite"))
&& !self.spawn_ctx.registry.is_empty()
&& !thread::panicking()
{
panic!(
"There are still running actors at the end of the test. Did you call \
universe.assert_quit()?"
Expand Down
2 changes: 1 addition & 1 deletion quickwit/quickwit-indexing/failpoints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use std::sync::Mutex;
use std::time::Duration;

use fail::FailScenario;
use quickwit_actors::{ActorExitStatus, Universe};
use quickwit_actors::ActorExitStatus;
use quickwit_common::io::IoControls;
use quickwit_common::rand::append_random_suffix;
use quickwit_common::split_file;
Expand Down

0 comments on commit 22a4f0b

Please sign in to comment.