Pivotal Knowledge Base

Follow

Push App Failed with "Runtime Error: Cannot compare a MemorySize to an instance of NilClass"

Environment

  • Pivotal Cloud Foundry® (PCF) all versions

Symptom

When attempting to push an application to PCF system, staging failed with the error "RuntimeError: Cannot compare a MemorySize to an instance of NilClass"

Error Message:

[user1@host:~/]$cf push
Using manifest file /Example/manifest.yml Updating app Example in org org1 / space space1 user1 as user1@example.com...
OK Creating route user70422.example.com...
OK Binding user70422.example.com to Example...
OK Uploading Example...
Uploading app files from: /var/folders/8p/g6frd1w11f34zvklb74m0tgm0000gp/T/unzipped-app329048937
Uploading 5.6K, 18 files
Done uploading
OK Starting app Example in org org1 / space space1 as user1@example.com...
Creating container
Successfully created container
Downloading app package...
Downloaded app package (4.4K)
/tmp/buildpackdownloads/38ac912092c32b9507ea7ac5fc033650/lib/java_buildpack/component/versioned_dependency_component.rb:68: warning: circular argument reference - jar_name
-----> Java Buildpack Version: 717d8bf | https://github.com/gratiartis/java-buildpack#717d8bf
-----> Downloading Open Jdk JRE 1.8.0_91-unlimited-crypto from https://java-buildpack.cloudfoundry.org/openjdk/trusty/x86_64/openjdk-1.8.0_91-unlimited-crypto.tar.gz (0.7s)
Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.0s)
/tmp/buildpackdownloads/38ac912092c32b9507ea7ac5fc033650/lib/java_buildpack/component/versioned_dependency_component.rb:68: warning: circular argument reference - jar_name
[Buildpack] ERROR Release failed with exception #<RuntimeError: Cannot compare a MemorySize to an instance of NilClass>
Cannot compare a MemorySize to an instance of NilClass
Failed to build droplet release: exit status 1
Exit status 224
Stopping instance 8ed4d69f-50a6-44aa-9cd4-22c06efe969c
Destroying container
Successfully destroyed container FAILED
Error restarting application: BuildpackReleaseFailed TIP: use 'cf logs Example --recent' for more information

Cause

This is an error from the buildpack which runs when your application is staged. If you are using one of Pivotal's supported buildpacks, you should not generally see errors like this.

In this case, it was found that the error was caused by a custom buildpack. There was an entry specified in the application's manifest to use the following buildpack:

buildpack: https://github.com/gratiartis/java-buildpack

This is an unsupported buildpack and the error is likely to be caused by a customization made in that buildpack's code. If you are experiencing an issue with a custom buildpack, please contact the buildpack's author as Pivotal Support does not cover custom buildpacks.

Resolution

After commenting out "buildpack:" line in the manifest and pushing same application again with the official Java buildpack, it was successful.

[user1@host:~/]$cf push Example -b https://github.com/cloudfoundry/java-buildpack#v4.5.2
Using manifest file /Example/manifest.yml Updating app Example in org org1 / space space1 user1 as user1@example.com...
OK Creating route user70422.example.com...
OK Binding user70422.example.com to Example...
OK Uploading Example...
Uploading app files from: /var/folders/8p/g6frd1w11f34zvklb74m0tgm0000gp/T/unzipped-app329048937
Uploading 5.6K, 18 files
Done uploading
OK Starting app Example in org org1 / space space1 as user1@example.com... Creating container
Successfully created container
Downloading app package...
Downloaded app package (4.4K)
-----> Java Buildpack v4.5.2 | https://github.com/cloudfoundry/java-buildpack#9a1f035
-----> Downloading Jvmkill Agent 1.10.0_RELEASE from https://java-buildpack.cloudfoundry.org/jvmkill/trusty/x86_64/jvmkill-1.10.0_RELEASE.so (0.0s)
-----> Downloading Open Jdk JRE 1.8.0_144 from https://java-buildpack.cloudfoundry.org/openjdk/trusty/x86_64/openjdk-1.8.0_144.tar.gz (0.9s)
Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.1s)
-----> Downloading Open JDK Like Memory Calculator 3.9.0_RELEASE from https://java-buildpack.cloudfoundry.org/memory-calculator/trusty/x86_64/memory-calculator-3.9.0_RELEASE.tar.gz (0.1s)
Loaded Classes: 9742, Threads: 300
-----> Downloading Client Certificate Mapper 1.3.0_RELEASE from https://java-buildpack.cloudfoundry.org/client-certificate-mapper/client-certificate-mapper-1.3.0_RELEASE.jar (0.1s)
-----> Downloading Container Security Provider 1.10.0_RELEASE from https://java-buildpack.cloudfoundry.org/container-security-provider/container-security-provider-1.10.0_RELEASE.jar (0.0s)
Exit status 0
Uploading droplet, build artifacts cache...
Uploading build artifacts cache...
Uploading droplet...
Uploaded build artifacts cache (45M)
Uploaded droplet (45.2M)
Uploading complete
Stopping instance e0511b67-78dd-47b8-a429-c314fc1bfb4f
Destroying container
Successfully destroyed container 0 of 1 instances running, 1 starting

Since the issue is with the customized Java buildpack, it should be examined further by the developer of this buildpack.

Pivotal recommends using the supported Java buildpack listed here.

 

Comments

Powered by Zendesk