Comments (5)
If you remove usleep
, does it work?
from libevhtp.
I comment this usleep line, then the coredump frequency become bigger.
from libevhtp.
This is very very hard to reproduce with almost 0 information (your backtrace doesn't even have debug symbols, from what I see, the error is in libevent, not evhtp).
Can you please use the template:
Details
Steps or code to reproduce the problem.
Example code
#include <evhtp.h>
int
main(int argc, char ** argv)
{
return 0;
}
Version
from libevhtp.
I have found the problem。
step1:
Let your cpu almost 100% use
step2:
remove usleep, then run my example
code:
int j = 0;
vector test_vec;
int main()
{
auto base = event_base_new();
auto ev_htp = evhtp_new(base, NULL);
evhtp_use_threads_wexit(ev_htp, [](evhtp_t * htp, evthr_t * evthr, void * arg) {
test_vec.push_back(j++);
test_vec.push_back(j++);
test_vec.push_back(j++);
test_vec.push_back(j++);
test_vec.push_back(j++);
test_vec.push_back(j++);
test_vec.push_back(j++);
test_vec.push_back(j++);
test_vec.push_back(j++);
test_vec.push_back(j++);
test_vec.push_back(j++);
test_vec.push_back(j++);
test_vec.push_back(j++);
test_vec.push_back(j++);
}, NULL, 160, NULL);
sleep(10000);
return 0;
}
from libevhtp.
source code 1:
struct evthr_pool {
#ifdef EVTHR_SHARED_PIPE
int rdr;
int wdr;
#endif
int nthreads;
evthr_pool_slist_t threads;
};
struct evthr {
int rdr;
int wdr;
char err;
ev_t * event;
evbase_t * evbase;
pthread_mutex_t lock;
pthread_t * thr;
evthr_init_cb init_cb;
evthr_init_cb exit_cb;
void * arg;
void * aux;
#ifdef EVTHR_SHARED_PIPE
int pool_rdr;
struct event * shared_pool_ev;
#endif
TAILQ_ENTRY(evthr) next;
};
comment:
look at this struct, I think the pthread_mutex_t lock should put into struct evthr_pool, not put into struct evthr.
source code 2:
pthread_mutex_lock(&thread->lock);
printf("mutex lock addr: %p\n", &thread->lock);
if (thread->init_cb != NULL) {
(thread->init_cb)(thread, thread->arg);
}
pthread_mutex_unlock(&thread->lock);
comment:
If the lock put into evthr, then the pthread_mutex_lock(&thread->lock) has no meanings.
from libevhtp.
Related Issues (20)
- Q: how to peek at incoming http requests in pipelined mode
- Q: Is it safe to operate the same request between different threads? HOT 1
- use evbuffer_add_reference send json data have a problem HOT 2
- how to build libevhtp on windows
- Log.c is not cross-platform file.
- Empty pkgconfig libdir
- Inconsistency between EVHTP_BUILD_SHARED and BUILD_SHARED_LIBS CMake options HOT 2
- How to use multithreading HOT 5
- multiple nc request in keepalive fails to increase keepalive count HOT 1
- Does libevhtp support https? If support, what is the tps of http and https with keepalive or non-keepalive?
- Migrating from ev_http: How to get the socket for evhtp_accept_socket()? HOT 1
- Add example server with "1 thread per client connection"
- evhtp.c##htp__create_reply_() missed "buf = request->rc_scratch" after "request->rc_scratch = evbuffer_new()"?
- log-format $status is request status, not response status, why ?
- crash while invoking evhtp_connection_new() HOT 1
- Major slowdown using ssl and add_buffer(req->buffer_out,...) HOT 1
- Invalid content length value results in empty response
- info: libevhtp relies on onigposix.h, which is disabled in onig>=6.9.5_rev1 HOT 1
- Seperate http request thread and worker thread
- Is libevhtp support Server-send Events?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libevhtp.