-
Notifications
You must be signed in to change notification settings - Fork 2k
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
vtimer_msg crashes after some time - unless there is a delay between msg_receive(&m); and accessing m #1811
Comments
As stated on IRC: I've got a similar issue on the mega2560 - so either similar code (I think of you, |
Some debugging with turning LEDs on and off suggests the crash happens in _msg_receive at |
|
Hm, that just moves the place where the fault happens around, looks like I've got some memory corruption going on
|
Try to build with |
native does not crash on my laptop ( |
@N8Fear @benpicco can you retry with diff --git a/core/hwtimer.c b/core/hwtimer.c
index e878ffb..92f634a 100644
--- a/core/hwtimer.c
+++ b/core/hwtimer.c
@@ -148,16 +148,12 @@ static int _hwtimer_set(unsigned long offset, void (*callback)(void*), void *ptr
{
DEBUG("_hwtimer_set: offset=%lu callback=%p ptr=%p absolute=%d\n", offset, callback, ptr, absolute);
- if (!inISR()) {
- dINT();
- }
+ unsigned state = disableIRQ();
int n = lifo_get(lifo);
if (n == -1) {
- if (!inISR()) {
- eINT();
- }
+ restoreIRQ(state);
puts("No hwtimer left.");
return -1;
@@ -177,9 +173,7 @@ static int _hwtimer_set(unsigned long offset, void (*callback)(void*), void *ptr
lpm_prevent_sleep++;
- if (!inISR()) {
- eINT();
- }
+ restoreIRQ(state);
return n;
} |
I've just checked out the latest
then it hangs. If I add
Intel(R) Core(TM) i5-4430 CPU @ 3.00GHz if that matters, gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2 |
@kaspar030 just opened a PR for that: #1883 |
Just tested with #1883 on native - both timers run on ~2 sec. Haven't got my hardware at hand so I can't test on the mega2560 right now. Edit: Note that this seems to be the same for current master on my laptop as well (with a single "Hello World" every ~18 sek). |
Weird, I'm not even able to reproduce #547 (comment) It's not crashing, but the output is wrong anyway.
Update: The output varies and it is crashing from time to time. |
On my desktop computer ( |
And: #1883 does not change this. |
From my tries at debugging this (or something similar) on the mega2560 I guess it's the mutex in |
Changing |
Funny thing: in current master it misbehaves and crashes on my desktop, but runs correctly on my laptop... |
Is this issue fixed by now? |
It's still broken on
|
Please note that the |
I just checked native, it doesn't crash anymore. Also, as vtimer got kicked out, this is now using vtimer_compat and thus xtimer. So I'll close this as solved. |
Now this one had me puzzled for quite a bit.
On ek-tm4c123gxl tests/vtimer_msg crashes after ~53s - that is, just to make debugging even more confusing, shortly after the hardware timer overflows for the first time.
It also crashes on native after 10s, but I know that native isn't quite as stable, so I disregarded that.
Now when adding a short delay after
msg_receive(&m);
intimer_thread
, the crash goes away:The text was updated successfully, but these errors were encountered: