Uploaded image for project: 'Talend Component Kit'
  1. Talend Component Kit
  2. TCOMP-633

S3 writer uses shared temporary resource

Apply templateInsert Lucidchart Diagram
    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 0.21.0, 0.20.1
    • None
    • None
    • None
    • All
    • Small

    Description

      Description

      In file https://github.com/Talend/components/blob/master/components/components-fileio/s3-runtime-di/src/main/java/org/talend/components/s3/runtime/S3OutputWriter.java, the temporary file name is a constant ("data.csv"):

              // prepare the local target, will upload it to s3 and clear it in the close method
              String tmpDir = System.getProperty("java.io.tmpdir");
              data_file = new File(tmpDir, "data.csv");
      
              data_file.deleteOnExit();
      
              OutputStream outputStream = new FileOutputStream(data_file);
              writer = new CsvWriter(new OutputStreamWriter(outputStream), ';');
      

      This is fine (although arguable) when running in a job but when component is executed inside a TCOMP server, it leads to potential concurrent issues: one request may delete the temporary file of an other ("data_file" is deleted in close() method).

      Proposal

      Use java.io.File#createTempFile(java.lang.String, java.lang.String) iso. constant file name.

      Attachments

        Activity

          People

            igonchar Ivan Gonchar
            fhuaulme francois huaulme
            Ivan Gonchar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: