18 Star 18 Fork 34

openEuler / dpu-utilities

 / 详情

mkfifo并发使用host读client写出现卡住情况

已验收
缺陷
创建于  
2023-12-06 18:18

【问题复现步骤】,请描述具体的操作步骤
1.read.c和write.c文件如下:
[root@openEuler ~]# cat read.c
/*

  • Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved.
  • Author: zhuyiyangzhuyiyang@huawei.com
  • Create: 2023-6-5
    */
    #include <fcntl.h>
    #include <unistd.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <sys/types.h>
    #include <sys/stat.h>

#define SLEEP_TIME 5
#define ARG_COUNT 2
int main(int argc, char *argv[])
{
if (argc != ARG_COUNT) {
return -1;
}
char *fifoName = argv[1];
int fifoFd = open(fifoName, O_RDONLY);
if (fifoFd < 0) {
printf("open fifo failed!\n");
return -1;
}
int i;
sleep(SLEEP_TIME);
while (read(fifoFd, &i, sizeof(int)) == sizeof(int)) {
printf("%d", i);
}
close(fifoFd);
return 0;
}

[root@openEuler ~]# cat write.c
/*

  • Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved.
  • Author: zhuyiyangzhuyiyang@huawei.com
  • Create: 2023-6-6
    */
    #include <stdlib.h>
    #include <stdio.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <fcntl.h>
    #include <unistd.h>

#define ARG_2 2
#define ARG_3 3
int main(int argc, char *argv[])
{
int forLoops = 10;
if (argc < ARG_2 || argc > ARG_3) {
return -1;
}
if (argc == ARG_3) {
forLoops = argv[ARG_2];
}
char *fifoName = argv[1];
int fifoFd = open(fifoName, O_WRONLY);
printf("open fifo succeed!\n");
if (fifoFd < 0) {
printf("open fifo failed!\n");
return -1;
}
int i = 1;
for (; i < forLoops; i++) {
write(fifoFd, &i, sizeof(int));
}
printf("write succeed: %d\n", i);
close(fifoFd);
return 0;
}

编译host侧gcc -o read read.c
编译client侧gcc -o write write.c

3.host侧执行
mkfifo dpu_server/fifo
./read dpu_server/fifo

4.client侧执行
for i in {1..10}; do ./write dpu_client/fifo;done
for i in {1..100}; do ./write dpu_client/fifo;done

*【实际结果】**,请描述出问题的结果和影响
1.client侧卡住
输入图片说明

2.dmesg信息如下:
输入图片说明
输入图片说明
输入图片说明
输入图片说明

评论 (3)

我是白菜 创建了缺陷

Hi liwencheng6769, welcome to the openEuler Community.
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here.
If you have any questions, please contact the SIG: sig-DPU, and any of the maintainers: @lch_lichunhui , @lic121 , @minknov , @陈孚 , @liuhaic , @angus , @邹明 , @louhongxiang , @歲月 , @luochenglcs , @ryuxin , @SuperHugePan

openeuler-ci-bot 添加了
 
sig/sig-DPU
标签
我是白菜 修改了描述
minknov 添加协作者minknov

已确认是测试用例问题

并发情况下client使用完进程kill掉已处理

我是白菜 任务状态待办的 修改为已验收

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(4)
5329419 openeuler ci bot 1632792936
1
https://gitee.com/openeuler/dpu-utilities.git
git@gitee.com:openeuler/dpu-utilities.git
openeuler
dpu-utilities
dpu-utilities

搜索帮助

53164aa7 5694891 3bd8fe86 5694891