apache / dolphinscheduler

Apache DolphinScheduler is the modern data orchestration platform. Agile to create high performance workflow with low-code
https://dolphinscheduler.apache.org/
Apache License 2.0
12.39k stars 4.49k forks source link

[Bug] [dolphinscheduler-task-java] Cannot Compile java task due to the exec folder owner permission issue #16210

Open lanxing2 opened 4 days ago

lanxing2 commented 4 days ago

Search before asking

What happened

I deploy dolphinscheduler in distributed model follow the official website guide The user I use to deploy is dolphinscheduler And the tenant I choose to run the java task is default, so the command to run the shell script is start with "sudo -u default -i " When I try to run the task, it shows no permission error, because the exec folder owner is dolphinscheduler with 755 permission The shell script need run javac to create the Java class, but user default do not have permission to create file in the exec folder If I want to run the Java Code task, I need to create a tenant dolphinscheduler and use this tenant to run the script. 1719305345238

What you expected to happen

The owner of the folder for the shell script is the same as the tenant I choose to run the process, so any tenant can run the java tasks

How to reproduce

  1. Deploy the dolphinscheduler in distributed model and run servers with user dolphinscheduler
  2. Create a Java Task in Java Model
  3. Run the task with default tenant(or any other tenant else than dolphinscheduler)

Anything else

This problem happens every time when I try to run Java Model Java Task with tenants else than the tenant which running the server

Version

3.2.x

Are you willing to submit PR?

Code of Conduct

lanxing2 commented 2 days ago

Traceback the code https://github.com/apache/dolphinscheduler/blob/dev/dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/WorkerTaskExecutor.java#L216 WorkerTaskExecutor.beforeExecute

https://github.com/apache/dolphinscheduler/blob/dev/dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/utils/TaskExecutionContextUtils.java#L58 TaskExecutionContextUtils.createTaskInstanceWorkingDirectory

https://github.com/apache/dolphinscheduler/blob/dev/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/FileUtils.java#L266 FileUtils.createDirectoryWith755

Need update Directory owner(I am not sure if is possible to change the owner to other tenant when the server is deployed by dolphinscheduler, not root)