Giter VIP home page Giter VIP logo

motan-php's Issues

PHP通过go agent调用java服务BUG

go agent 需要通过版本等值组成的键查找服务是否存在:
version := "0.1"
if request.GetAttachment(mpro.MVersion) != "" {
version = request.GetAttachment(mpro.MVersion)
}
ck := getClusterKey(request.GetAttachment(mpro.MGroup), version, request.GetAttachment(mpro.MProxyProtocol), request.GetAttachment(mpro.MPath))
但是,我跟踪了下,通过php的doCall调用方法时,版本号根本就没有到agent这边来,是我用法错误吗?

超时问题

Connection.php中有个写死的1000000。
可以在ReadMe中说明.
遇到问题从服务端超时到代理超时挨个排查。

php客户端java服务序列化问题

服务提供方: java
服务调用方: php
两种情况: 1、服务提供方无法处理请求参数; 2、服务调用方无法解析返回结果
1:
java服务方法

    public String sayHello(String name) {
        System.out.println("name: " + name);
        return "hello " + "GD" + " !";
    }

php调用

$rs = $cx->sayHello(['name'=>'']);

异常:

{"errcode":400,"errmsg":"call fail over 3 times.Exception:process request fail. errmsg:error_message: SimpleSerialization not support type:class java.lang.String, status: 503, error_code: 10001,r=-2620754180148297728","errtype":1}Motan\Protocol\Header Object
(
    [_magic:Motan\Protocol\Header:private] => 61937
    [_msg_type:Motan\Protocol\Header:private] => 1
    [_version_status:Motan\Protocol\Header:private] => 9
    [_serialize:Motan\Protocol\Header:private] => 8
    [_request_id:Motan\Protocol\Header:private] => 1.5825989893561E+19
)
Array
(
    [M_e] => {"errcode":400,"errmsg":"call fail over 3 times.Exception:process request fail. errmsg:error_message: SimpleSerialization not support type:class java.lang.String, status: 503, error_code: 10001,r=-2620754180148297728","errtype":1}
)

2:
java服务方法

    public String sayHello() {
        return "hello GD !";
    }

php调用同1,可以调用到服务,并返回结果,但是php无法解析
异常

PHP Fatal error:  Uncaught Exception: Fail to Decode response body, got a no support type! in /home/wwwroot/zepra.com/motan/src/Motan/Serialize/Motan.php:104
Stack trace:
#0 /home/wwwroot/zepra.com/motan/src/Motan/Endpointer.php(96): Motan\Serialize\Motan->deserialize(NULL, '\nhello GD !')
#1 /home/wwwroot/zepra.com/motan/src/Motan/Client.php(102): Motan\Endpointer->call()
#2 /home/wwwroot/zepra.com/motan/test.php(13): Motan\Client->__call('sayHello', Array)
#3 {main}
  thrown in /home/wwwroot/zepra.com/motan/src/Motan/Serialize/Motan.php on line 104

Motan.php 104行 type为10

\Motan\Client的_call方法BUG

$request_id = $request_args = $request_header = NULL;
isset($arguments[0]) && !empty($arguments[0]) && $request_args = $arguments[0];
$request = new \Motan\Request($this->_url_obj->getService(),
$name, ...[$request_args]);
isset($arguments[1]) && !empty($arguments[1]) && $request->addHeaders($arguments[1]);
isset($arguments[2]) && !empty($arguments[2]) && $request->setRequestId($arguments[2]);
$request->setGroup($this->_url_obj->getGroup());
$http_params = $this->_url_obj->getParams();

这上面的写法决定了通过_call调用某个远程方法时,只能支持一个参数吧?
...[$request_args],这个地方是否还要判断下?

Error to read header_buffer

目前走的motan-go代理访问JAVA服务,
JAVA服务后面会同步对接一个较耗时的服务(1~4秒处理时长)
motan-go配置的6秒超时,如果JAVA服务耗时短则motan-php正常接收返回结果,但是如果耗时长,motan-php这边基本在2秒左右,报Error to read header_buffer异常,
这个异常是什么场景下会报
结合motan-go应该如何配置motan-php的超时时长?

Wrong definition

$request_obj = $resp_obj = NULL;
if (empty($arguments)) {
$req_params = $this->_url_obj->getParams();
if (!empty($req_params)) {
$req_obj_data = $req_params;
} else {
$req_obj_data = $this->_url_obj->getRawReqObj();
}
$request_obj = $this->_serializer->serialize($req_obj_data);
} else {
$request_obj = $this->_serializer->serializeMulti(...$arguments);
}
if (Constants::PROTOCOL_GRPC === $this->_url_obj->getProtocol()) {
$resp_obj = $req_params['resp_msg'];
$req_obj_data = $req_params['req_msg'];
$request_obj = $this->_serializer->serialize($req_obj);
$this->_resp_taged = true;
}

Definition $request_obj in line 78 is useless.
$req_obj is not defined in line 93, it might be $req_obj_data defined in line 92 ?

composer安装,包没找到

composer require motan/motan-php

Could not find a matching version of package motan/motan-php. Check the package spelling, your version constraint a
nd that the package is available in a stability which matches your minimum-stability (dev).

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.