1

I am getting "No more data to read from socket" error from the sql-maven-plugin while it is trying to connect and run the execution.

The problem is that I get this error only on the Jenkins slave running RedHat 7.7 but on my Macbook Pro it works fine.

It is not a credentials issue because I tried to use a wrong password and the build failed immediately but when the credentials are correct it just gets stuck for some time and then it fails with the "No more data to read from socket" error.

1 Answers1

1

Disclaimer: I'm working with @emanuel502

Adding this flag solves the issue: -Djava.security.egd=file:/dev/urandom

  • we need entropy for security stuff (authentication, TLS)
  • by default, the jvm uses /dev/random as source of entropy (=basically, randomness)
  • but this one is blocking if there is "not enough entropy", while /dev/urandom isn't
  • on very old systems (linux kernel <3.16 while the current one is 5.6), /dev/random simply doesn't have enough entropy to be useful (there are tools to make it better, that sysadmins can install)
  • because our jenkins slaves are on RedHat 7.7, and RedHat only provides minor/security updates in a major version, and RedHat 7 is from 2014 (and they probably were already using an old kernel by then), we're on kernel 3.10, which practically means a simple cat /dev/random blocks after a few bytes
  • sometimes, you happen to have enough entropy at the moment you try, and you can't see any problem, so it's difficult to debug; in our case, the message was "Not enough data to read from socket" (that's all). I remember a case years ago where TLS connections where very slow / blocked for the same reason.

My personal conclusion: never believe that "it's old, so it's stable" thing. On a newer system (kernel 3.16 is from 30 June 2013) you wouldn't even have known that problem. Using RedHat (and not even upgrading since RedHat 8 came out last year) made an issue out of a problem that was solved 7+ years ago. We lost days on that

And I didn't really learn: I already had that problem 4 years ago, but thought I would never see such a system again in my life and I could just forget about it.

Sources:

ymajoros
  • 2,454
  • 3
  • 34
  • 60