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

Hang in malloc with Pico 2 after upgrade from SDK 2.0 to SDK 2.1 #2198

Open
ikjordan opened this issue Jan 19, 2025 · 1 comment
Open

Hang in malloc with Pico 2 after upgrade from SDK 2.0 to SDK 2.1 #2198

ikjordan opened this issue Jan 19, 2025 · 1 comment

Comments

@ikjordan
Copy link

I have an application that uses scanvideo on core 1 and processing logic on core 0. After update to SDK2.1 I see a likely race condition which sometimes results in core 1 hanging at the first malloc. Core 1 is blocked at mutex_enter_blocking(&malloc_mutex).

I have only seen this issue when using a Pico 2. This condition only manifests itself on the Pico 2 after a cold boot, with a release build. It does not occur when connected to a debugger, or if a reboot is triggered via the watchdog. The hanging line in malloc.c was identified by changing the pico LED state before and after the call.

The issue has been reproduced using the master and develop SDK2.1 branches. However, it does not occur if I move back to the version of the TinyUSB library that was in SDK 2.0. I therefore suspect that TinyUSB 17.0. may be triggering this. As further evidence of this, I can reproduce the issue with SDK 2.0 if I use it with the TinyUSB submodule version that is in SDK 2.1. It does not occur if I use SDK2.0 with the SDK 2.0 version of tinyUSB.

I am at a loss as to how to trace this further. For now my workaround is to use SDK2.1 with the TinyUSB submodule from 2.0. I've raised the issue in case others experience it too.

@ikjordan ikjordan changed the title Hang in Malloc with Pico 2 after upgrade for SDK 2.0 to SDK 2.1 Hang in Malloc with Pico 2 after upgrade from SDK 2.0 to SDK 2.1 Jan 19, 2025
@ikjordan ikjordan changed the title Hang in Malloc with Pico 2 after upgrade from SDK 2.0 to SDK 2.1 Hang in malloc with Pico 2 after upgrade from SDK 2.0 to SDK 2.1 Jan 19, 2025
@peterharperuk
Copy link
Contributor

Do you have a stack trace of both cores?

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