@@ -69,6 +69,7 @@ public class ConfigurationOverviewBuilder {
6969 private boolean isParallelTxProcessingEnabled = false ;
7070 private RocksDBCLIOptions .BlobDBSettings blobDBSettings ;
7171 private Long targetGasLimit ;
72+ private static final String MINIMUM_GLIBC_VERSION = "2.28" ;
7273
7374 /**
7475 * Create a new ConfigurationOverviewBuilder.
@@ -507,18 +508,17 @@ public String build() {
507508 lines .add ("Maximum heap size: " + normalizeSize (Runtime .getRuntime ().maxMemory ()));
508509 lines .add ("OS: " + PlatformDetector .getOS ());
509510
510- if (SystemInfo .getCurrentPlatform () == PlatformEnum .LINUX ) {
511- final String glibcVersion = PlatformDetector .getGlibc ();
512-
513-
514- checkGlibcVersion (glibcVersion );
515-
516- if (glibcVersion != null ) {
517- lines .add ("glibc: " + glibcVersion );
518- }
511+ if (SystemInfo .getCurrentPlatform () == PlatformEnum .LINUX ) {
512+ final String glibcVersion = PlatformDetector .getGlibc ();
519513
520- detectJemalloc (lines );
521- }
514+ checkGlibcVersion (glibcVersion );
515+
516+ if (glibcVersion != null ) {
517+ lines .add ("glibc: " + glibcVersion );
518+ }
519+
520+ detectJemalloc (lines );
521+ }
522522
523523 final HardwareAbstractionLayer hardwareInfo = new SystemInfo ().getHardware ();
524524
@@ -569,47 +569,51 @@ private void detectJemalloc(final List<String> lines) {
569569 });
570570 }
571571
572-
573572 /**
574573 * Checks if the glibc version meets the minimum required version.
575574 *
576575 * @param glibcVersion the detected glibc version
577576 */
578577 private void checkGlibcVersion (final String glibcVersion ) {
579578 if (glibcVersion == null ) {
580- // Cannot determine version, log warning but allow startup
581- logger .warn ("Unable to determine glibc version. Minimum required version is 2.28" );
579+ logger .warn (
580+ "Unable to determine glibc version. Minimum required version is {}" ,
581+ MINIMUM_GLIBC_VERSION );
582582 return ;
583583 }
584584
585- final String minVersion = "2.28" ;
586- if (!isGlibcVersionSufficient (glibcVersion , minVersion )) {
587- logger .error ("Insufficient glibc version detected." );
588- logger .error ("Required: {} or higher" , minVersion );
589- logger .error ("Found: {}" , glibcVersion );
590- logger .error ("Please upgrade your system's glibc to version {} or higher." , minVersion );
585+ if (!isGlibcVersionSufficient (glibcVersion , MINIMUM_GLIBC_VERSION )) {
586+ logger .error (
587+ "Insufficient glibc version detected. Required: {} or higher, Found: {}. Please upgrade your system's glibc." ,
588+ MINIMUM_GLIBC_VERSION ,
589+ glibcVersion );
591590 throw new RuntimeException (
592- "Besu requires glibc version " + minVersion + " or higher. Found: " + glibcVersion );
591+ "Besu requires glibc version "
592+ + MINIMUM_GLIBC_VERSION
593+ + " or higher. Found: "
594+ + glibcVersion );
593595 }
594596 }
595597
596598 /**
597-
598599 * Compares glibc version strings.
599600 *
600601 * @param current the current glibc version
601602 * @param required the required minimum version
602603 * @return true if current version is sufficient, false otherwise
603604 */
604-
605605 private boolean isGlibcVersionSufficient (final String current , final String required ) {
606606 try {
607607 final String [] currentParts = current .split ("\\ ." );
608608 final String [] requiredParts = required .split ("\\ ." );
609609
610- for (int i = 0 ; i < Math .min (currentParts .length , requiredParts .length ); i ++) {
611- final int currentNum = Integer .parseInt (currentParts [i ].trim ());
612- final int requiredNum = Integer .parseInt (requiredParts [i ].trim ());
610+ final int compareLength = Math .max (currentParts .length , requiredParts .length );
611+
612+ for (int i = 0 ; i < compareLength ; i ++) {
613+ final int currentNum =
614+ i < currentParts .length ? Integer .parseInt (currentParts [i ].trim ()) : 0 ;
615+ final int requiredNum =
616+ i < requiredParts .length ? Integer .parseInt (requiredParts [i ].trim ()) : 0 ;
613617
614618 if (currentNum > requiredNum ) {
615619 return true ;
@@ -618,15 +622,13 @@ private boolean isGlibcVersionSufficient(final String current, final String requ
618622 return false ;
619623 }
620624 }
621- return true ; // Versions are equal
625+ return true ;
622626 } catch (final NumberFormatException e ) {
623627 logger .warn ("Unable to parse glibc version: {}" , current , e );
624- return true ; // Assume sufficient if unable to parse
628+ return true ;
625629 }
626630 }
627631
628-
629-
630632 /**
631633 * Normalize gas string.<br>
632634 * The implemented logic is<br>
0 commit comments