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

Address family not supported by protocol #23

Open
n0rt3l opened this issue Jun 28, 2024 · 1 comment
Open

Address family not supported by protocol #23

n0rt3l opened this issue Jun 28, 2024 · 1 comment

Comments

@n0rt3l
Copy link

n0rt3l commented Jun 28, 2024

Здравствуйте, подскажите почему так падает, на версии sdk 1.5 всё работает, версии sdk выше 1.5 падают с ошибкой которая привидена ниже. Собираю приложени в единый jar c maven-shade-plugin. Любой вызов после Invest.create(token) падает. OpenJDK 11 (linux).

Exception in thread "main" ru.tinkoff.piapi.core.exception.ApiRuntimeException: unknown error
at ru.tinkoff.piapi.core.utils.Helpers.apiRuntimeException(Helpers.java:55)
at ru.tinkoff.piapi.core.utils.Helpers.unaryCall(Helpers.java:45)
at ru.tinkoff.piapi.core.InstrumentsService.getSharesSync(InstrumentsService.java:531)
at ru.tinkoff.piapi.core.InstrumentsService.getTradableSharesSync(InstrumentsService.java:563)
at com.mymy.App.monitor(App.java:1201)
at com.mymy.App.main(App.java:97)
Caused by: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:275)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:256)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:169)
at ru.tinkoff.piapi.contract.v1.InstrumentsServiceGrpc$InstrumentsServiceBlockingStub.shares(InstrumentsServiceGrpc.java:2011)
at ru.tinkoff.piapi.core.InstrumentsService.lambda$getSharesSync$30(InstrumentsService.java:531)
at ru.tinkoff.piapi.core.utils.Helpers.unaryCall(Helpers.java:43)
... 4 more
Caused by: io.grpc.netty.shaded.io.netty.channel.AbstractChannel$AnnotatedConnectException: connect(..) failed: Address family not supported by protocol: /invest-public-api.tinkoff.ru:443
Caused by: java.net.ConnectException: connect(..) failed: Address family not supported by protocol
at io.grpc.netty.shaded.io.netty.channel.unix.Errors.newConnectException0(Errors.java:155)
at io.grpc.netty.shaded.io.netty.channel.unix.Errors.handleConnectErrno(Errors.java:128)
at io.grpc.netty.shaded.io.netty.channel.unix.Socket.connect(Socket.java:351)
at io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel.doConnect0(AbstractEpollChannel.java:773)
at io.grpc.netty.shaded.io.netty.channel.epoll.EpollSocketChannel.doConnect0(EpollSocketChannel.java:144)
at io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel.doConnect(AbstractEpollChannel.java:758)
at io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.connect(AbstractEpollChannel.java:600)
at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultChannelPipeline.java:1342)
at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:653)
at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:632)
at io.grpc.netty.shaded.io.netty.channel.ChannelDuplexHandler.connect(ChannelDuplexHandler.java:54)
at io.grpc.netty.shaded.io.grpc.netty.WriteBufferingAndExceptionHandler.connect(WriteBufferingAndExceptionHandler.java:157)
at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:655)
at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.access$1000(AbstractChannelHandlerContext.java:61)
at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext$9.run(AbstractChannelHandlerContext.java:637)
at io.grpc.netty.shaded.io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
at io.grpc.netty.shaded.io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)
at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
at io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:406)
at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.grpc.netty.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.grpc.netty.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:829)

@n0rt3l
Copy link
Author

n0rt3l commented Jul 1, 2024

Решено. Проблема была в том что зависимость grpc-java плохо упаковывается maven-shade-plugin. И ломается резолвер. Нужно добавить трансформеры приведнные ниже.
Issue на grpc-java - grpc/grpc-java#10861

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>com.your.MainClass</mainClass>
                                </transformer>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                            </transformers>
                        </configuration>

                    </execution>
                </executions>
            </plugin>

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

1 participant