chenshuo / muduo

Event-driven network library for multi-threaded Linux server in C++11
https://github.com/chenshuo/muduo
Other
14.88k stars 5.18k forks source link

Fix multiple simultaneous requests to same URL cause coredump #708

Open williammuji opened 6 months ago

williammuji commented 6 months ago

1. BUILD_TYPE=debug

examples/curl/mcurl.cc:

  curl::RequestPtr req = curl.getUrl("https://chenshuo.com");
  req->setDataCallback(onData);
  req->setDoneCallback(done);

  curl::RequestPtr req2 = curl.getUrl("https://chenshuo.com");
  // req2->allowRedirect(5);
  req2->setDataCallback(onData);
  req2->setDoneCallback(done);

  curl::RequestPtr req3 = curl.getUrl("https://chenshuo.com");
  // req3->allowRedirect(5);
  req3->setDataCallback(onData);
  req3->setDoneCallback(done);

Error output:

mcurl: /home/williammuji/codebase/muduo/examples/curl/Curl.cc:81: muduo::net::Channel* curl::Request::setChannel(int): Assertion `channel_.get() == NULL' failed.

2. BUILD_TYPE=release

coredump

ggandycong commented 6 months ago

刘德聪,已经收到你的邮件,请你放心 祝你生活愉快,笑口常开