Search code examples
gitbitbucketjgitspring-cloud-config

spring cloud config clone-on-start http.postBuffer issue


I get the issue Integer value http.postbuffer out of range while starting the spring cloud config server with bitbucket url.

application.yml

server:
    port: 8888

spring:
    application:
        name: CONFIGSERVER
    cloud:
     config:
        label: master
        server:
          git:
            clone-on-start: true
            uri: https://bitbucket.org/MyGitRepo/config_server_env_profiles.git
            username: <username>
            password: <password>

Stack trace

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultEnvironmentRepository' defined in class path
 resource [org/springframework/cloud/config/server/config/DefaultRepositoryConfiguration.class]: Invocation of init method failed; nested exception is
 java.lang.IllegalArgumentException: Integer value http.postbuffer out of range
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1325)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1291)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1193)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1096)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPost
Processor.java:659)
        ... 96 more
Caused by: java.lang.IllegalArgumentException: Integer value http.postbuffer out of range
        at org.eclipse.jgit.lib.Config.getInt(Config.java:230)
        at org.eclipse.jgit.lib.Config.getInt(Config.java:209)
        at org.eclipse.jgit.transport.TransportHttp$HttpConfig.<init>(TransportHttp.java:247)
        at org.eclipse.jgit.transport.TransportHttp$3.parse(TransportHttp.java:237)
        at org.eclipse.jgit.transport.TransportHttp$3.parse(TransportHttp.java:234)
        at org.eclipse.jgit.lib.Config.get(Config.java:703)
        at org.eclipse.jgit.transport.TransportHttp.<init>(TransportHttp.java:282)
        at org.eclipse.jgit.transport.TransportHttp$1.open(TransportHttp.java:190)
        at org.eclipse.jgit.transport.Transport.open(Transport.java:566)
        at org.eclipse.jgit.transport.Transport.open(Transport.java:443)
        at org.eclipse.jgit.transport.Transport.open(Transport.java:324)
        at org.eclipse.jgit.transport.Transport.open(Transport.java:293)
        at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:225)
        at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:293)
        at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:190)
        at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.cloneToBasedir(JGitEnvironmentRepository.java:433)
        at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.initClonedRepository(JGitEnvironmentRepository.java:249)
        at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.afterPropertiesSet(JGitEnvironmentRepository.java:182)
        at org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentRepository.afterPropertiesSet(MultipleJGitEnvironmentRepository.
java:68)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1761
)

What could be the issue and resolution?


Solution

  • Well apparently, behind the scene the org.eclipse.jgit library while cloning uses the system configured properties, one of those property is http.postBuffer .

    It tries to convert the value to Integer and if the value is too large (or small) then it fails with above out of range error.

    I verified the property by $ git config --get http.postBuffer and it returned the value 4572864000

    I verified in .gitconfig file and it was global value, so I decreased the value to 524288000

    and then it worked like charm. Hope that helps someone facing the same issue.