Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack overflow on a recursive query #4450

Closed
BrynCooke opened this issue Jan 9, 2024 Discussed in #4426 · 2 comments · Fixed by #4551
Closed

Stack overflow on a recursive query #4450

BrynCooke opened this issue Jan 9, 2024 Discussed in #4426 · 2 comments · Fixed by #4551
Assignees

Comments

@BrynCooke
Copy link
Contributor

Discussed in #4426

The following query will cause the router to core dump:

query Recursion {
  topProducts {
    reviews {
      author {
        ...UserFragment @defer
      }
    }
  }
}

fragment UserFragment on User {
  reviews {
      author {
        ...UserFragment @defer
      }
  }
}

Run this against the starstuff graph to reproduce.

@BrynCooke BrynCooke self-assigned this Jan 9, 2024
@BrynCooke
Copy link
Contributor Author

Stack trace:

apollo_router::spec::query::subselections::collect_from_selection_set subselections.rs:242
apollo_router::spec::query::subselections::collect_from_selection_set subselections.rs:242
apollo_router::spec::query::subselections::collect_from_selection_set subselections.rs:242
apollo_router::spec::query::subselections::collect_subselections subselections.rs:127
apollo_router::query_planner::bridge_query_planner::BridgeQueryPlanner::parse_selections::{{closure}} bridge_query_planner.rs:304
apollo_router::query_planner::bridge_query_planner::BridgeQueryPlanner::get::{{closure}} bridge_query_planner.rs:644
<apollo_router::query_planner::bridge_query_planner::BridgeQueryPlanner as tower_service::Service<apollo_router::services::query_planner::Request>>::call::{{closure}} bridge_query_planner.rs:566
<core::pin::Pin<P> as core::future::future::Future>::poll future.rs:125
apollo_router::query_planner::caching_query_planner::CachingQueryPlanner<T>::plan::{{closure}}::{{closure}} caching_query_planner.rs:353
<tracing::instrument::Instrumented<T> as core::future::future::Future>::poll instrument.rs:272
<core::pin::Pin<P> as core::future::future::Future>::poll future.rs:125
tokio::runtime::task::core::Core<T,S>::poll::{{closure}} core.rs:328
[Inlined] tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut unsafe_cell.rs:16
tokio::runtime::task::core::Core<T,S>::poll core.rs:317
tokio::runtime::task::harness::poll_future::{{closure}} harness.rs:485
<core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once unwind_safe.rs:271
std::panicking::try::do_call panicking.rs:504
__rust_try 0x000055a7d9dd4a1b
std::panicking::try panicking.rs:468
std::panic::catch_unwind panic.rs:142
tokio::runtime::task::harness::poll_future harness.rs:473
tokio::runtime::task::harness::Harness<T,S>::poll_inner harness.rs:208
tokio::runtime::task::harness::Harness<T,S>::poll harness.rs:153
tokio::runtime::task::raw::poll raw.rs:271
tokio::runtime::task::raw::RawTask::poll raw.rs:201
tokio::runtime::task::LocalNotified<S>::run mod.rs:416
tokio::runtime::scheduler::multi_thread::worker::Context::run_task::{{closure}} worker.rs:639
[Inlined] tokio::runtime::coop::with_budget coop.rs:107
[Inlined] tokio::runtime::coop::budget coop.rs:73
tokio::runtime::scheduler::multi_thread::worker::Context::run_task worker.rs:575
tokio::runtime::scheduler::multi_thread::worker::Context::run worker.rs:526
tokio::runtime::scheduler::multi_thread::worker::run::{{closure}}::{{closure}} worker.rs:491
tokio::runtime::context::scoped::Scoped<T>::set scoped.rs:40
tokio::runtime::context::set_scheduler::{{closure}} context.rs:176
std::thread::local::LocalKey<T>::try_with local.rs:270
std::thread::local::LocalKey<T>::with local.rs:246
tokio::runtime::context::set_scheduler context.rs:176
tokio::runtime::scheduler::multi_thread::worker::run::{{closure}} worker.rs:486
tokio::runtime::context::runtime::enter_runtime runtime.rs:65
tokio::runtime::scheduler::multi_thread::worker::run worker.rs:478
tokio::runtime::scheduler::multi_thread::worker::Launch::launch::{{closure}} worker.rs:447
<tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll task.rs:42
tokio::runtime::task::core::Core<T,S>::poll::{{closure}} core.rs:328
[Inlined] tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut unsafe_cell.rs:16
tokio::runtime::task::core::Core<T,S>::poll core.rs:317
tokio::runtime::task::harness::poll_future::{{closure}} harness.rs:485
<core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once unwind_safe.rs:271
std::panicking::try::do_call panicking.rs:504
__rust_try 0x000055a7df2c1e9b
std::panicking::try panicking.rs:468
std::panic::catch_unwind panic.rs:142
tokio::runtime::task::harness::poll_future harness.rs:473
tokio::runtime::task::harness::Harness<T,S>::poll_inner harness.rs:208
tokio::runtime::task::harness::Harness<T,S>::poll harness.rs:153
tokio::runtime::task::raw::poll raw.rs:271
tokio::runtime::task::raw::RawTask::poll raw.rs:201
tokio::runtime::task::UnownedTask<S>::run mod.rs:453
tokio::runtime::blocking::pool::Task::run pool.rs:159
tokio::runtime::blocking::pool::Inner::run pool.rs:513
tokio::runtime::blocking::pool::Spawner::spawn_thread::{{closure}} pool.rs:471
std::sys_common::backtrace::__rust_begin_short_backtrace backtrace.rs:154
std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}} mod.rs:529
<core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once unwind_safe.rs:271
std::panicking::try::do_call panicking.rs:504
__rust_try 0x000055a7df2c1e9b
std::panicking::try panicking.rs:468
[Inlined] std::panic::catch_unwind panic.rs:142
std::thread::Builder::spawn_unchecked_::{{closure}} mod.rs:528
core::ops::function::FnOnce::call_once{{vtable.shim}} function.rs:250
[Inlined] <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once boxed.rs:2007
[Inlined] <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once boxed.rs:2007
std::sys::unix::thread::Thread::new::thread_start thread.rs:108
start_thread 0x00007f7dc7894ac3
__clone3 0x00007f7dc7926660

@BrynCooke BrynCooke assigned lrlna and unassigned BrynCooke Jan 10, 2024
@BrynCooke
Copy link
Contributor Author

This will be fixed when validation via apollo-rs is switched on by default later this week.

@BrynCooke BrynCooke linked a pull request Feb 5, 2024 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants