Giter Site home page Giter Site logo

Comments (5)

dinowernli avatar dinowernli commented on May 7, 2024 1

@edmund-troche thanks a lot for the examples, these are both cases where the rpc itself fails (rather than the setup or the parsing).

In in #81 I have made sure that Polyglot returns a non-zero exit code if the rpc fails. I would rather wait with making the error code configurable until we know that there is really a need for it.

from polyglot.

edmund-troche avatar edmund-troche commented on May 7, 2024 1

@dinowernli Thanks for the code change in #81.

I wanted to clarify the need for a configurable exit code. More than the configurability aspect, what would be useful is to be able to distinguish when the error is due to a failed gRPC request vs some other error (e.g. error on how polyglot was called, or input payload parsing, etc). So, this could be easily addressed by just returning some other exit code for the case where the gRPC fails. There may be room for returning other exit codes under other scenarios, for example, if the gRPC failed because it could not connect to the service (e.g. target service is not running, or not reachable), maybe return exit code "2", if we can connect to the service and it fails due to other errors then exit with some of other code. Anyway, I'm thinking about how I would use polyglot for some simple automated tests, I would not want the test code to assume that some gRPC code broke when in fact it is one of those other cases, like an error on how polyglot was called, or the payload, or the service is still not up and running, etc.

from polyglot.

dinowernli avatar dinowernli commented on May 7, 2024

@edmund-troche In PR #78 I am fixing the case where failure to parse command line flags would mistakenly exit with 0.

As far as I can tell, the other cases where exceptions bubble up to top level should result in error code 1. Do you think you could post the output of an example execution which exhibits the problem you are describing?

from polyglot.

edmund-troche avatar edmund-troche commented on May 7, 2024

@dinowernli, here is one example where I'm doing a call and the server is not reachable:

$ ./get_key.sh
[main] INFO me.dinowernli.grpc.polyglot.Main - Polyglot version: 1.4.0
[main] INFO me.dinowernli.grpc.polyglot.Main - Loaded configuration:
[main] INFO me.dinowernli.grpc.polyglot.command.ServiceCall - Creating channel to: localhost:xxxx
[main] INFO me.dinowernli.grpc.polyglot.command.ServiceCall - Using proto descriptors obtained from protoc
[main] INFO me.dinowernli.grpc.polyglot.command.ServiceCall - Creating dynamic grpc client
[main] INFO me.dinowernli.grpc.polyglot.command.ServiceCall - Making rpc with 1 request(s) to endpoint [localhost:xxxx]
[main] INFO me.dinowernli.grpc.polyglot.grpc.DynamicGrpcClient - Making unary call
[grpc-default-executor-1] ERROR me.dinowernli.grpc.polyglot.io.LoggingStatsWriter - Aborted rpc due to error
io.grpc.StatusRuntimeException: UNAVAILABLE
	at io.grpc.Status.asRuntimeException(Status.java:543)
	at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:442)
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:426)
	at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:76)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:512)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:429)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:544)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52)
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:117)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:748)
Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: localhost/0:0:0:0:0:0:0:1:xxxx
	at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
	at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
	at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:352)
	at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:340)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:632)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:579)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:496)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:458)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
	... 1 more
Caused by: java.net.ConnectException: Connection refused
	... 11 more
✔ ~/go/src/xxxxx/test [develop ↓·1↑·11|✚ 3…18]
08:21 $ echo $?
0

This is an example where I make a call and the rpc returns an error:

$ ./get_key.sh
[main] INFO me.dinowernli.grpc.polyglot.Main - Polyglot version: 1.4.0
[main] INFO me.dinowernli.grpc.polyglot.Main - Loaded configuration:
[main] INFO me.dinowernli.grpc.polyglot.command.ServiceCall - Creating channel to: localhost:xxxx
[main] INFO me.dinowernli.grpc.polyglot.command.ServiceCall - Using proto descriptors obtained from protoc
[main] INFO me.dinowernli.grpc.polyglot.command.ServiceCall - Creating dynamic grpc client
[main] INFO me.dinowernli.grpc.polyglot.command.ServiceCall - Making rpc with 1 request(s) to endpoint [localhost:xxxx]
[main] INFO me.dinowernli.grpc.polyglot.grpc.DynamicGrpcClient - Making unary call
[grpc-default-executor-0] ERROR me.dinowernli.grpc.polyglot.io.LoggingStatsWriter - Aborted rpc due to error
io.grpc.StatusRuntimeException: UNKNOWN: rpc processing failed
	at io.grpc.Status.asRuntimeException(Status.java:543)
	at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:442)
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:426)
	at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:76)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:512)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:429)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:544)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52)
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:117)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:748)
✔ ~/go/src/xxxx/test [develop ↓·1↑·11|✚ 3…18]
08:30 $ echo $?
0

These are two cases I know of, there may be others, hopefully this is helpful.

Thanks

from polyglot.

edmund-troche avatar edmund-troche commented on May 7, 2024

@dinowernli one more thing, I'm running with the prebuilt JAR from the last release.

from polyglot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.