Skip to content

Conversation

@shinrich
Copy link
Member

Another approach to address the issue identified in PR #6367. This PR does reschedule in the event that the continuation lock is unavailable. But it schedules to itself rather than to the continuation. At the top of the Http2Stream main handler, it looks for the read and write_vio events and attempts to call the read or write handler again using the event stored away in in the event's callback event.

@shinrich shinrich added this to the 10.0.0 milestone Feb 10, 2020
@shinrich shinrich requested a review from masaori335 February 10, 2020 23:30
@shinrich shinrich self-assigned this Feb 10, 2020
@shinrich
Copy link
Member Author

[ci approve clang-analyzer]

1 similar comment
@randall
Copy link
Contributor

randall commented Feb 11, 2020

[ci approve clang-analyzer]

if (this->_write_vio_event) {
this->_write_vio_event->cancel();
}
this->_write_vio_event = this_ethread()->schedule_in(this, retry_delay, event, &write_vio);
Copy link
Member

@maskit maskit Feb 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand this correctly, we don't need to pass write_vio because it always use THE write_vio that Http2Stream has, right?

Is retry_delay required? Should we change signal_read_event to use it too (on maybe another PR)?

Edit: I found signal_read_event already use retry_delay on this PR.

Copy link
Contributor

@masaori335 masaori335 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we need an async mechanism, rescheduling events to itself like this is an option.
Actually, I doubt the necessaries of the async mechanism, but we can deal with it later.

reentrancy_count++;
if (e == cross_thread_event) {
if (e == _read_vio_event) {
this->signal_read_event(e->callback_event);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to set _read_vio_event nullptr before signal_read_event() call. Otherwise, _read_vio_event->cancel() will be called when the mutex could not be locked again.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpicking] e->callback_event is same to event, right? Using event looks clear in these event handlers.

Copy link
Member

@maskit maskit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer this approach rather than #6367 because it looks safer.

@shinrich
Copy link
Member Author

[approve ci clang-analyzer]

@shinrich shinrich merged commit 87e7906 into apache:master Feb 21, 2020
@zwoop zwoop added the OnDocs This is for PR currently running, or will run, on the Docs ATS server label Feb 21, 2020
@zwoop
Copy link
Contributor

zwoop commented Feb 21, 2020

Cherry-picked to v9.0.x branch.

@zwoop zwoop removed the OnDocs This is for PR currently running, or will run, on the Docs ATS server label Feb 21, 2020
@zwoop zwoop modified the milestones: 10.0.0, 9.0.0 Feb 21, 2020
@zwoop zwoop modified the milestones: 9.0.0, 8.1.0 Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants