Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Parsing of the second .java file fails #23

Closed
bzz opened this issue Jun 21, 2017 · 1 comment
Closed

Parsing of the second .java file fails #23

bzz opened this issue Jun 21, 2017 · 1 comment
Assignees
Labels

Comments

@bzz
Copy link
Contributor

bzz commented Jun 21, 2017

Using https://gist.github.com/bzz/c0c3dbcab5fecbe48e22167e2ad78595 with .py and python replaces to .java and java

Seems to process Application.java but fail on next https://github.com/damoeb/kalipo/blob/master/kalipo-service/src/main/java/org/kalipo/ApplicationWebXml.java

Server logs

time="2017-06-21T13:59:01Z" level=debug msg="sending ParseUAST request: Filename:"kalipo-service/src/main/java/org/kalipo/ApplicationWebXml.java" Language:"java" Content:"package org.kalipo;\n\nimport org.kalipo.config.Constants;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.springframework.boot.builder.SpringApplicationBuilder;\nimport org.springframework.boot.context.web.SpringBootServletInitializer;\n\n/**\n * This is an helper Java class that provides an alternative to creating a web.xml.\n */\npublic class ApplicationWebXml extends SpringBootServletInitializer {\n\n    private final Logger log = LoggerFactory.getLogger(ApplicationWebXml.class);\n\n    @Override\n    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {\n        return application.profiles(addDefaultProfile())\n                .showBanner(false)\n                .sources(Application.class);\n    }\n\n    /**\n     * Set a default profile if it has not been set.\n     * <p/>\n     * <p>\n     * Please use -Dspring.profiles.active=dev\n     * </p>\n     */\n    private String addDefaultProfile() {\n        String profile = System.getProperty(\"spring.profiles.active\");\n        if (profile != null) {\n            log.info(\"Running with Spring profile(s) : {}\", profile);\n            return profile;\n        }\n\n        log.warn(\"No Spring profile configured, running with default configuration\");\n        return Constants.SPRING_PROFILE_DEVELOPMENT;\n    }\n}\n" "

Client logs

Read kalipo-service/src/main/java/org/kalipo/ApplicationWebXml.java, 1297 bytes	Parsing file:'kalipo-service/src/main/java/org/kalipo/ApplicationWebXml.java', con

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x1186147]

goroutine 1 [running]:
github.com/bblfsh/sdk/uast.(*Node).ProtoSize(0x0, 0xc4201c70b0)
	/go/src/github.com/bblfsh/sdk/uast/generated.pb.go:510 +0x37
github.com/bblfsh/sdk/uast.(*Node).Marshal(0x0, 0x1c18070, 0xc4200102c0, 0xc4201c7080, 0x0, 0x0)
	/go/src/github.com/bblfsh/sdk/uast/generated.pb.go:352 +0x2f
main.main.func1(0xc420327130, 0xc420327130, 0x0)
	/go/src/github.com/src-d/analysis-pipeline/juanjo/pyFromGit2ast2pb.go:69 +0x4c8

But also might be related to bblfsh/bblfshd#26 or #19 although there is nothing fatal in logs in this case, nor EOF.

Just in case, full log

time="2017-06-21T13:58:29Z" level=debug msg="binding to 0.0.0.0:9432"
time="2017-06-21T13:58:29Z" level=debug msg="initializing runtime at /tmp/bblfsh-runtime"
time="2017-06-21T13:58:29Z" level=debug msg="starting server"
time="2017-06-21T13:58:29Z" level=debug msg="registering gRPC service"
time="2017-06-21T13:58:29Z" level=info msg="starting gRPC server"


time="2017-06-21T13:58:46Z" level=debug msg="Looking for TLS certificates and private keys in /etc/docker/certs.d/docker.io"
time="2017-06-21T13:58:46Z" level=debug msg="Using registries.d directory /etc/containers/registries.d for sigstore configuration"
time="2017-06-21T13:58:46Z" level=debug msg=" No signature storage configuration found for docker.io/bblfsh/java-driver:latest"
time="2017-06-21T13:58:46Z" level=debug msg="GET https://registry-1.docker.io/v2/"
time="2017-06-21T13:58:47Z" level=debug msg="Ping https://registry-1.docker.io/v2/ err <nil>"
time="2017-06-21T13:58:47Z" level=debug msg="Ping https://registry-1.docker.io/v2/ status 401"
time="2017-06-21T13:58:47Z" level=debug msg="GET https://registry-1.docker.io/v2/bblfsh/java-driver/manifests/latest"
time="2017-06-21T13:58:48Z" level=debug msg="Downloading /v2/bblfsh/java-driver/blobs/sha256:3395de6e0b1034d434a3f4adb4cd16a847de81e2fb56084834187a5f1e076ebb"
time="2017-06-21T13:58:48Z" level=debug msg="GET https://registry-1.docker.io/v2/bblfsh/java-driver/blobs/sha256:3395de6e0b1034d434a3f4adb4cd16a847de81e2fb56084834187a5f1e076ebb"
time="2017-06-21T13:58:49Z" level=debug msg="Looking for TLS certificates and private keys in /etc/docker/certs.d/docker.io"
time="2017-06-21T13:58:49Z" level=debug msg="Using registries.d directory /etc/containers/registries.d for sigstore configuration"
time="2017-06-21T13:58:49Z" level=debug msg=" No signature storage configuration found for docker.io/bblfsh/java-driver:latest"
time="2017-06-21T13:58:49Z" level=debug msg="GET https://registry-1.docker.io/v2/"
time="2017-06-21T13:58:49Z" level=debug msg="Ping https://registry-1.docker.io/v2/ err <nil>"
time="2017-06-21T13:58:49Z" level=debug msg="Ping https://registry-1.docker.io/v2/ status 401"
time="2017-06-21T13:58:50Z" level=debug msg="GET https://registry-1.docker.io/v2/bblfsh/java-driver/manifests/latest"
time="2017-06-21T13:58:51Z" level=debug msg="Looking for TLS certificates and private keys in /etc/docker/certs.d/docker.io"
time="2017-06-21T13:58:51Z" level=debug msg="Using registries.d directory /etc/containers/registries.d for sigstore configuration"
time="2017-06-21T13:58:51Z" level=debug msg=" No signature storage configuration found for docker.io/bblfsh/java-driver:latest"
time="2017-06-21T13:58:51Z" level=debug msg="Downloading /v2/bblfsh/java-driver/blobs/sha256:6f821164d5b7ec94868795c1fb8dc6fd7d1fe51e04f97a6cf3a487868f2f5d68"
time="2017-06-21T13:58:51Z" level=debug msg="GET https://registry-1.docker.io/v2/"
time="2017-06-21T13:58:51Z" level=debug msg="Ping https://registry-1.docker.io/v2/ err <nil>"
time="2017-06-21T13:58:51Z" level=debug msg="Ping https://registry-1.docker.io/v2/ status 401"
time="2017-06-21T13:58:51Z" level=debug msg="GET https://registry-1.docker.io/v2/bblfsh/java-driver/blobs/sha256:6f821164d5b7ec94868795c1fb8dc6fd7d1fe51e04f97a6cf3a487868f2f5d68"
time="2017-06-21T13:58:52Z" level=debug msg="Downloading /v2/bblfsh/java-driver/blobs/sha256:e97dca3f99d69fcab2e39d6cee7daad932483a0069954d03b071544bd2451a06"
time="2017-06-21T13:58:52Z" level=debug msg="GET https://registry-1.docker.io/v2/bblfsh/java-driver/blobs/sha256:e97dca3f99d69fcab2e39d6cee7daad932483a0069954d03b071544bd2451a06"
time="2017-06-21T13:58:58Z" level=debug msg="Downloading /v2/bblfsh/java-driver/blobs/sha256:cb846aee9ebbc969b2bb93fe98ecfb865e92d419d6bd654dfe12b1d4c54e032c"
time="2017-06-21T13:58:58Z" level=debug msg="GET https://registry-1.docker.io/v2/bblfsh/java-driver/blobs/sha256:cb846aee9ebbc969b2bb93fe98ecfb865e92d419d6bd654dfe12b1d4c54e032c"
time="2017-06-21T13:58:59Z" level=debug msg="Downloading /v2/bblfsh/java-driver/blobs/sha256:3395de6e0b1034d434a3f4adb4cd16a847de81e2fb56084834187a5f1e076ebb"
time="2017-06-21T13:58:59Z" level=debug msg="GET https://registry-1.docker.io/v2/bblfsh/java-driver/blobs/sha256:3395de6e0b1034d434a3f4adb4cd16a847de81e2fb56084834187a5f1e076ebb"
time="2017-06-21T13:59:00Z" level=debug msg="creating container for bblfsh/java-driver:latest"
time="2017-06-21T13:59:00Z" level=debug msg="starting up container bblfsh/java-driver:latest (01BK5F5YNF7F42M3W05JFAZP74)"
time="2017-06-21T13:59:00Z" level=debug msg="container started bblfsh/java-driver:latest (01BK5F5YNF7F42M3W05JFAZP74)"
proto: no encoder for Filename string [GetProperties]
proto: no encoder for Language string [GetProperties]
proto: no encoder for Content string [GetProperties]
time="2017-06-21T13:59:00Z" level=debug msg="sending ParseUAST request: Filename:"kalipo-service/src/main/java/org/kalipo/Application.java" Language:"java" Content:"package org.kalipo;\n\nimport org.kalipo.config.Constants;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.actuate.autoconfigure.MetricFilterAutoConfiguration;\nimport org.springframework.boot.actuate.autoconfigure.MetricRepositoryAutoConfiguration;\nimport org.springframework.boot.autoconfigure.EnableAutoConfiguration;\nimport org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;\nimport org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;\nimport org.springframework.context.annotation.ComponentScan;\nimport org.springframework.core.env.Environment;\nimport org.springframework.core.env.SimpleCommandLinePropertySource;\nimport org.springframework.scheduling.annotation.EnableAsync;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.Arrays;\n\n@EnableAsync\n@ComponentScan\n@EnableAutoConfiguration(exclude = {MetricFilterAutoConfiguration.class, MetricRepositoryAutoConfiguration.class})\npublic class Application implements EmbeddedServletContainerCustomizer {\n\n    private final Logger log = LoggerFactory.getLogger(Application.class);\n\n    @Inject\n    private Environment env;\n\n\n    /**\n     * Initializes kalipo.\n     * <p>\n     * Spring profiles can be configured with a program arguments --spring.profiles.active=your-active-profile\n     * <p>\n     */\n    @PostConstruct\n    public void initApplication() throws IOException {\n        if (env.getActiveProfiles().length == 0) {\n            log.warn(\"No Spring profile configured, running with default configuration\");\n        } else {\n            log.info(\"Running with Spring profile(s) : {}\", Arrays.toString(env.getActiveProfiles()));\n        }\n    }\n\n    /**\n     * Main method, used to run the application.\n     * <p>\n     * To run the application with hot reload enabled, add the following arguments to your JVM:\n     * \"-javaagent:spring_loaded/springloaded-jhipster.jar -noverify -Dspringloaded=plugins=io.github.jhipster.loaded.instrument.JHipsterLoadtimeInstrumentationPlugin\"\n     */\n    public static void main(String[] args) {\n\n        SpringApplication app = new SpringApplication(Application.class);\n        app.setShowBanner(false);\n\n        SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args);\n\n        // Check if the selected profile has been set as argument.\n        // if not the development profile will be added\n        addDefaultProfile(app, source);\n\n        app.run(args);\n    }\n\n    /**\n     * Set a default profile if it has not been set\n     */\n    private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {\n        if (!source.containsProperty(\"spring.profiles.active\")) {\n            app.setAdditionalProfiles(Constants.SPRING_PROFILE_DEVELOPMENT);\n        }\n    }\n\n    @Override\n    public void customize(ConfigurableEmbeddedServletContainer container) {\n        final String clientProject = \"kalipo-client\";\n\n        if (env.acceptsProfiles(Constants.SPRING_PROFILE_PRODUCTION)) {\n            container.setDocumentRoot(new File(clientProject + \"/dist\"));\n        } else {\n            container.setDocumentRoot(new File(clientProject + \"/app\"));\n        }\n    }\n}\n" "
time="2017-06-21T13:59:01Z" level=debug msg="sending ParseUAST request: Filename:"kalipo-service/src/main/java/org/kalipo/ApplicationWebXml.java" Language:"java" Content:"package org.kalipo;\n\nimport org.kalipo.config.Constants;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.springframework.boot.builder.SpringApplicationBuilder;\nimport org.springframework.boot.context.web.SpringBootServletInitializer;\n\n/**\n * This is an helper Java class that provides an alternative to creating a web.xml.\n */\npublic class ApplicationWebXml extends SpringBootServletInitializer {\n\n    private final Logger log = LoggerFactory.getLogger(ApplicationWebXml.class);\n\n    @Override\n    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {\n        return application.profiles(addDefaultProfile())\n                .showBanner(false)\n                .sources(Application.class);\n    }\n\n    /**\n     * Set a default profile if it has not been set.\n     * <p/>\n     * <p>\n     * Please use -Dspring.profiles.active=dev\n     * </p>\n     */\n    private String addDefaultProfile() {\n        String profile = System.getProperty(\"spring.profiles.active\");\n        if (profile != null) {\n            log.info(\"Running with Spring profile(s) : {}\", profile);\n            return profile;\n        }\n\n        log.warn(\"No Spring profile configured, running with default configuration\");\n        return Constants.SPRING_PROFILE_DEVELOPMENT;\n    }\n}\n" "

@smola
Copy link
Member

smola commented Jun 23, 2017

Fixed in v0.2.0. Please, verify @abeaumont

@smola smola closed this as completed Jun 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants