Skip to content

"Too many open files" When test native image. #31713

@ma-sharifi

Description

@ma-sharifi

Describe the bug

I faced this error when I ran my native image test suit.

java.io.UncheckedIOException: Unable to read artifact metadata file created that must be created by Quarkus in order to run integration tests.

Caused by: java.io.FileNotFoundException: /Users/services/target/quarkus-artifact.properties (Too many open files)

My Command for running the test:

mvn test-compile failsafe:integration-test

I even added the following command before I ran my test.

ulimit -n 50000  
ulimit -n

I ran my database with TestContainer:

 <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>postgresql</artifactId>
            <scope>test</scope>
 </dependency>
  public static PostgreSQLContainer<?> postgres_container =
      new PostgreSQLContainer<>("postgres:14-alpine")
      .withDatabaseName("test")
      .withUsername("test")
      .withPassword("test")
      .withReuse(true)
      .withNetwork(network)
      .withNetworkAliases("database")
      .withLogConsumer(new Slf4jLogConsumer(log).withPrefix("Test-Containers-PostgreSQL"));
  @Override
  public void stop() {}

Expected behavior

I expected not to face this error because I did not open any files or sockets in my application.

Actual behavior

After running 130 IT tests method, I faced that error.

How to Reproduce?

In my project when I have more than 130 tests method, I faced this error.

Output of uname -a or ver

Darwin rt191bb131-145-174.routit.net 21.6.0 Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:28 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T8110 arm64

Output of java -version

openjdk version "17.0.6" 2023-01-17
OpenJDK Runtime Environment GraalVM CE 22.3.1 (build 17.0.6+10-jvmci-22.3-b13)
OpenJDK 64-Bit Server VM GraalVM CE 22.3.1 (build 17.0.6+10-jvmci-22.3-b13, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.12.1.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /opt/homebrew/Cellar/maven/3.8.6/libexec
Java version: 19.0.1, vendor: Homebrew, runtime: /opt/homebrew/Cellar/openjdk/19.0.1/libexec/openjdk.jdk/Contents/Home
Default locale: en_NL, platform encoding: UTF-8
OS name: "mac os x", version: "12.5", arch: "aarch64", family: "mac"

Additional information

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions