-
Notifications
You must be signed in to change notification settings - Fork 844
Fix potential stall on HTTP/2 connection #6367
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
Conversation
|
I understand what problem you are trying to solve, but I'm not sure we should solve it in this way. Doesn't it affect performance? Maybe it doesn't matter because the mechanism is broken already though. I'd keep the asynchronous mechanism and find a way to pass data correctly. |
|
Very interesting. I've looked at this code many times, but it never hit me that the scheduled handle event is passing in the event rather than the event->cookie. It would be good to figure this out in general to avoid deadlocking. There are doubtless other places in the code making this same flawed assumption. Perhaps the scheduled handleEvent call should just always pass in the e->cookie. Of course would need to do a deeper analysis of the code to determine the impact of that change. |
|
It seems that the schedule operations in Http2ClientSession have the same issue. |
|
Although the fix makes sense, I am concerned that a thread might be blocked if we have any other cases doing the same thing. |
vmamidi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, but we should also look at other places for similar issues to avoid any deadlocks.
|
I think doing using the TSHttpSsnCallback class in TSHttpSsnReenable() would be the safe thing to do if the lock cannot be immediately acquired. A new continuation is created using the same mutex as the original target continuation. The only purpose of the Callback continuation is to call the handler of the original target continuation with the original arguments and then clean itself up. With a reuse list of jemalloc and/or a proxy allocator list, the memory manipulation overhead should be minimal. |
|
The code was introduced by 85c0211. All 7.x and 8.x releases should be affected. Also, Always using |
|
|
In Http2Stream.cc, below (bit simplified) code appear 5 times. However, this doesn't work as expected when the try lock is not locked.
The third argument of
schedule_imm()isvoid *cookieand it is assigned toEvent::cookie. When the event is processed, the second argument ofhandleEvent()isEvent *.OTOH, the event handler of the
read_vio.cont(HttpTunnel or HttpSM) assume the secondvoid *isVIO *.This means if we want to pass
VIO *, we need to callhandleEvent()directly.trafficserver/proxy/http/HttpTunnel.cc
Line 1559 in baf9d4b
trafficserver/proxy/http/HttpSM.cc
Line 2629 in baf9d4b
When ATS falls into the case, the event is ignored and the stream might be stalled.