Moying-moe opened a new issue, #9890:
URL: https://github.com/apache/seatunnel/issues/9890

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22)
 and found no similar issues.
   
   
   ### What happened
   
   When I start a SeaTunnel job using `start-seatunnel-spark-3-connector-v2.sh` 
**in cluster mode**, SPARK **FAILED** at the driver stage. The error message 
indicates that reading the configuration file failed because the file does not 
exist.
   
   However, if I start the job in **client mode**, it runs correctly.
   
   ### Additional Investigation
   
   I have reviewed the source code of the SeaTunnel starter and noticed the 
following:
   
   * When starting a job in **cluster mode**, the starter adds the `--files` 
option in `spark-submit` to distribute the configuration file.
   * Since the configuration file is loaded **before** the `SparkSession` is 
created, the code directly tries to read it by file name (assuming it exists in 
the **current working directory**), instead of resolving it through 
`SparkFiles`.
   * At runtime, I found that the working directory of these code was 
`$SPARK_HOME/work/driver-xxxxx-xxx/`, while Spark distributed the file from 
`--files` into`/tmp/spark-xxxxx/`
   
   This mismatch might be the root cause of the problem? I guess?
   
   How can I resolve this issue? Thank you!
   
   ### SeaTunnel Version
   
   2.3.12
   
   
   ### SeaTunnel Config
   
   ```conf
   env {
     parallelism = 1
     job.mode = "BATCH"
   }
   
   source {
     FakeSource {
       plugin_output = "fake"
       row.num = 16
       schema = {
         fields {
           name = "string"
           age = "int"
         }
       }
     }
   }
   
   transform {
     FieldMapper {
       plugin_input = "fake"
       plugin_output = "fake1"
       field_mapper = {
         age = age
         name = new_name
       }
     }
   }
   
   sink {
     Console {
       plugin_input = "fake1"
     }
   }
   ```
   
   ### Running Command
   
   ```shell
   $SEATUNNEL_HOME/bin/start-seatunnel-spark-3-connector-v2.sh --master 
spark://**.**.**.**:7077 --deploy-mode cluster --config 
"$SEATUNNEL_HOME/config/v2.batch.config"
   ```
   
   ### Error Exception
   
   ```log
   25/09/23 11:26:13 INFO SecurityManager: Changing view acls to: dwisparkx
   25/09/23 11:26:13 INFO SecurityManager: Changing modify acls to: dwisparkx
   25/09/23 11:26:13 INFO SecurityManager: Changing view acls groups to: 
   25/09/23 11:26:13 INFO SecurityManager: Changing modify acls groups to: 
   25/09/23 11:26:13 INFO SecurityManager: SecurityManager: authentication 
disabled; ui acls disabled; users  with view permissions: Set(dwisparkx); 
groups with view permissions: Set(); users  with modify permissions: 
Set(dwisparkx); groups with modify permissions: Set()
   25/09/23 11:26:13 INFO Utils: Successfully started service 'Driver' on port 
22106.
   25/09/23 11:26:13 INFO DriverWrapper: Driver address: **.**.**.**:22106
   25/09/23 11:26:13 INFO WorkerWatcher: Connecting to worker 
spark://Worker@**.**.**.**:7078
   25/09/23 11:26:13 INFO TransportClientFactory: Successfully created 
connection to /**.**.**.**:7078 after 59 ms (0 ms spent in bootstraps)
   25/09/23 11:26:13 INFO WorkerWatcher: Successfully connected to 
spark://Worker@**.**.**.**:7078
   25/09/23 11:26:14 ERROR SeaTunnel: 
   
   
===============================================================================
   
   
   25/09/23 11:26:14 ERROR SeaTunnel: Fatal Error, 
   
   25/09/23 11:26:14 ERROR SeaTunnel: Please submit bug report in 
https://github.com/apache/seatunnel/issues
   
   25/09/23 11:26:14 ERROR SeaTunnel: Reason:ErrorCode:[COMMON-22], 
ErrorDescription:[SeaTunnel read file 'v2.batch.config' failed, because it not 
existed.] 
   
   25/09/23 11:26:14 ERROR SeaTunnel: Exception 
StackTrace:org.apache.seatunnel.common.exception.SeaTunnelRuntimeException: 
ErrorCode:[COMMON-22], ErrorDescription:[SeaTunnel read file 'v2.batch.config' 
failed, because it not existed.]
        at 
org.apache.seatunnel.common.exception.CommonError.fileNotExistFailed(CommonError.java:89)
        at 
org.apache.seatunnel.core.starter.utils.FileUtils.checkConfigExist(FileUtils.java:66)
        at 
org.apache.seatunnel.core.starter.spark.command.SparkTaskExecuteCommand.execute(SparkTaskExecuteCommand.java:37)
        at org.apache.seatunnel.core.starter.SeaTunnel.run(SeaTunnel.java:40)
        at 
org.apache.seatunnel.core.starter.spark.SeaTunnelSpark.main(SeaTunnelSpark.java:35)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.apache.spark.deploy.worker.DriverWrapper$.main(DriverWrapper.scala:63)
        at 
org.apache.spark.deploy.worker.DriverWrapper.main(DriverWrapper.scala)
    
   25/09/23 11:26:14 ERROR SeaTunnel: 
   
===============================================================================
   
   
   
   25/09/23 11:26:14 INFO ShutdownHookManager: Shutdown hook called
   25/09/23 11:26:14 INFO ShutdownHookManager: Deleting directory 
/tmp/spark-efa59809-250b-4c92-a7f6-a550b4500ed6
   ```
   
   ### Zeta or Flink or Spark Version
   
   Spark 3.3.2
   Deployed in StandAlone mode
   
   ### Java or Scala Version
   
   openjdk version "1.8.0_462"
   
   ### Screenshots
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to