[ 
https://issues.apache.org/jira/browse/THRIFT-4963?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16940809#comment-16940809
 ] 

Fei Sun edited comment on THRIFT-4963 at 9/30/19 10:05 AM:
-----------------------------------------------------------

The deadlock doesn't occur very frequently, as usually the write buffer is 
large enough(for example 100KB) and thrift only needs 8 bytes for each task. 
One possible solution could be wait with timeout and remove the expired pending 
tasks if the task queue is still full, so the non-blocking server should be 
able to recover from "deadlock", though it will not recover immediately and 
need to wait for the pending task to be expired.

Any more ideas? Or we can just ignore this and ask users to disable max pending 
task count?

 

file: lib/cpp/src/thrift/concurrency/ThreadManager.cpp !wait_timeout.png!

 


was (Author: fesun):
The deadlock doesn't occur very frequently, as usually the write buffer is 
large enough(for example 100KB) and thrift only needs 8 bytes for each task. 
One possible solution could be wait with timeout and remove the expired pending 
tasks if the task queue is still full, so the non-blocking server should be 
able to recover from "deadlock", though it will not recover immediately and 
need to wait for the pending task to be expired.

Any more ideas?

 

file: lib/cpp/src/thrift/concurrency/ThreadManager.cpp !wait_timeout.png!

 

> TNonblockingServer blocked int addTask(IOThread) and notify(workerThread)
> -------------------------------------------------------------------------
>
>                 Key: THRIFT-4963
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4963
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.12.0
>            Reporter: chenguang9239
>            Priority: Major
>         Attachments: CppClient.cpp, CppServer.cpp, deadlock_thread.png, 
> wait_timeout.png
>
>
> hello!
> when using c++ TNonblockingServer(with thread pool),I found it blocked in 
> high QPS status.
> I used pstack to print thread stack and found worker thread and IO thread 
> blocked at:
> The worker thread will call notifyIOThread when it handle expired task, then 
> call TNonblockingIOThread::notify and wait for POLLOUT in poll without 
> timeout. 
> The IO thread will call addTask when it gets requests. And IO threads will 
> lock threadManager->mutex_ in addTask without a timeout
> Is it a bug of thrift 0.12.0?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to