-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Copy link
Labels
Area: sysArea: SystemArea: SystemArea: timersArea: timer subsystemsArea: timer subsystemsType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)The issue reports a bug / The PR fixes a bug (including spelling errors)
Milestone
Description
Description
Bug in xtimer_msg_received_timeout(). Tested on native and saml21-xpro.
Steps to reproduce the issue
Test if callback can send msg to waiting thread.
Expected results
Thread is waiting with timeout on some callback (e.g. interrupt). Thread continues after msg_received or after timeout.
Actual results
After some iterations Segmentation fault on native. In saml21 output stops.
Versions
-----------------------------
Operating System: "Ubuntu" "19.10 (Eoan Ermine)"
Kernel: Linux 5.3.0-29-generic x86_64 x86_64
Installed compiler toolchains
-----------------------------
native gcc: gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008
arm-none-eabi-gcc: arm-none-eabi-gcc (15:7-2018-q2-6) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]
avr-gcc: missing
mips-mti-elf-gcc: missing
msp430-gcc: missing
riscv-none-embed-gcc: missing
xtensa-esp32-elf-gcc: missing
xtensa-lx106-elf-gcc: missing
clang: missing
Installed compiler libs
-----------------------
arm-none-eabi-newlib: "3.1.0"
mips-mti-elf-newlib: missing
riscv-none-embed-newlib: missing
xtensa-esp32-elf-newlib: missing
xtensa-lx106-elf-newlib: missing
avr-libc: missing (missing)
Installed development tools
---------------------------
cmake: missing
cppcheck: missing
doxygen: missing
flake8: missing
git: git version 2.20.1
make: GNU Make 4.2.1
openocd: Open On-Chip Debugger 0.10.0+dev-00973-g80f1a92b (2019-12-03-14:11)
python: Python 2.7.17
python2: Python 2.7.17
python3: Python 3.7.5
coccinelle: missing
Code
#include <stdio.h>
#include <string.h>
#include "xtimer.h"
#include "msg.h"
#include "thread.h"
#define DELAY (100UL * US_PER_MS)
xtimer_t timer;
static void timer_event(void *arg) {
kernel_pid_t *pid = (kernel_pid_t*)arg;
msg_t msg = {
.content.value = 1
};
puts("Interrupt");
msg_send_int(&msg, *pid);
puts("msg send");
xtimer_set(&timer, DELAY-20);
}
int main(void)
{
static msg_t rcv_queue[2];
printf("You are running RIOT on a(n) %s board.\n", RIOT_BOARD);
printf("This board features a(n) %s MCU.\n", RIOT_MCU);
msg_init_queue(rcv_queue, 2);
timer.callback = timer_event;
kernel_pid_t pid = thread_getpid();
timer.arg = (void*)&pid;
xtimer_set(&timer, DELAY-20);
while (1) {
puts("wait");
xtimer_msg_receive_timeout(rcv_queue, DELAY);
puts("received");
xtimer_sleep(1);
}
return 0;
}
Console output
RIOT native interrupts/signals initialized.
LED_RED_OFF
LED_GREEN_ON
RIOT native board initialized.
RIOT native hardware initialization complete.
main(): This is RIOT! (Version: 2019.07-devel-745-gfc957)
You are running RIOT on a(n) native board.
This board features a(n) native MCU.
wait
Interrupt
msg send
received
Interrupt
msg send
Interrupt
msg send
Interrupt
msg send
Interrupt
msg send
Interrupt
msg send
Interrupt
msg send
Interrupt
msg send
Interrupt
msg send
Interrupt
msg send
wait
received
make: *** [/home/jan/Documents/GIT/RIOT_Jan/examples/hello-world/../../Makefile.include:561: term] Segmentation fault (core dumped)
Metadata
Metadata
Assignees
Labels
Area: sysArea: SystemArea: SystemArea: timersArea: timer subsystemsArea: timer subsystemsType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)The issue reports a bug / The PR fixes a bug (including spelling errors)