Skip to content

Soft reboot causes issues with debugger is stopped #603

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

Closed
josesimoes opened this issue Apr 23, 2020 · 1 comment · Fixed by nanoframework/nf-interpreter#1619
Closed

Comments

@josesimoes
Copy link
Member

Details about Problem

Target: all

Firmware image version:

Worked before? If so, with which nanoFramework image version:

Description

There is a race condition with g_CLR_DBG_Debugger structure which is is free’d at a soft reboot https://github.com/nanoframework/nf-interpreter/blob/136a95eca192cf9ab881da1840025c855ab91551/src/CLR/Debugger/Debugger.cpp#L125 and then, in the short time interval before it is re-initialized, a message from the extension would occasionally arrive and use this now invalid structure. This leds to a hard-fault.

A good fix for this is to set the g_CLR_DBG_Debugger pointer to NULL after it is free’d with platform_free.

Along with this checking for a NULL struct at https://github.com/nanoframework/nf-interpreter/blob/136a95eca192cf9ab881da1840025c855ab91551/src/CLR/Messaging/Messaging.cpp#L394 is required.

Expected behaviour

A clean soft reboot without hard faults is expected for a smooth operation.

Additional context

Fix suggested by Patrick Haldi from CSAEngineeringAG in CSAEngineeringAG/2g-nf-interpreter@94320db

@josesimoes
Copy link
Member Author

@patrick-haldi feel free to shoot the PR when you're ready! 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants