You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2016/09/19 16:21:42 UTC
svn commit: r1761477 - in /httpd/httpd/trunk/modules/http2: h2_bucket_beam.c
h2_mplx.c h2_mplx.h h2_stream.c h2_task.c
Author: icing
Date: Mon Sep 19 16:21:42 2016
New Revision: 1761477
URL: http://svn.apache.org/viewvc?rev=1761477&view=rev
Log:
mod_http2: rest of the fix for output blockage
Modified:
httpd/httpd/trunk/modules/http2/h2_bucket_beam.c
httpd/httpd/trunk/modules/http2/h2_mplx.c
httpd/httpd/trunk/modules/http2/h2_mplx.h
httpd/httpd/trunk/modules/http2/h2_stream.c
httpd/httpd/trunk/modules/http2/h2_task.c
Modified: httpd/httpd/trunk/modules/http2/h2_bucket_beam.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_bucket_beam.c?rev=1761477&r1=1761476&r2=1761477&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_bucket_beam.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_bucket_beam.c Mon Sep 19 16:21:42 2016
@@ -223,6 +223,28 @@ static void leave_yellow(h2_bucket_beam
}
}
+static void report_consumption(h2_bucket_beam *beam, int force)
+{
+ if (force || beam->received_bytes != beam->reported_consumed_bytes) {
+ if (beam->consumed_fn) {
+ beam->consumed_fn(beam->consumed_ctx, beam, beam->received_bytes
+ - beam->reported_consumed_bytes);
+ }
+ beam->reported_consumed_bytes = beam->received_bytes;
+ }
+}
+
+static void report_production(h2_bucket_beam *beam, int force)
+{
+ if (force || beam->sent_bytes != beam->reported_produced_bytes) {
+ if (beam->produced_fn) {
+ beam->produced_fn(beam->produced_ctx, beam, beam->sent_bytes
+ - beam->reported_produced_bytes);
+ }
+ beam->reported_produced_bytes = beam->sent_bytes;
+ }
+}
+
static apr_off_t calc_buffered(h2_bucket_beam *beam)
{
apr_off_t len = 0;
@@ -279,7 +301,9 @@ static apr_status_t r_wait_space(h2_buck
*premain = calc_space_left(beam);
while (!beam->aborted && *premain <= 0
&& (block == APR_BLOCK_READ) && pbl->mutex) {
- apr_status_t status = wait_cond(beam, pbl->mutex);
+ apr_status_t status;
+ report_production(beam, 1);
+ status = wait_cond(beam, pbl->mutex);
if (APR_STATUS_IS_TIMEUP(status)) {
return status;
}
@@ -356,28 +380,6 @@ static void h2_beam_emitted(h2_bucket_be
}
}
-static void report_consumption(h2_bucket_beam *beam, int force)
-{
- if (force || beam->received_bytes != beam->reported_consumed_bytes) {
- if (beam->consumed_fn) {
- beam->consumed_fn(beam->consumed_ctx, beam, beam->received_bytes
- - beam->reported_consumed_bytes);
- }
- beam->reported_consumed_bytes = beam->received_bytes;
- }
-}
-
-static void report_production(h2_bucket_beam *beam, int force)
-{
- if (force || beam->sent_bytes != beam->reported_produced_bytes) {
- if (beam->produced_fn) {
- beam->produced_fn(beam->produced_ctx, beam, beam->sent_bytes
- - beam->reported_produced_bytes);
- }
- beam->reported_produced_bytes = beam->sent_bytes;
- }
-}
-
static void h2_blist_cleanup(h2_blist *bl)
{
apr_bucket *e;
@@ -877,6 +879,9 @@ transfer:
}
if (transferred) {
+ if (beam->m_cond) {
+ apr_thread_cond_broadcast(beam->m_cond);
+ }
status = APR_SUCCESS;
}
else if (beam->closed) {
@@ -890,6 +895,9 @@ transfer:
goto transfer;
}
else {
+ if (beam->m_cond) {
+ apr_thread_cond_broadcast(beam->m_cond);
+ }
status = APR_EAGAIN;
}
leave:
Modified: httpd/httpd/trunk/modules/http2/h2_mplx.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_mplx.c?rev=1761477&r1=1761476&r2=1761477&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_mplx.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_mplx.c Mon Sep 19 16:21:42 2016
@@ -545,7 +545,7 @@ static int task_abort_connection(void *c
if (task->input.beam) {
h2_beam_abort(task->input.beam);
}
- if (task->output.beam) {
+ if (task->worker_started && !task->worker_done && task->output.beam) {
h2_beam_abort(task->output.beam);
}
return 1;
Modified: httpd/httpd/trunk/modules/http2/h2_mplx.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_mplx.h?rev=1761477&r1=1761476&r2=1761477&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_mplx.h (original)
+++ httpd/httpd/trunk/modules/http2/h2_mplx.h Mon Sep 19 16:21:42 2016
@@ -158,6 +158,8 @@ void h2_mplx_task_done(h2_mplx *m, struc
*/
apr_uint32_t h2_mplx_shutdown(h2_mplx *m);
+int h2_mplx_is_busy(h2_mplx *m);
+
/*******************************************************************************
* IO lifetime of streams.
******************************************************************************/
Modified: httpd/httpd/trunk/modules/http2/h2_stream.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_stream.c?rev=1761477&r1=1761476&r2=1761477&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_stream.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_stream.c Mon Sep 19 16:21:42 2016
@@ -513,6 +513,9 @@ static apr_status_t fill_buffer(h2_strea
}
status = h2_beam_receive(stream->output, stream->buffer,
APR_NONBLOCK_READ, amount);
+ ap_log_cerror(APLOG_MARK, APLOG_TRACE2, status, stream->session->c,
+ "h2_stream(%ld-%d): beam_received",
+ stream->session->id, stream->id);
/* The buckets we reveive are using the stream->buffer pool as
* lifetime which is exactly what we want since this is stream->pool.
*
Modified: httpd/httpd/trunk/modules/http2/h2_task.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_task.c?rev=1761477&r1=1761476&r2=1761477&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_task.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_task.c Mon Sep 19 16:21:42 2016
@@ -383,6 +383,11 @@ static apr_status_t send_out(h2_task *ta
h2_task_logio_add_bytes_out(task->c, written);
}
}
+ else {
+ ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, task->c,
+ "h2_task(%s): send_out (%ld bytes)",
+ task->id, (long)written);
+ }
return status;
}
@@ -542,8 +547,14 @@ static apr_status_t h2_filter_stream_out
apr_bucket_brigade* brigade)
{
h2_task *task = h2_ctx_cget_task(filter->c);
- AP_DEBUG_ASSERT(task);
- return output_write(task, filter, brigade);
+ apr_status_t status;
+
+ ap_assert(task);
+ status = output_write(task, filter, brigade);
+ if (status != APR_SUCCESS) {
+ h2_task_rst(task, H2_ERR_INTERNAL_ERROR);
+ }
+ return status;
}
static apr_status_t h2_filter_read_response(ap_filter_t* filter,