You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Ajith S (JIRA)" <ji...@apache.org> on 2019/04/12 11:27:00 UTC
[jira] [Comment Edited] (FLINK-5970) Job-/TaskManagerStartupTest
may run indefinitely
[ https://issues.apache.org/jira/browse/FLINK-5970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16816185#comment-16816185 ]
Ajith S edited comment on FLINK-5970 at 4/12/19 11:26 AM:
----------------------------------------------------------
Taking a guess, u may be executing test as root user, hence the indefinite run.?
Here is a test code:
```
public class TestNonWritable {
public static void main(String[] args) throws IOException {
File file = new File(System.getProperty("java.io.tmpdir"));
File tempFolder = new File(file, args[0]);
System.out.println("Temp Dir " + tempFolder.getCanonicalPath());
System.out.println("Folder creation " + tempFolder.mkdir());
System.out.println("Permission change " + tempFolder.setWritable(false, false));
File tempFolderFile = new File(tempFolder, args[1]);
System.out.println("File Creation " + tempFolderFile.createNewFile());
}
}
```
When run as root user:
```
java -cp . TestNonWritable abc2 xyz2
Temp Dir /tmp/abc2
Folder creation true
Permission change true
File Creation true
```
When run as non-root user:
{{java -cp . TestNonWritable abc1 xyz1}}
Temp Dir /tmp/abc1
Folder creation true
Permission change true
Exception in thread "main" java.io.IOException: Permission denied
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:1012)
at TestNonWritable.main(TestNonWritable.java:12)
was (Author: ajithshetty):
Taking a guess, u may be executing test as root user, hence the indefinite run.?
Here is a test code:
```
public class TestNonWritable {
public static void main(String[] args) throws IOException {
File file = new File(System.getProperty("java.io.tmpdir"));
File tempFolder = new File(file, args[0]);
System.out.println("Temp Dir " + tempFolder.getCanonicalPath());
System.out.println("Folder creation " + tempFolder.mkdir());
System.out.println("Permission change " + tempFolder.setWritable(false, false));
File tempFolderFile = new File(tempFolder, args[1]);
System.out.println("File Creation " + tempFolderFile.createNewFile());
}
}
```
When run as root user:
```
java -cp . TestNonWritable abc2 xyz2
Temp Dir /tmp/abc2
Folder creation true
Permission change true
File Creation true
```
When run as non-root user:
{{java -cp . TestNonWritable abc1 xyz1
Temp Dir /tmp/abc1
Folder creation true
Permission change true
Exception in thread "main" java.io.IOException: Permission denied
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:1012)
at TestNonWritable.main(TestNonWritable.java:12)}}
> Job-/TaskManagerStartupTest may run indefinitely
> ------------------------------------------------
>
> Key: FLINK-5970
> URL: https://issues.apache.org/jira/browse/FLINK-5970
> Project: Flink
> Issue Type: Bug
> Components: Runtime / Coordination, Tests
> Affects Versions: 1.3.0, 1.4.0
> Reporter: Chesnay Schepler
> Priority: Major
>
> The Job- and TaskManagerStartupTest both contain a test that verifies that the JM/TM fails when giving a non-writable directory.
> In case of the TM this directory is used for temporary files, see testIODirectoryNotWritable.
> In case of the JM this directory is given to the blobService, see testJobManagerStartupFails.
> To that end it is necessary to create a non-writable directory. To verify that this is at all possible we first rule out the Windows OS (for which File#setWritable has no effect), and check the return value of File#setWritable, which according to the documentation returns true if the file was in fact marked as non-writable.
> When playing around with the BuddyWorks CI i noticed that these tests did neither fail nor succeed; we are able to create a non-writable directory (which i verified by checking the actual permissions), but the JM/TM still start up fine. As a result the tests just run indefinitely since this case wasn't considered.
> I'm still investigating why they don't fail; my current assumption is that in this case files simply don't inherit the permissions of the parent directory.
> This means that the checks that the tests make aren't adequate. Instead of verifying the permissions on the directory I propose verifying the actual failure condition: That we can't create new files in this directory.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)