ballerina-platform / ballerina-lang

The Ballerina Programming Language
https://ballerina.io/
Apache License 2.0
3.68k stars 751 forks source link

NPE when accessing grpc service #19825

Closed warunalakshitha closed 4 years ago

warunalakshitha commented 5 years ago

Description:

I have following grpc code.

service ShippingService on new grpc:Listener(50051) {

    resource function GetQuote(grpc:Caller caller, GetQuoteRequest value) {
        // Implementation goes here.

        // You should return a GetQuoteResponse
        currencyservice:Money cost_usd = {currency_code:"USD", units:100, nanos:10};
        GetQuoteResponse resp = {
            cost_usd: cost_usd   
        };
        io:println(resp);
        var e = caller->send(resp);
        e = caller->complete();

    }
    resource function ShipOrder(grpc:Caller caller, ShipOrderRequest value) {
        // Implementation goes here.

        // You should return a ShipOrderResponse
         ShipOrderResponse resp = {
            tracking_id:"123456"  
        };
        io:println(resp);
        var e = caller->send(resp);
        e = caller->complete();
    }
}

When accessing grpc service( K8s) i can observe following crash logs in container.

[2019-11-07 15:35:34,479] SEVERE {b7a.log.crash} - null 
java.lang.NullPointerException
    at ballerinaDemo.shippingservice.$value$ShippingService__service_0.call(ShippingService_sample_service.bal)
    at org.ballerinalang.jvm.values.connector.Executor.lambda$submit$0(Executor.java:76)
    at org.ballerinalang.jvm.scheduling.SchedulerItem.execute(Scheduler.java:411)
    at org.ballerinalang.jvm.scheduling.Scheduler.run(Scheduler.java:202)
    at org.ballerinalang.jvm.scheduling.Scheduler.runSafely(Scheduler.java:175)
    at org.ballerinalang.jvm.scheduling.Scheduler.start(Scheduler.java:162)
    at ballerinaDemo.shippingservice.___init.main(shippingservice)
pubudu91 commented 4 years ago

Closing this since this seems to have been fixed by #19848