1

I am having a lot of issues regarding my Spring Boot application that is starting as normal, but when I access a page that is secured by Spring security, it takes a lot of time to load the page.

If I click on the /userpage icon, then the login screen should appear if not logged in. Well, in this case the display of login screen takes up to 5 minutes. Same thing for the /process_login (the link created to produce the login).

Things that I did from the internet:

  1. I did placed logging.level.org.springframework.boot.autoconfigure=DEBUG in the application.properties, nothing relevant in the logs

  2. I start the application on a 1CPU, 1GB RAM virtual machine on OceanDigital. There were no issues of this type on my Idea editor on my PC. The db is a MongoCluster from MongoAtlas.

  3. I think it is related to the application start-up options. I start the application like this: ./mvnw spring-boot:run & or man spring-boot:run & (I add & to make it work in the background.)

  4. ByCrpyt len is 4.

After the login is performed, then any other request, including a new login is done with easy, in a matter of ms.

Any suggestions?

UPDATE

When I connect with the Idea Editor to the remote server and run on it, this issue does not appear. So I still think it is a matter of start-up command or configuration.

UPDATE 2

I got this Warn: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [607,720] milliseconds.

  • Could it be using a source for random that is low on entropy have a look at https://stackoverflow.com/questions/137212/how-to-deal-with-a-slow-securerandom-generator – Paul Whelan Jul 08 '21 at 17:39
  • 1
    Thank you, this thing fixed my mistake. – TasteMyBomb Jul 09 '21 at 12:28
  • Happy to help I'll add this as an answer I am not sure if this is considered a duplicate or not, I'll leave that to others to decide. – Paul Whelan Jul 09 '21 at 14:53

1 Answers1

1

This sounds a lot like an issue with your random number generator and the required levels or entropy to create the random number, have a look at this answer How to deal with a slow SecureRandom generator?.

You will see advice that will help to decide how you want your secure randoms to be generated. What you decide to use will depend completely on your requirements, but be aware of the potential slowness of using /dev/random.

Paul Whelan
  • 16,574
  • 12
  • 50
  • 83