weibocom / motan-php

83 stars 30 forks source link

yar协议通过http调用,demo中的motan2使用后提示超出允许内存 #1

Open JerryChaox opened 7 years ago

JerryChaox commented 7 years ago

Allowed memory size of 134217728 bytes exhausted (tried to allocate 1113678912 bytes)

idevz commented 7 years ago

请描述下你是如何使用的?比如是 PHP Client 调用 Motan2 的服务吗?还是 调用 Yar 协议的服务?

JerryChaox commented 7 years ago

调用的是yar协议的服务 用motan2:// 提示超出允许内存 用http:// 调用提示找不到服务

motan2协议应该是php作为客户端调用了motan协议的端口,这块应该是我弄错了,接口那边没有暴露motan协议。 http协议:我用yarclient是能够请求成功的,不过遇到中文会出现解包错误,unpack error。所以想试一下这边这个组件,但是相同的url提示找不到服务

idevz commented 7 years ago

这个组件只可以调用 Motan2 协议的服务,另外你说的 http 协议的 yarclient 成功的那是 Yar 的服务端吧?是 Motan-Yar 导出的服务吗? unpack error 是调用 Motan-Yar Server 报的错?还是 PHP-Yar Server ?

JerryChaox commented 7 years ago

php的yarclient 调用 Motan-Yar Server. 没有中文的情况下是可以正常通信的

JerryChaox commented 7 years ago

$client = new Yar_Client("http://localhost:8003/api/merchant"); $result = $client->getMerchant(1);

@Yar(“api/merchant”) class MerchantService { public Merchant getMerchant(int MerchantId); }

暴露 demoYar:8003 public Merchant getMerchant(int merchantId) { 数据库查询 }

class Merchant { int id; String name; //有中文的时候出现unpack error }

JerryChaox commented 7 years ago

暴露为motan接口后提示异常:

com.weibo.api.motan.exception.MotanFrameworkException: error_message: decode error: magic error, status: 503, error_code: 20003,r=null at com.weibo.api.motan.protocol.rpc.DefaultRpcCodec.decode(DefaultRpcCodec.java:97) at com.weibo.api.motan.transport.netty.NettyDecoder.decode(NettyDecoder.java:165) at com.weibo.api.motan.transport.netty.NettyDecoder.decodev2(NettyDecoder.java:116) at com.weibo.api.motan.transport.netty.NettyDecoder.decode(NettyDecoder.java:72) at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:282) at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:216) at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:783) at org.jboss.netty.channel.SimpleChannelHandler.messageReceived(SimpleChannelHandler.java:154) at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:100) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261) at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:349) at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200) at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44) 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:745)

rayzhang0603 commented 7 years ago

目前php版本只能使用motan2协议与其他语言版本通信,java端必须也使用motan2协议

JerryChaox commented 7 years ago

motan2协议下出现以下异常:

{"errcode":10001,"errtype":1,"errmsg":"ProviderProtectedMessageRouter handler Error: provider not exist serviceKey=motan-demo-rpc/cn.tata.t2s.ssm.service.merchantService/1.0 requestId=-2620754180148297728 interface=cn.tata.t2s.ssm.service.merchantService method=getMerchant(null)"}

idevz commented 7 years ago

@JerryChaox Motan2 协议使用简单序列化来打包请求和响应,目前简单序列化只支持 3 种简单数据类型,请确认你上面 getMerchant 方法的参数是否正确? 简单序列化文档地址 相关跨语言调用实例参考motan-examples