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

Combobox causing thread 'tokio-runtime-worker' has overflowed its stack ? #371

Open
glennpierce opened this issue Jan 31, 2025 · 3 comments

Comments

@glennpierce
Copy link

I have a component that produces

thread 'tokio-runtime-worker' has overflowed its stack
fatal runtime error: stack overflow

It does this on a page reload on page. It doesn't do its when traversing pages with the router.

#[component]
pub fn TagsSelect(
    selected_tag: RwSignal<Option<String>>,
    #[prop(optional)] class: Option<&'static str>, // Add a class prop
) -> impl IntoView {

    view! {
        <span>
            <Combobox
                class="w-full min-w-0 p-2 border rounded-md text-sm h-10"
                placeholder="Select a Tag"
            >
                <ComboboxOption value="test" text="test" />
            </Combobox>
        </span>
    }
}

It seems to be the itself.

I replaced it with a standard select as a work around. It is below if that is helpful

#[component]
pub fn TagsSelect(
    selected_tag: RwSignal<Option<String>>,
    #[prop(optional)] class: Option<&'static str>,
) -> impl IntoView {
    let selected_value = RwSignal::new(None::<String>);
    let tag_options: RwSignal<Vec<(String, String)>> = RwSignal::new(vec![]);

    let tags_description_json = include_str!("./tags_description.json");
    let tags: HashMap<String, TagDescription> = serde_json::from_str(tags_description_json)
        .expect("Invalid JSON format");

    let mut tag_options_list = vec![("None".to_string(), "".to_string())];

    tag_options_list.extend(
        tags.iter()
            .map(|(key, tag_desc)| (format!("{} ({})", tag_desc.doc.clone(), key.clone()), key.clone()))
            .collect::<Vec<_>>(),
    );

    tag_options.set(tag_options_list);

    Effect::new(move || {
        let current_tag = selected_tag.get();
        log::info!("current_tag: {:?}", current_tag);
        if let Some(tag) = current_tag {
            selected_value.set(Some(tag.to_lowercase()));
        }
    });

    view! {
        <span class=format!("{} {}", "w-full", class.unwrap_or(""))>
            <select
                class="w-full min-w-0 p-2 border rounded-md text-sm h-10"
                on:change=move |ev| {
                    let value = event_target_value(&ev);
                    log::info!("Selected tag: {}", value);
                    if value.is_empty() {
                        selected_tag.set(None);
                    } else {
                        selected_tag.set(Some(value));
                    }
                }
            >
                {
                    tag_options.get().into_iter().map(|(label, value)| {
                        view! {
                            <option value=value.clone()>{label.clone()}</option>
                        }
                    }).collect::<Vec<_>>()
                }
            </select>
        </span>
    }
}
@luoxiaozero
Copy link
Collaborator

thread 'tokio-runtime-worker' has overflowed its stack
fatal runtime error: stack overflow

Could you please send the context of this error log?

@glennpierce
Copy link
Author

Closing this as running with

RUST_MIN_STACK=8388608 RUST_BACKTRACE=full cargo leptos watch

solves it. I guess the Combobox was just pushing it over some limit. Not sure but confident its not an issue with thaw.

@glennpierce
Copy link
Author

Going to reopen this again as my previous fix of increasing the stack size only makes it less likely.
I am not sure it is due to combo boxes but rather the amount of them (or any controls ?)

I have created a basic example of the problem

https://github.com/glennpierce/thawbug

it works until you add more

<ReportStyleCombobox report_style=report_form.report_style />
<ReportStyleCombobox report_style=report_form.report_style />
<ReportStyleCombobox report_style=report_form.report_style />
<ReportStyleCombobox report_style=report_form.report_style />
<ReportStyleCombobox report_style=report_form.report_style />

Eventually adding a ReportStyleCombobox cause

thread 'main' has overflowed its stack
fatal runtime error: stack overflow

@glennpierce glennpierce reopened this Mar 12, 2025
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

No branches or pull requests

2 participants