New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libuv dead cycle in cmpxchgi #2462
Comments
Can you fill out the issue template? Kernel and libuv version are important to know. I infer that "dead cycle" means it busy-loops? Can you attach to the process with gdb and post the output of Is there an easy way for me to reproduce the busy loop? |
The libuv I complied is V1.x , debug version. Linux localhost.localdomain 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux The "busy loop" run in main thread 1, what I do is I hope the socket wirting opration happend in main thread , so I use the uv_asyn_t object to notify loop thread , the uv_asyn_init callback to write data in loop thread . But I create so many uv_asyn_t object in task thread .for every write req , I create on uv_asyn_t and put them back to a queue in loop thread after its callback finished. long time , this happend.
|
Okay, thanks. From your description it sounds like libuv runs on thread 1 but you call That won't work, only |
Thanks for your patiention .Yes,I use uv_async_init in other thread which uv_loop is not run in. And uv_async_init is not thread-safe,why process doesn't crash?for example,uv_write,uv_close both cause visual errors ,process coredump,if they don't run in uv_run thread.By the way,based on my experiment using the libuv,it seems that it just could work with single io thread mode,all socket stay in one loop. Can I create mutile threads and distribute socket to different loop of different thread? |
Because it's undefined behavior. There's no guarantee about what, if anything, will happen.
Yes, with some effort. See I'll close this out because it's not a libuv bug. If you have follow-up question, then please post them to the libuv/help repo. |
okay,thanks very much.------------------ 原始邮件 ------------------
发件人: "Ben Noordhuis"<notifications@github.com>
发送时间: 2019年9月11日(星期三) 凌晨3:28
收件人: "libuv/libuv"<libuv@noreply.github.com>;
抄送: "wangshangxiu"<894616049@qq.com>;"Author"<author@noreply.github.com>;
主题: Re: [libuv/libuv] libuv dead cycle in cmpxchgi (#2462)
why process doesn't crash?
Because it's undefined behavior. There's no guarantee about what, if anything, will happen.
Can I create mutile threads and distribute socket to different loop of different thread?
Yes, with some effort. See test/benchmark-multi-accept.c for an example, the uv_write2() call in particular.
I'll close this out because it's not a libuv bug. If you have follow-up question, then please post them to the libuv/help repo.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Stack:
top:
Stack is the last stack of cm_server base on libuv , top is cm_server runing status, in fact ,it doesn't run , just in libuv.
The text was updated successfully, but these errors were encountered: