Skip to content

java.security.egd=file:/dev/./urandom causes slow test #30501

@slyfer

Description

@slyfer

Maven properties argLine causes slow test startup on Windows:

<argLine>-Djava.security.egd=file:/dev/./urandom -Xmx1G</argLine>

This is due the -Djava.security.egd=file:/dev/./urandom as described here -> https://www.baeldung.com/java-security-egd#testing-the-effect-of-javasecurityegd

This affects tests that use directly SecureRandom or Mockito API or MockitoExtensions

JHipster info
urandom@0.0.0 C:\Users\Test\projects\jhipster-test
`-- generator-jhipster@8.11.0
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "jwt",
    "baseName": "urandom",
    "buildTool": "maven",
    "cacheProvider": "no",
    "clientFramework": "no",
    "clientTestFrameworks": null,
    "clientTheme": null,
    "creationTimestamp": 1756125357863,
    "databaseType": "sql",
    "devDatabaseType": "postgresql",
    "enableHibernateCache": null,
    "enableTranslation": true,
    "entities": [],
    "feignClient": null,
    "jhipsterVersion": "8.11.0",
    "languages": [
      "it",
      "en"
    ],
    "microfrontend": null,
    "microfrontends": [],
    "nativeLanguage": "it",
    "packageName": "com.mycompany.myapp",
    "prodDatabaseType": "postgresql",
    "reactive": false,
    "serverPort": null,
    "serviceDiscoveryType": null,
    "skipClient": true,
    "syncUserWithIdp": null,
    "testFrameworks": [],
    "withAdminUi": null
  }
}
Environment and Tools

openjdk version "21.0.5" 2024-10-15 LTS
OpenJDK Runtime Environment Temurin-21.0.5+11 (build 21.0.5+11-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.5+11 (build 21.0.5+11-LTS, mixed mode, sharing)

git version 2.47.1.windows.1

node: v23.6.0
npm: 10.9.2

Docker version 27.4.1, build b9d17ea

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions

Motivation for or Use Case

This is an issue because every time you launch a test from IDE (that onors argLine) o command line it take up to 8 seconds to start on my pc, and is very annoying

Reproduce the error
  1. Create a new monolitic maven application
  2. Run an affected test like: ./mvnw -Dtest=WebConfigurerTest test
Suggest a Fix

Using as argline <argLine>-Djava.security.egd=file:/dev/urandom -Xmx1G</argLine> the problem disappears

JHipster Version(s)

8.11.0

Browsers and Operating System

Not a browser related problem

OS Windows 11

  • Checking this box is mandatory (this is just to show you read everything)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions