Skip to content
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

[BUG REPORT] 调度系统问题 #1062

Open
xiaolin2004 opened this issue Nov 27, 2024 · 1 comment
Open

[BUG REPORT] 调度系统问题 #1062

xiaolin2004 opened this issue Nov 27, 2024 · 1 comment
Assignees
Labels
A-process Area: process management A-sched Area: 调度子系统 bug Something isn't working bug-report 这是一个bug报告(如果确认是一个bug,请管理人员添加`bug` label)

Comments

@xiaolin2004
Copy link
Collaborator

xiaolin2004 commented Nov 27, 2024

描述错误
调度系统行为强烈不稳定,且反直觉

测试代码

pid_t reader_pid;

  // Case 2: Reader exists but disconnects
  reader_pid = fork();
  if (reader_pid == 0) {
    // Child process acts as a reader
    int reader_fd = open(FIFO_PATH, O_RDONLY);
    if (reader_fd == -1) {
      perror("Reader failed to open FIFO");
      exit(EXIT_FAILURE);
    }
    sleep(2); // Simulate a brief existence of the reader
    close(reader_fd);
    exit(EXIT_SUCCESS);
  }

  sleep(5); // Ensure the reader has opened the FIFO
  FifoWriteResult result = test_fifo_write(1, nonblocking);
  waitpid(reader_pid, NULL, 0); // Wait for the reader process to exit

期望行为
测试代码期望子进程可以在父进程醒来之前醒来关闭管道读端。

实际行为
运行测试会得到以下结果:

两者同时醒来(可以通过连续捶打回车键稳定复现)
子进程在父进程醒来之后醒来
期望情况

其他上下文
https://bbs.dragonos.org.cn/t/topic/418?u=xiaolin2004
#1061 (comment)

@xiaolin2004 xiaolin2004 added the bug-report 这是一个bug报告(如果确认是一个bug,请管理人员添加`bug` label) label Nov 27, 2024
@dragonosbot dragonosbot added the needs-triage 这个问题可能需要分类处理。如果已经完成分类,请移除它。 label Nov 27, 2024
@xiaolin2004 xiaolin2004 added bug Something isn't working A-sched Area: 调度子系统 A-process Area: process management and removed needs-triage 这个问题可能需要分类处理。如果已经完成分类,请移除它。 labels Nov 27, 2024
@fslongjin
Copy link
Member

网络重构分支,运行http server,后台watch -n 1 curl http://localhost:12580/

然后200ms采样一次,累计采样20秒。几乎全在idle.

img_v3_02h2_96106075-09f7-4e6b-b329-442a0717b69g

但是如果我手动1-2秒按一下回车,就会变这样:
img_v3_02h2_8ff5a5ab-3584-4a9f-974c-3044ec8c055g

并且按回车的时候,http_server的请求立刻就会返回结果。我认为这是同一个问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-process Area: process management A-sched Area: 调度子系统 bug Something isn't working bug-report 这是一个bug报告(如果确认是一个bug,请管理人员添加`bug` label)
Projects
None yet
Development

No branches or pull requests

4 participants