Project-LemonLime / Project_LemonLime

为了 OI 比赛而生的基于 Lemon + LemonPlus 的轻量评测系统 | 三大桌面系统支持
GNU General Public License v3.0
565 stars 60 forks source link

[BUG] 0.3.4.3 版本在 Linux 下测评会报错「程序不能运行」 #216

Closed woshiluo closed 1 year ago

woshiluo commented 1 year ago

Describe the bug 描述一下这个 Bug

在 Linux 下,使用 0.3.4.3 版本的 LemonLime 测试任意程序均会给出「程序不能运行」,而使用 0.3.4.2 版本则一切正常。

To Reproduce 如何复现

任意新建一场比赛并新建一道传统题目,使用子文件夹,FILE IO,C++ 14 O2。

任意一份可以正常编译代码均会报错「程序不能运行」

Screenshots 有截图吗?

image

Environment: 环境:

Additional context 其他信息

如果有需要的话,这是 neofetch 的结果:

                   -`                    
                  .o+`                   ------------------------
                 `ooo/                   OS: Arch Linux x86_64
                `+oooo:                  Host: xxx
               `+oooooo:                 Kernel: 6.4.9-arch1-1
               -+oooooo+:                Uptime: 1 hour, 4 mins
             `/:-:++oooo+:               Packages: 1866 (pacman)
            `/++++/+++++++:              Shell: zsh 5.9
           `/++++++++++++++:             Resolution: 1920x1080
          `/+++ooooooooooooo/`           WM: sway
         ./ooosssso++osssssso+`          Theme: vimix-light-compact-doder [GTK2/3]
        .oossssso-````/ossssss+`         Icons: Papirus [GTK2/3]
       -osssssso.      :ssssssso.        CPU: AMD Ryzen 5 4500U with Radeon Graphics (6) @ 2.
      :osssssss/        osssso+++.       GPU: AMD ATI 04:00.0 Renoir
     /ossssssss/        +ssssooo/-       Memory: 16186MiB / 31460MiB
   `/ossssso+/:-        -:/+osssso+-
  `+sso+:-`                 `.-/+oso:
 `++:.                           `-/+/
 .`                                 `/

内核参数中有:

cgroup_enable=memory swapaccount=1
alphagocc commented 1 year ago

cc @Dust1404

tofucurd commented 1 year ago

macos 13.4 中使用0.3.4.2的代码手动加入static memory check一样是 程序不能运行

woshiluo commented 1 year ago

我确认在 commit e0878e25dde9c84e08fef2c71c949e6acd5c7857 是正常的,commit 6321d2e7d646709ca40e4c9a9a9469895f34b40a 就会出问题。

tofucurd commented 1 year ago

应该是新加的static memory check的问题

Dust1404 commented 1 year ago

这个尝试是错的,原来的代码没有问题。argv[0] 一定是文件名。


暂时没有测试环境,请尝试把 watcher_macos.mm 以及 watcher_linux.cpp 中的

if (execlp("bash", "bash", "-c", argv[1], NULL) == -1)

改为

if (execlp("bash", "-c", argv[1], NULL) == -1)
tofucurd commented 1 year ago

暂时没有测试环境,请尝试把 watcher_macos.mm 以及 watcher_linux.cpp 中的

if (execlp("bash", "bash", "-c", argv[1], NULL) == -1)

改为

if (execlp("bash", "-c", argv[1], NULL) == -1)

试了,不是这里的问题,应该是您static memory的那个部分

Dust1404 commented 1 year ago

我本地命令行调用 watcher 运行没有问题,等我再检查一下 Lemon 的调用逻辑。

woshiluo commented 1 year ago

使用 LemonLime 评测时,watcher 获取的 fd 就是 -1,然后 watcher 就终止了,但是手动运行 watcher_unix 获取的 fd 就是正常的,我有点不能理解。

Dust1404 commented 1 year ago

https://github.com/Project-LemonLime/Project_LemonLime/blob/26172e6063f1d8ebe7ca6697cd6f97d766f14ac7/src/core/judgingthread.cpp#L887

这里,为了解释性语言,比如

python a.py

所以传过去的 argv[1] 并不是文件名,而是命令行命令,需要根据第一对双引号进行 parse。

(有测试环境的可以提一下 PR,我暂时没测试环境)