apache / dubbo-proxy Goto Github PK
View Code? Open in Web Editor NEWApache dubbo
Home Page: https://dubbo.apache.org/
Apache dubbo
Home Page: https://dubbo.apache.org/
对比2.7.4中release代码发现当前master(2.7.5-snapshot)存在bug,
`
ConfigManager configManager = ConfigManager.getInstance();
ConfigCenterConfig cc = (ConfigCenterConfig)configManager.getConfigCenter().orElse(new ConfigCenterConfig());
if (rc.getParameters() != null) {
Map<String, String> configParams = cc.getParameters() == null ? new HashMap() : cc.getParameters();
((Map)configParams).putAll(rc.getParameters());
cc.setParameters((Map)configParams);
}
cc.getParameters().put("client", rc.getClient());
`
rc.getParameters()为空的情况下cc.getParameters()为空,导致 cc.getParameters().put("client", rc.getClient());抛空指针
@qixiaobo 大佬这个东西还维护嘛?
support nacos?
dubbo-proxy should consider about how to be a gateway~
If only json is accepted , we should pass through the json string from user.
It's not user-friendly.
From your code ,we can see even if this registry has group but not set for registeryConfig
public static void init() {
RegistryConfig registryConfig = new RegistryConfig();
registryConfig.setAddress(registry.getUrl().getProtocol() + "://" + registry.getUrl().getAddress());
applicationConfig = new ApplicationConfig();
applicationConfig.setName("dubbo-proxy");
applicationConfig.setRegistry(registryConfig);
}
As we know , dubbo registry stands for path in zookeeper. The default path is dubbo.
At this point , we should set the group to avoid "not provider " message
apache/dubbo#4675
since dubbo may not release as soon as possible.
Maybe we should support dubbo 2.6.x or something else?
apache/dubbo#4612
From my projects, generic invoke makes error message like below
java.io.StreamCorruptedException: invalid stream header: 77020501
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:863)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:355)
at org.apache.dubbo.common.serialize.java.JavaObjectInput.<init>(JavaObjectInput.java:33)
at org.apache.dubbo.common.serialize.java.JavaSerialization.deserialize(JavaSerialization.java:54)
at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcResult.decode(DecodeableRpcResult.java:76)
at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcResult.decode(DecodeableRpcResult.java:112)
at org.apache.dubbo.rpc.protocol.dubbo.DubboCodec.decodeBody(DubboCodec.java:90)
at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:122)
at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:82)
at org.apache.dubbo.rpc.protocol.dubbo.DubboCountCodec.decode(DubboCountCodec.java:46)
at org.apache.dubbo.remoting.transport.netty4.NettyCodecAdapter$InternalDecoder.decode(NettyCodecAdapter.java:90)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:502)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:441)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:278)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1408)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
at org.apache.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:111) ~[dubbo-2.7.1.jar:2.7.1]
at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:242) ~[dubbo-2.7.1.jar:2.7.1]
at org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:76) ~[dubbo-2.7.1.jar:2.7.1]
at org.apache.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:57) ~[dubbo-2.7.1.jar:2.7.1]
at org.apache.dubbo.common.bytecode.proxy0.$invoke(proxy0.java) ~[dubbo-2.7.1.jar:2.7.1]
at org.apache.dubbo.proxy.service.GenericInvoke.genericCall(GenericInvoke.java:52) ~[classes/:na]
at org.apache.dubbo.proxy.worker.RequestWorker.run(RequestWorker.java:70) [classes/:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_151]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_151]
Caused by: org.apache.dubbo.remoting.RemotingException: java.io.StreamCorruptedException: invalid stream header: 77020501
java.io.StreamCorruptedException: invalid stream header: 77020501
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:863)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:355)
at org.apache.dubbo.common.serialize.java.JavaObjectInput.<init>(JavaObjectInput.java:33)
at org.apache.dubbo.common.serialize.java.JavaSerialization.deserialize(JavaSerialization.java:54)
at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcResult.decode(DecodeableRpcResult.java:76)
at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcResult.decode(DecodeableRpcResult.java:112)
at org.apache.dubbo.rpc.protocol.dubbo.DubboCodec.decodeBody(DubboCodec.java:90)
at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:122)
at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:82)
at org.apache.dubbo.rpc.protocol.dubbo.DubboCountCodec.decode(DubboCountCodec.java:46)
at org.apache.dubbo.remoting.transport.netty4.NettyCodecAdapter$InternalDecoder.decode(NettyCodecAdapter.java:90)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:502)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:441)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:278)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1408)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
at org.apache.dubbo.remoting.exchange.support.DefaultFuture.returnFromResponse(DefaultFuture.java:297) ~[dubbo-2.7.1.jar:2.7.1]
at org.apache.dubbo.remoting.exchange.support.DefaultFuture.get(DefaultFuture.java:191) ~[dubbo-2.7.1.jar:2.7.1]
at org.apache.dubbo.remoting.exchange.support.DefaultFuture.get(DefaultFuture.java:164) ~[dubbo-2.7.1.jar:2.7.1]
at org.apache.dubbo.rpc.protocol.dubbo.DubboInvoker.doInvoke(DubboInvoker.java:108) ~[dubbo-2.7.1.jar:2.7.1]
at org.apache.dubbo.rpc.protocol.AbstractInvoker.invoke(AbstractInvoker.java:157) ~[dubbo-2.7.1.jar:2.7.1]
at org.apache.dubbo.rpc.filter.GenericImplFilter.invoke(GenericImplFilter.java:172) ~[dubbo-2.7.1.jar:2.7.1]
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:73) ~[dubbo-2.7.1.jar:2.7.1]
at org.apache.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:88) ~[dubbo-2.7.1.jar:2.7.1]
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:73) ~[dubbo-2.7.1.jar:2.7.1]
at org.apache.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:49) ~[dubbo-2.7.1.jar:2.7.1]
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:73) ~[dubbo-2.7.1.jar:2.7.1]
at org.apache.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:54) ~[dubbo-2.7.1.jar:2.7.1]
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:73) ~[dubbo-2.7.1.jar:2.7.1]
at org.apache.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:78) ~[dubbo-2.7.1.jar:2.7.1]
at org.apache.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56) ~[dubbo-2.7.1.jar:2.7.1]
at org.apache.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:80) ~[dubbo-2.7.1.jar:2.7.1]
... 9 common frames omitted
But we fixed in this pr apache/dubbo#4612
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'nettyServer': Unsatisfied dependency expressed through field 'registry'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getRegistry' defined in class path resource [org/apache/dubbo/proxy/Config.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.alibaba.dubbo.registry.Registry]: Factory method 'getRegistry' threw exception; nested exception is java.lang.NumberFormatException: For input string: "2181,xxx:2181,xxx:2181"
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:587)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:373)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1348)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:578)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.s
Some scenes we will make some mistakes.
In this scenario, we shoud fail fast nor hang for a keep-alive time out.
项目启起来了,但调不通?
如标题,需要加强的安全机制包括两方面:
1、dubbo-proxy对内部服务的访问应当加以控制(安全策略配置),避免所有内部服务全通
2、增加对接口参数校验、IP黑白名单等初级到高级的安全策略
错误:
java.lang.ClassCastException: com.alibaba.fastjson.JSONObject cannot be cast to com.example.dto.MedicationAddReq
sometimes netty chanlle not close without keepalive header
We need dubbo attachments support~
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.