Code Monkey home page Code Monkey logo

rdebug's People

Contributors

727155455 avatar azurx avatar bikong0411 avatar mingliangt avatar taowen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rdebug's Issues

ERROR: ld.so

LD_PRELOAD="/usr/lib64/koala-libc.so /usr/lib64/libcurl.so.4" LC_CTYPE="C" KOALA_SO=/usr/lib64/koala-recorder.so KOALA_RECORD_TO_DIR=/tmp/rdebug/record/ /opt/remi/php72/root/usr/sbin/php-fpm

ERROR: ld.so: object '/usr/lib64/koala-libc.so' from LD_PRELOAD cannot be preloaded: ignored.

支持mongoDB的mock嘛?

我厂有对mongoDB进行数据的增删改查,请问下这个有支持嘛?这种格式的

$service = "mongodb://{$user}:{$pwd}@{$host}";

目前的连接mongoDB的回放是回放不成功的

Can you make a Dockerfile?

Can you make a Dockerfile and push the docker image to hub.docker.com?

So I can quickly start testing , no need spend the time for Rdebug installation.

Linux 使用 midi 回放多个本地文件时进程卡住

概述

Linux 下使用 midi run 命令加多个 -f 参数回放多个文件时会卡住,而逐个回放则没有问题

环境

CentOS 7.2 x64

最小复现场景

在同一环境下进行录制、回放

  1. 本地服务及 rdebug 正常部署,so 均在本地编译得到,php-fpm 子进程 lsof 包含 output/libs/koala-recorder.so, koala-libc.so
  2. 请求本地 http 服务,录制文件输出到 output/session/xxx (文件大小 100k)
  3. 拷贝上述文件到本地应用 public 目录下:cp output/session/xxx $my_project/public/1
  4. 使用当前环境编译的 rdebug/output/bin/midi.phar 进行回放(使用同一文件回放多次模拟,其实与回放不同文件效果相同)
$ cd $my_project/public/
$ ~/rdebug/output/bin/midi.phar run -f 1 -f 1 -f 1 -f 1 -f 1 -f 1 -f 1 -f 1 -f 1 -f 1 -f 1 -f 1 -f 1 -D
Finally will replay 13 sessions.
Progressing:  1/13 [>>>-------------------------]   7% 8.0 MiB
Diff Result: Response Body No Diff!
...
Progressing: 12/13 [>>>>>>>>>>>>>>>>>>>>>>>>>>--]  92% 10.0 MiB  # 每次都卡在第 12 个文件

info

  • midi 进程,php -S 进程内存占用均在 100K 以内,cpu 占用正常
  • midi 进程 socket 信息
TCP localhost:54747->localhost:5514 (ESTABLISHED)
  • php -S 进程 socket 信息
TCP *:5514 (LISTEN)
TCP localhost:5516 (LISTEN)
TCP localhost:5515 (LISTEN)
TCP localhost:5514->localhost:54747 (ESTABLISHED)
TCP localhost:36718->localhost:5515 (ESTABLISHED)
TCP localhost:5515->localhost:36718 (ESTABLISHED)

似乎 localhost:54747 <----> localhost:5514 之间的交互出现了问题,阻塞后续请求

调试过程

确认是否与接口响应数据类型有关

源码的默认处理是按照 json utf-8 实现的,但实际验证 xml 也可以进行回放

  • 回放接口响应为 json utf-8 的请求,文件大小 200k,稳定卡在第 34 个文件

确认是否与接口响应大小有关

发送响应结果较小的请求,生成录制文件大小 20k,重复上述步骤,每次回放 3000 个文件,尝试多次偶现卡在第 300, 500 个文件的情况

确认是否与缓存有关

修改 Midi/Config.yml 中 memory_limit 为 100G,重新编译后重复上述步骤,未能解决问题

确认是否与垃圾回收有关

修改 Midi/Config.yml 中 gc-global-status-timeout = 10s,重新编译后重复上述步骤,未能解决问题

确认是否与 mock 请求超时有关

修改 Midi/Config.yml 中 inbound-read-timeout = 5s,进程不再卡住,超时后提示 Seem Koala response empty, retry...

...
Progressing: 12/13 [>>>>>>>>>>>>>>>>>>>>>>>>>>--]  92% 10.0 MiB
Seems Koala response empty, retry ...
Seems Koala response empty, retry ...
Koala response empty: OK
Progressing: 13/13 [>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 100% 10.0 MiB
Seems Koala response empty, retry ...
Seems Koala response empty, retry ...
Koala response empty: OK
Summary: Replayed 13 Sessions No DIFF. Spent 186 s.

但未能解决问题,第 12, 13 个请求返回为空

环境

更换另一台 CentOS 7.2 机器,存在同样问题

How to play back the frequently changing API interface

怎样去回放经常发生变动的API接口?
长久以来,我对这类的组件也和你们didi一样有同样的想法,但苦于下面两个问题无法实现,从而一直搁置。我看你们的文档上,并没有阐述对这个问题的解决,不知道是不是?

1、针对于 /books POST (new Book) 和 接踵而来的 /books/:bookId PATCH 这样的接口,对前端是有感知的,但是记录下来,对于后端确实无感知的。
2、API接口发生微调的接口,即只要改变一点点数据结构,即之前记录全部无效。

How to play back the API interface that changes frequently?
For a long time, I have the same idea for this type of component as you did with didi, but I have been stuck with the following two problems. I see your document, and did not explain the solution to this problem, I don't know if it is?

  1. The interface for /books POST (new Book) and the incoming /books/:bookId PATCH is perceptual to the front end, but it is recorded and is not perceived by the back end.
  2. The interface of the API interface is fine-tuned, that is, as long as the data structure is changed a little, that is, all the previous records are invalid.

alpine 3.10编译报错

/go/src/github.com/didi/rdebug/koala # ./build.sh recorder
+++ dirname ./build.sh
++ cd ../.
++ pwd -P
+ RDEBUG=/go/src/github.com/didi/rdebug
+ case $1 in
+ export GOPATH=/tmp/build-golang
+ GOPATH=/tmp/build-golang
+ export 'CGO_CFLAGS=-DKOALA_LIBC_NETWORK_HOOK -DKOALA_LIBC_FILE_HOOK'
+ CGO_CFLAGS='-DKOALA_LIBC_NETWORK_HOOK -DKOALA_LIBC_FILE_HOOK'
+ export 'CGO_CPPFLAGS=-DKOALA_LIBC_NETWORK_HOOK -DKOALA_LIBC_FILE_HOOK'
+ CGO_CPPFLAGS='-DKOALA_LIBC_NETWORK_HOOK -DKOALA_LIBC_FILE_HOOK'
+ export 'CGO_CXXFLAGS=-std=c++11 -Wno-ignored-attributes'
+ CGO_CXXFLAGS='-std=c++11 -Wno-ignored-attributes'
+ exec go build -tags=koala_recorder -buildmode=c-shared -o /go/src/github.com/didi/rdebug/output/libs/koala-recorder.so github.com/didi/rdebug/koala/cmd/recorder
# github.com/didi/rdebug/koala/gateway/gw4libc
In file included from file_hook.cpp:11:
file_hook.cpp:73:11: error: redefinition of 'template<class ... Args> decltype (fopen(real::fopen::args ...)) real::fopen(Args ...)'
 INTERPOSE(fopen)(const char *filename, const char *opentype) {
           ^~~~~
interpose.h:38:10: note: in definition of macro 'INTERPOSE'
     auto NAME(Args... args) -> decltype(::NAME(args...)) { \
          ^~~~
file_hook.cpp:19:11: note: 'template<class ... Args> decltype (fopen(real::fopen::args ...)) real::fopen(Args ...)' previously declared here
 INTERPOSE(fopen64)(const char *filename, const char *opentype) {
           ^~~~~~~
interpose.h:38:10: note: in definition of macro 'INTERPOSE'
     auto NAME(Args... args) -> decltype(::NAME(args...)) { \
          ^~~~
file_hook.cpp:73:11: error: redefinition of 'FILE* fopen(const char*, const char*)'
 INTERPOSE(fopen)(const char *filename, const char *opentype) {
           ^~~~~
interpose.h:49:31: note: in definition of macro 'INTERPOSE'
   extern "C" decltype(::NAME) NAME __attribute__((weak, alias("__interpose_" #NAME))); \
                               ^~~~
file_hook.cpp:19:11: note: 'FILE* fopen(const char*, const char*)' previously defined here
 INTERPOSE(fopen64)(const char *filename, const char *opentype) {
           ^~~~~~~
interpose.h:49:31: note: in definition of macro 'INTERPOSE'
   extern "C" decltype(::NAME) NAME __attribute__((weak, alias("__interpose_" #NAME))); \
                               ^~~~
file_hook.cpp:101:11: error: redefinition of 'template<class ... Args> decltype (open(real::open::args ...)) real::open(Args ...)'
 INTERPOSE(open)(const char *filename, int flags, ...) {
           ^~~~
interpose.h:38:10: note: in definition of macro 'INTERPOSE'
     auto NAME(Args... args) -> decltype(::NAME(args...)) { \
          ^~~~
file_hook.cpp:47:11: note: 'template<class ... Args> decltype (open(real::open::args ...)) real::open(Args ...)' previously declared here
 INTERPOSE(open64)(const char *filename, int flags, mode_t mode) {
           ^~~~~~
interpose.h:38:10: note: in definition of macro 'INTERPOSE'
     auto NAME(Args... args) -> decltype(::NAME(args...)) { \
          ^~~~
file_hook.cpp:101:11: error: redefinition of 'int open(const char*, int, ...)'
 INTERPOSE(open)(const char *filename, int flags, ...) {
           ^~~~
interpose.h:49:31: note: in definition of macro 'INTERPOSE'
   extern "C" decltype(::NAME) NAME __attribute__((weak, alias("__interpose_" #NAME))); \
                               ^~~~
file_hook.cpp:47:11: note: 'int open(const char*, int, ...)' previously defined here
 INTERPOSE(open64)(const char *filename, int flags, mode_t mode) {
           ^~~~~~
interpose.h:49:31: note: in definition of macro 'INTERPOSE'
   extern "C" decltype(::NAME) NAME __attribute__((weak, alias("__interpose_" #NAME))); \
                               ^~~~

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.