[ 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:29 AM: ---------------------------------------------------------- Taking a guess, u may be executing test as root user, hence the indefinite run.? Here is a test code: bq. public class TestNonWritable { bq. public static void main(String[] args) throws IOException { bq. File file = new File(System.getProperty("java.io.tmpdir")); bq. File tempFolder = new File(file, args[0]); bq. System.out.println("Temp Dir " + tempFolder.getCanonicalPath()); bq. System.out.println("Folder creation " + tempFolder.mkdir()); bq. System.out.println("Permission change " + tempFolder.setWritable(false, false)); bq. File tempFolderFile = new File(tempFolder, args[1]); bq. System.out.println("File Creation " + tempFolderFile.createNewFile()); bq. } bq. } When run as root user: {quote} java -cp . TestNonWritable abc2 xyz2 Temp Dir /tmp/abc2 Folder creation true Permission change true File Creation true {quote} When run as non-root user: {quote}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) {quote} was (Author: ajithshetty): Taking a guess, u may be executing test as root user, hence the indefinite run.? Here is a test code: {quote} 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()); } } {quote} When run as root user: {quote} java -cp . TestNonWritable abc2 xyz2 Temp Dir /tmp/abc2 Folder creation true Permission change true File Creation true {quote} When run as non-root user: {quote}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) {quote} > 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)