Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
Kernel
rt_thread_delay
任务死在delay后
发布于 2020-08-05 09:42:02 浏览:1030
订阅该版
在我的项目中总共有13个任务在参与调度,最近调试发现,系统运行几个小时候后,其中一个任务(下面日志中的uhfscan任务)就会死掉(在调用rt_thread_delay之后再也没有被调度运行了)。其它任务正常。 任务死掉之后通过查找相关的资源状态:持锁、mem、ps等,没有发现任何异常。在uhfscan任务死掉之前因为持了一把锁,导致uhfproc被锁死,但是这个问题是正常的,而uhfscan会在rt_thread_delay之后死掉是个异常。 下面是跟踪的资源状态: ``` [2020-08-05 08:55:45:530]ps [2020-08-05 08:55:45:530]thread pri status sp stack size max used left tick error [2020-08-05 08:55:45:534]-------- --- ------- ---------- ---------- ------ ---------- --- [2020-08-05 08:55:45:580]tshell 2 running 0x00000080 0x00001000 09% 0x00000001 000 [2020-08-05 08:55:45:581]uhfproc 14 ready 0x00000078 0x00000800 30% 0x00000001 -02 [2020-08-05 08:55:45:581]uhfscan 15 ready 0x00000098 0x00000400 22% 0x00000002 -02 [2020-08-05 08:55:45:581]pp 17 ready 0x00000078 0x00000800 28% 0x00000003 -02 [2020-08-05 08:55:45:581]nwkrx 16 ready 0x00000168 0x00000800 23% 0x00000007 -02 [2020-08-05 08:55:45:581]led 5 suspend 0x00000068 0x00000200 25% 0x00000009 000 [2020-08-05 08:55:45:581]beeper 5 suspend 0x00000078 0x00000200 23% 0x0000000a 000 [2020-08-05 08:55:45:616]sfwdt 0 suspend 0x00000050 0x00000200 27% 0x00000006 000 [2020-08-05 08:55:45:616]tcpip 1 suspend 0x000001a0 0x00000800 23% 0x00000001 000 [2020-08-05 08:55:45:616]etx 12 ready 0x00000074 0x00000800 06% 0x00000009 000 [2020-08-05 08:55:45:616]erx 12 suspend 0x0000007c 0x00000800 15% 0x00000003 000 [2020-08-05 08:55:45:621]tidle0 31 ready 0x00000040 0x00000100 25% 0x00000013 000 [2020-08-05 08:55:45:621]timer 1 suspend 0x000000e8 0x00000400 53% 0x00000009 000 ``` ``` [2020-08-05 09:35:11:628]msh />list_timer [2020-08-05 09:35:13:667]timer periodic timeout flag [2020-08-05 09:35:13:668]-------- ---------- ---------- ----------- [2020-08-05 09:35:13:668]phylnk 0x000000c8 0x0016e2e0 activated [2020-08-05 09:35:13:668]pthb 0x000003e8 0x0016e21e activated [2020-08-05 09:35:13:668]tshell 0x00000000 0x00000000 deactivated [2020-08-05 09:35:13:668]uhfproc 0x00000003 0x0016e00e deactivated [2020-08-05 09:35:13:668]uhfscan 0x00000005 0x0016e00d deactivated [2020-08-05 09:35:13:669]pp 0x000000c8 0x0016e0b2 deactivated [2020-08-05 09:35:13:669]nwkrx 0x0000012c 0x0016e110 deactivated [2020-08-05 09:35:13:701]led 0x00000172 0x009ab70c activated [2020-08-05 09:35:13:702]beeper 0x00000014 0x00000088 deactivated [2020-08-05 09:35:13:702]sfwdt 0x000000c8 0x009ab6c0 activated [2020-08-05 09:35:13:702]tcpip 0x00000011 0x0016e01b deactivated [2020-08-05 09:35:13:702]etx 0x00000000 0x00000000 deactivated [2020-08-05 09:35:13:702]erx 0x00000000 0x00000000 deactivated [2020-08-05 09:35:13:707]tidle0 0x00000000 0x00000000 deactivated [2020-08-05 09:35:13:707]timer 0x00000006 0x0016e21e deactivated ``` ``` [2020-08-05 09:35:08:613]msh />list_mailbox [2020-08-05 09:35:08:805]mailbox entry size suspend thread [2020-08-05 09:35:08:805]-------- ---- ---- -------------- [2020-08-05 09:35:08:805]mbox1 0000 0010 0 [2020-08-05 09:35:08:805]pp 0000 0016 0 [2020-08-05 09:35:08:810]mbox0 0007 0008 0 [2020-08-05 09:35:08:810]etxmb 0000 0008 0 [2020-08-05 09:35:08:811]erxmb 0000 0008 1 ``` ``` [2020-08-05 09:35:00:762]mutex owner hold suspend thread [2020-08-05 09:35:00:762]-------- -------- ---- -------------- [2020-08-05 09:35:00:762]uhf uhfscan 0001 0 [2020-08-05 09:35:00:762]led (NULL) 0000 0 [2020-08-05 09:35:00:762]beeper (NULL) 0000 0 [2020-08-05 09:35:00:762]wdmtx (NULL) 0000 0 [2020-08-05 09:35:00:762]lfsmtx (NULL) 0000 0 [2020-08-05 09:35:00:762]flash0 (NULL) 0000 0 [2020-08-05 09:35:00:768]mu0 tcpip 0001 1 [2020-08-05 09:35:00:768]fslock (NULL) 0000 0 [2020-08-05 09:35:00:768]spi2 (NULL) 0000 0 ``` ``` [2020-08-05 09:34:56:239]semaphore v suspend thread [2020-08-05 09:34:56:239]-------- --- -------------- [2020-08-05 09:34:56:239]sem0 000 0 [2020-08-05 09:34:56:239]shrx 000 0 [2020-08-05 09:34:56:240]e0 000 1:tcpip [2020-08-05 09:34:56:245]heap 001 0 ``` ``` [2020-08-05 09:41:27:359]msh />free [2020-08-05 09:41:27:359]total memory: 65192 [2020-08-05 09:41:27:359]used memory : 27288 [2020-08-05 09:41:27:359]maximum allocated memory: 29664 ```
查看更多
2
个回答
默认排序
按发布时间排序
geniusgogo
认证专家
2020-08-06
这家伙很懒,什么也没写!
最新发现:调整了优先级后,uhfproc里send的时候,会与LWIP的tcpip任务抢锁,导致uhfproc锁死。感觉与上面原始问题是同一个根源。 LWIP里tcpip任务拿了mu0的锁之后,又获取e0信号量失败,导致tcpip挂起在e0上。而此时uhfproc任务又调用send去获取mu0挂起,这就发生了应用层任务假死现象。但是不清楚为什么tcpip会一直获取不到e0。 ``` thread pri status sp stack size max used left tick error -------- --- ------- ---------- ---------- ------ ---------- --- tshell 2 running 0x00000068 0x00001000 08% 0x00000005 000 uhfproc 12 suspend 0x00000140 0x00000800 30% 0x00000005 000 uhfscan 11 ready 0x000000a8 0x00000400 21% 0x00000003 -02 pp 14 suspend 0x00000078 0x00000800 27% 0x00000005 000 nwkrx 13 suspend 0x00000170 0x00000800 27% 0x00000008 000 led 5 suspend 0x00000070 0x00000200 26% 0x00000007 000 beeper 5 suspend 0x00000070 0x00000200 21% 0x0000000a 000 sfwdt 0 suspend 0x00000060 0x00000200 34% 0x0000000a 000 tcpip 10 suspend 0x000001c0 0x00000800 23% 0x0000000b 000 etx 15 ready 0x00000074 0x00000800 07% 0x00000008 000 erx 15 suspend 0x0000007c 0x00000800 19% 0x0000000b 000 tidle0 31 ready 0x00000058 0x00000100 34% 0x0000000b 000 timer 1 suspend 0x00000060 0x00000400 13% 0x00000009 000 ``` ``` msh />list_mutex mutex owner hold suspend thread -------- -------- ---- -------------- uhf uhfscan 0001 0 led (NULL) 0000 0 beeper (NULL) 0000 0 wdmtx (NULL) 0000 0 lfsmtx (NULL) 0000 0 flash0 (NULL) 0000 0 **mu0 tcpip 0001 2** fslock (NULL) 0000 0 spi2 (NULL) 0000 0 ``` ``` semaphore v suspend thread -------- --- -------------- sem0 000 0 shrx 000 0 e0 000 1:tcpip heap 001 0 ```
Ernest
2020-08-10
这家伙很懒,什么也没写!
``` 2020-08-05 08:55:45:581]uhfproc 14 ready 0x00000078 0x00000800 30% 0x00000001 -02 [2020-08-05 08:55:45:581]uhfscan 15 ready 0x00000098 0x00000400 22% 0x00000002 -02 [2020-08-05 08:55:45:581]pp 17 ready 0x00000078 0x00000800 28% 0x00000003 -02 [2020-08-05 08:55:45:581]nwkrx 16 ready 0x00000168 0x00000800 23% 0x00000007 -02 ``` 这里面看起来有几个线程超时了(14-17),是否为等待同一个或者不同资源引起的? tcpip 既拿锁 mu0,又 take e0,两种资源,逻辑上是否描述一下?包括相关线程行为的描述
撰写答案
登录
注册新账号
关注者
0
被浏览
1k
关于作者
geniusgogo
这家伙很懒,什么也没写!
提问
42
回答
157
被采纳
7
关注TA
发私信
相关问题
1
请教cpu使用率分析
2
选择FreeRTOS, 还是RT-Thread。
3
thread heap stack overflow ?
4
rtt消息队列delay问题
5
释放被删除线程的内存地方在哪里啊
6
请教:各线程结束后,释放其中的内存的连续性问题
7
STM32F103中断关于信号量、邮箱问题
8
RTT中的线程栈大小如何控制
9
关于线程由执行态变为挂起态的代码实现,,,
10
rt_malloc(rt_size_t size)内存分配函数最小分配尺寸问题
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
RT-Thread动态模块
2
RT-Thread项目助手v0.3 | Ubuntu与MacOS平台的RT-Thread Env
3
【FRA156测评DM-MCX】- 环境配置篇
4
【基于HPM6750+RW007的网页服务器】---SD卡文件系统
5
有关RT_thread studio使用WDT的一点经验
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
USB
DMA
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
rt-smart
RTC
FAL
I2C_IIC
ESP8266
UART
cubemx
WIZnet_W5500
ota在线升级
PWM
BSP
flash
freemodbus
packages_软件包
潘多拉开发板_Pandora
GD32
定时器
ADC
flashDB
编译报错
socket
中断
rt_mq_消息队列_msg_queue
Debug
keil_MDK
SFUD
msh
ulog
C++_cpp
MicroPython
本月问答贡献
lchnu
3
个答案
2
次被采纳
张世争
1
个答案
2
次被采纳
a1012112796
9
个答案
1
次被采纳
三世执戟
8
个答案
1
次被采纳
聚散无由
5
个答案
1
次被采纳
本月文章贡献
jinchanchan
9
篇文章
13
次点赞
ssdd45555
3
篇文章
2
次点赞
聚散无由
1
篇文章
4
次点赞
rvcore
1
篇文章
1
次点赞
lvdongchina
1
篇文章
1
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部