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] [worker] Worker's automatic user creation on linux is not fully correct #15669

Closed
3 tasks done
zero-element opened this issue Mar 4, 2024 · 4 comments · Fixed by #15670
Closed
3 tasks done

[Bug] [worker] Worker's automatic user creation on linux is not fully correct #15669

zero-element opened this issue Mar 4, 2024 · 4 comments · Fixed by #15670
Assignees
Labels
bug Something isn't working

Comments

@zero-element
Copy link
Contributor

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.363 +0800 o.a.d.s.w.r.WorkerTaskExecutor:[209] - Send task status RUNNING_EXECUTION master: 172.20.0.4:1234
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.363 +0800 o.a.d.s.w.r.WorkerTaskExecutor:[217] - TenantCode: default check successfully
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.364 +0800 o.a.d.s.w.r.WorkerTaskExecutor:[220] - WorkflowInstanceExecDir: /tmp/dolphinscheduler/exec/process/default/12796470742656/12807950360608_3/5/5 check successfully
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.364 +0800 o.a.d.s.w.r.WorkerTaskExecutor:[227] - Create TaskChannel: org.apache.dolphinscheduler.plugin.task.python.PythonTaskChannel successfully
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.364 +0800 o.a.d.s.w.r.WorkerTaskExecutor:[232] - Download resources successfully: 
ResourceContext(resourceItemMap={})
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.364 +0800 o.a.d.s.w.r.WorkerTaskExecutor:[235] - Download upstream files: [] successfully
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.364 +0800 o.a.d.s.w.r.WorkerTaskExecutor:[239] - Task plugin instance: PYTHON create successfully
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.364 +0800 o.a.d.p.t.p.PythonTask:[75] - Initialize python task params {
  "localParams" : [ ],
  "varPool" : [ ],
  "rawScript" : "print(\"test\")",
  "resourceList" : [ ]
}
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.364 +0800 o.a.d.s.w.r.WorkerTaskExecutor:[243] - Success initialized task plugin instance successfully
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.364 +0800 o.a.d.s.w.r.WorkerTaskExecutor:[246] - Set taskVarPool: null successfully
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.364 +0800 o.a.d.p.t.a.l.TaskInstanceLogHeader:[1259] - ***********************************************************************************************
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.365 +0800 o.a.d.p.t.a.l.TaskInstanceLogHeader:[1259] - *********************************  Execute task instance  *************************************
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.365 +0800 o.a.d.p.t.a.l.TaskInstanceLogHeader:[1259] - ***********************************************************************************************
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.365 +0800 o.a.d.p.t.p.PythonTask:[165] - raw python script : print("test")
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.365 +0800 o.a.d.p.t.p.PythonTask:[131] - tenantCode :default, task dir:/tmp/dolphinscheduler/exec/process/default/12796470742656/12807950360608_3/5/5
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.365 +0800 o.a.d.p.t.p.PythonTask:[134] - generate python script file:/tmp/dolphinscheduler/exec/process/default/12796470742656/12807950360608_3/5/5/py_5_5.py
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.365 +0800 o.a.d.p.t.p.PythonTask:[141] - #-*- encoding=utf8 -*-

print("test")
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.365 +0800 o.a.d.p.t.a.s.BaseLinuxShellInterceptorBuilder:[64] - Final Shell file is: 
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.366 +0800 o.a.d.p.t.a.s.BaseLinuxShellInterceptorBuilder:[65] - ****************************** Script Content *****************************************************************
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.366 +0800 o.a.d.p.t.a.s.BaseLinuxShellInterceptorBuilder:[67] - #!/bin/bash
BASEDIR=$(cd `dirname $0`; pwd)
cd $BASEDIR
${PYTHON_LAUNCHER} /tmp/dolphinscheduler/exec/process/default/12796470742656/12807950360608_3/5/5/py_5_5.py
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.366 +0800 o.a.d.p.t.a.s.BaseLinuxShellInterceptorBuilder:[68] - ****************************** Script Content *****************************************************************
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.366 +0800 o.a.d.p.t.a.s.BaseShellInterceptor:[46] - Executing shell command : sudo -u default -i /tmp/dolphinscheduler/exec/process/default/12796470742656/12807950360608_3/5/5/5_5.sh
[WI-5][TI-5] - [INFO] 2024-03-04 21:47:37.368 +0800 o.a.d.p.t.a.AbstractCommandExecutor:[154] - process start, process id is: 14597
[WI-0][TI-5] - [INFO] 2024-03-04 21:47:37.702 +0800 o.a.d.s.w.r.l.TaskInstanceExecutionRunningEventAckListenFunction:[44] - Receive TaskInstanceExecutionRunningEventAck: TaskInstanceExecutionRunningEventAck(taskInstanceId=5, success=true)
[WI-0][TI-5] - [INFO] 2024-03-04 21:47:37.706 +0800 o.a.d.s.w.r.l.TaskInstanceExecutionInfoEventAckListenFunction:[45] - Receive TaskInstanceExecutionInfoEventAck: TaskInstanceExecutionInfoEventAck(success=true, taskInstanceId=5)
[WI-0][TI-0] - [INFO] 2024-03-04 21:47:38.368 +0800 o.a.d.p.t.a.AbstractTask:[169] -  -> 
	sudo: unable to change directory to /home/default: No such file or directory
	/tmp/dolphinscheduler/exec/process/default/12796470742656/12807950360608_3/5/5/5_5.sh: line 4: /tmp/dolphinscheduler/exec/process/default/12796470742656/12807950360608_3/5/5/py_5_5.py: Permission denied

default check successfully but unable to change directory to /home/default, though it seems this error doesn't affect the task's execution (if so, why is sudo present here?)
actually it's the same issue with #844, the root cause appears to be OSUtils.java#L232 using 'useradd' without '-m' flag so default user created by the worker has no home dir.
By the way, the "permission denied" issue caused by #15085 should also be fixed reasonably. It's frustrating and confusing not being able to run 'hello world' out of the box. Perhaps we should improve the Docker image for the worker? Providing optional runtime via .env or some other form could be a solution.

What you expected to happen

no error msg unable to change directory to /home/default

How to reproduce

just install ds in docker compose following the tutorial and create a hello world python task

Anything else

No response

Version

3.2.x

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@zero-element zero-element added bug Something isn't working Waiting for reply Waiting for reply labels Mar 4, 2024
@SbloodyS SbloodyS removed the Waiting for reply Waiting for reply label Mar 5, 2024
@SbloodyS
Copy link
Member

SbloodyS commented Mar 5, 2024

Hi, Would you like to fix it? @zero-element

@zero-element
Copy link
Contributor Author

Hi, Would you like to fix it? @zero-element

yes, i'm submitting a pr

@Smilewh888
Copy link

你好我也是在docker环境这个问题,但这个3.2.2版本不知道什么时候发布? 我现在能在本地解决嘛,好像大概理解你的意思。
image

然后我进入worker容器创建这个 /home/default 后报错
image

我使用的admin账号,默认租户是default
我是不是应该进入到容器 执行 你提交的代码,我不太清楚
sudo useradd -m -g default default ?

@Anubisxcw
Copy link

你好我也是在docker环境这个问题,但这个3.2.2版本不知道什么时候发布? 我现在能在本地解决嘛,好像大概理解你的意思。 image

然后我进入worker容器创建这个 /home/default 后报错 image

我使用的admin账号,默认租户是default 我是不是应该进入到容器 执行 你提交的代码,我不太清楚 sudo useradd -m -g default default ?

ds在3.1.X的文档里提过一嘴,如果ds中的租户在系统里没有对应的账户他会自己创建,但是该功能从3.1.7开始就不好用,所以只能你手工修复,添加该linux用户即可,同时创建对应用户,还有,不建议容器环境使用ds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants