Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better message on syntax error when parsing JBP_CONFIG_OPEN_JDK_JRE #268

Closed
YannRobert opened this issue Dec 10, 2015 · 7 comments
Closed

Comments

@YannRobert
Copy link

When I added the following line in env: section of the manifest yaml file

  JBP_CONFIG_OPEN_JDK_JRE: '[memory_calculator: {memory_heuristics: {heap: 70, metaspace: 15, native:10, permgen: 15, stack: 5}, memory_sizes: {metaspace: 128m..}}]'

I got the following error when pushing an app

Downloaded buildpacks
Staging...
/usr/lib/ruby/1.9.1/psych.rb:203:in `parse': (<unknown>): found unexpected ':' while scanning a plain scalar at line 1 column 67 (Psych::SyntaxError)
    from /usr/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
    from /usr/lib/ruby/1.9.1/psych.rb:151:in `parse'
    from /usr/lib/ruby/1.9.1/psych.rb:127:in `load'
    from /tmp/buildpacks/b60c1edb564d6e1ed1a20182eeb07d71/lib/java_buildpack/util/configuration_utils.rb:117:in `load_configuration'
    from /tmp/buildpacks/b60c1edb564d6e1ed1a20182eeb07d71/lib/java_buildpack/util/configuration_utils.rb:48:in `load'
    from /tmp/buildpacks/b60c1edb564d6e1ed1a20182eeb07d71/lib/java_buildpack/buildpack.rb:163:in `block in instantiate'
    from /tmp/buildpacks/b60c1edb564d6e1ed1a20182eeb07d71/lib/java_buildpack/buildpack.rb:154:in `map'
    from /tmp/buildpacks/b60c1edb564d6e1ed1a20182eeb07d71/lib/java_buildpack/buildpack.rb:154:in `instantiate'
    from /tmp/buildpacks/b60c1edb564d6e1ed1a20182eeb07d71/lib/java_buildpack/buildpack.rb:126:in `instantiate_components'
    from /tmp/buildpacks/b60c1edb564d6e1ed1a20182eeb07d71/lib/java_buildpack/buildpack.rb:120:in `initialize'
    from /tmp/buildpacks/b60c1edb564d6e1ed1a20182eeb07d71/lib/java_buildpack/buildpack.rb:225:in `new'
    from /tmp/buildpacks/b60c1edb564d6e1ed1a20182eeb07d71/lib/java_buildpack/buildpack.rb:225:in `with_buildpack'
    from /tmp/buildpacks/b60c1edb564d6e1ed1a20182eeb07d71/bin/compile:26:in `<main>'
Failed to compile droplet
Exit status 223
Staging failed: Exited with status 223

FAILED
BuildpackCompileFailed

Then when I change the env variable to

JBP_CONFIG_OPEN_JDK_JRE: '[memory_calculator: {memory_heuristics: {heap: 70, metaspace: 15, native: 10, permgen: 15, stack: 5}, memory_sizes: {metaspace: 128m..}}]'

then the deployment succeed as expected.

Notice the space after the colon in native: 10, compare to native:10 in the first example.

I think this can be generalized to :
the separator between an attribute name and an attribute value is required to be ": " (colon + space),
when the separator is ":" (colon) the buildpack will fail with the ruby error and stack trace during staging

This is a user input problem, but it would be nice to have this case be handled with an insightful error message, and no stack trace.
The message could be as simple as stating : Syntax error while parsing env variable JBP_CONFIG_OPEN_JDK_JRE : found unexpected ':' while scanning a plain scalar at line 1 column 67

The status Failed to compile droplet and BuildpackCompileFailed are also alarming and misleading, as they could be interpreted as a problem either in the buildpack or on the cloudfoundry service.

@nebhale
Copy link
Contributor

nebhale commented Jan 4, 2016

We can definitely handle the exception a little bit better than it currently is. As far as the Failed to compile droplet and BuildpackCompileFailed, those are both technically true and it's unlikely that we can convince the Cloud Foundry runtime teams to change them. Hopefully a more insightful error message will help with that.

@nebhale
Copy link
Contributor

nebhale commented Jan 4, 2016

Pivotal Tracker Issue: https://www.pivotaltracker.com/story/show/111019418

@glyn
Copy link
Contributor

glyn commented Feb 22, 2016

How about the following message?

User configuration value in environment variable JBP_CONFIG_OPEN_JDK_JRE has invalid syntax: (<unknown>): found unexpected ':' while scanning a plain scalar at line 1 column 67

Note that (<unknown>): is part of the exception message and I don't think it makes sense to attempt to strip this out.

@nebhale
Copy link
Contributor

nebhale commented Feb 22, 2016

Yeah, I agree. My thought was that we'd simply catch the YAML parsing exception, give it some context and print the message. So that seems to match.

@YannRobert
Copy link
Author

You're right @glyn
I think you got the point.
As for the exact message providing the context, I'll leave it to you and your wisdom.

@glyn
Copy link
Contributor

glyn commented Feb 26, 2016

Thanks.

@glyn
Copy link
Contributor

glyn commented Feb 29, 2016

Fixed at master.

@glyn glyn closed this as completed Feb 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants