-
Notifications
You must be signed in to change notification settings - Fork 3k
mbed os crash on connecting ethernet adapter connect K64 #5680
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
Comments
@NirSonnenschein somewhere in the code, @kjbracey-arm @SeppoTakalo |
I assume this is a debug profile build? The message comes from If you could stick a breakpoint on that to get a stack backtrace, it would help - I can see about a dozen places that could possibly call it with (NULL, osErrorParameter), and it's not obvious what the culprit would be. Most of them are simply calling functions with a NULL thread pointer, plus a couple of others. This is during the connect call, right? |
Hi @0xc0170 and @kjbracey-arm, as a general background this happens occasionally on our nightly tests (e.g. nightly for two nights ago had it, but last night didn't). the particular configuration which failed in this case was mbedOS compiled with armcc in debug mode. This issue doesn't seem to reproduce cleanly when testing locally. I'll try this again today, if I'm able to reproduce locally I can try to use a breakpoint. |
It seems moderately likely it might be the consequence of connection failure - some sort of teardown when giving up not going cleanly. Maybe you could encourage it by persuading connect failure - yank the cable at the crucial moment... |
Hi @kjbracey-arm , |
I've tried reproducing locally (including disconnecting the Ethernet wire during testing) and so far I have not been able to reproduce the issue. this seems to be more readily reproducible in the Jenkins test environment. |
Any chance it's this bug? #5587 Can't immediately see why we'd hit it, but it is the same error printout. |
small update, happens on gcc arm also (caught in debug): |
yes the issue seems to reproduce more easily in the Jenkins lab environment (happens there pretty often but I was not able to reproduce on the local network). |
I'm having a similar / possibly the same issue during network stack init with mbed commit Error occurs at |1346 // Check parameters │
│1347 if ((thread == NULL) || (thread->id != osRtxIdThread) || │
│1348 (flags & ~((1U << osRtxThreadFlagsLimit) - 1U))) { │
B+>│1349 EvrRtxThreadError(thread, osErrorParameter); │
│1350 return ((uint32_t)osErrorParameter); │
│1351 } Serial output:
Backtrace:
It appears something is prompting a SVC interrupt with an invalid thread ID, but i'm not sure how and haven't worked out how to catch it prior to execution yet. |
Ta for the info! That was enough to pin it down. (Despite the annoyance that debuggers keep failing to get through exception stack frames.) It's an ordering error in the K64F driver - it's installing its interrupt handler in
This is not terribly harmful, but the "trap errors" thing in the debug build intercepts it, reasonably enough. Possible fixes:
|
Which Ethernet driver? The LwIP one or the Nanostack one, or both? That later debug print looks like border router so I'm assuming it is Nanostack's driver or both. |
Hang on, your #5579 is actually about a Nanostack issue. Not K64F at all. Oh well, you've helped solve this issue. So it seems that both pieces of code probably have the same flaw - calling osThreadFlagsSet before the thread is ready. Not identified the path to it with Nanostack yet. |
Yep, yep, different cause but suspect it's the same flaw. I can open another issue if you'd like? Looks like in I wonder what changed that this is now a runtime error / how many other things it is likely to effect. |
This is only a runtime error with the RTX error trapping on, which is only in debug builds since 5.6 I think, unless that's changed. More people testing debug builds now? |
The K64F Ethernet driver installs an interrupt handler that sets thread flags, and this could be called before the thread was initialised, so it would use a NULL thread ID. This triggers an RTX error-checking trap in debug builds, and could also lead to other problems with received packets not being processed. Adjusted so the RX interrupt handler does nothing if the thread isn't initialised yet, and manually trigger a RX event flag after initialising the thread in case any interrupts were ignored. An alternative would have been to implement eth_arch_enable_interrupts, but this mechanism is not present in the EMAC world - drivers will have to start returning interrupts in their power up. Fixes ARMmbed#5680
The silent / nearly impossible to debug runtime error handling in release builds cost me almost a month of head bashing before I worked out #5155, I wouldn't be surprised at all if / hope that is the case. |
The K64F Ethernet driver installs an interrupt handler that sets thread flags, and this could be called before the thread was initialised, so it would use a NULL thread ID. This triggers an RTX error-checking trap in debug builds, and could also lead to other problems with received packets not being processed. Adjusted so the RX interrupt handler does nothing if the thread isn't initialised yet, and manually trigger a RX event flag after initialising the thread in case any interrupts were ignored. An alternative would have been to implement eth_arch_enable_interrupts, but this mechanism is not present in the EMAC world - drivers will have to start returning interrupts in their power up. Fixes #5680
The K64F Ethernet driver installs an interrupt handler that sets thread flags, and this could be called before the thread was initialised, so it would use a NULL thread ID. This triggers an RTX error-checking trap in debug builds, and could also lead to other problems with received packets not being processed. Adjusted so the RX interrupt handler does nothing if the thread isn't initialised yet, and manually trigger a RX event flag after initialising the thread in case any interrupts were ignored. An alternative would have been to implement eth_arch_enable_interrupts, but this mechanism is not present in the EMAC world - drivers will have to start returning interrupts in their power up. Fixes #5680
The K64F Ethernet driver installs an interrupt handler that sets thread flags, and this could be called before the thread was initialised, so it would use a NULL thread ID. This triggers an RTX error-checking trap in debug builds, and could also lead to other problems with received packets not being processed. Adjusted so the RX interrupt handler does nothing if the thread isn't initialised yet, and manually trigger a RX event flag after initialising the thread in case any interrupts were ignored. An alternative would have been to implement eth_arch_enable_interrupts, but this mechanism is not present in the EMAC world - drivers will have to start returning interrupts in their power up. Fixes #5680
Uh oh!
There was an error while loading. Please reload this page.
Description
we see an error when connecting the Ethernet adaptor adaptor on K64f running MbedOS compiled under ARMCC. This doesn't always happen, but occurs quite often.
when it occurs we see the following print:
Thread 00000000 error -4: Parameter error
Bug
Target
K64F
Toolchain:
ARM (mostly on armcc)
Toolchain version:
mbed-cli version:
5.6 and 5.7
mbed-os sha:
(
git log -n1 --oneline
)DAPLink version:
Expected behavior
out code creates and Ethernet interface object calls the connect function.
the connect doesn't succeed or return an org.
Actual behavior
the test hangs and we see the following print:
Thread 00000000 error -4: Parameter error
Steps to reproduce
we run the following code as part of the network initialization for the K64F
The text was updated successfully, but these errors were encountered: