When a request is cancelled part way through nginx calls the cleanup
handler. This was set to delete the base fetch, but the proxy fetch was
sometimes not done with it yet. Both nginx and pagespeed must be finished with
the base fetch before it's safe to delete it. Pagespeed calls Done(), and this
adds Release() for nginx to call. Whichever is called second deletes the
base_fetch. We use a count of references that starts at two and is decremented
atomically with a memory barrier once when Done() is called and once when
Release() is called.
Fixes#103, #104, and #106.
Because we're a non-blocking server we need to run a scheduler thread or else
alerts we set might not fire. We need to be careful to start it after we fork.
Better long term would be to use an nginx timer and avoid the extra thread;
tracking this in #111.
Fixes#55
- restores slow worker initialization/termination
- amend an error I apparently made while rebasing to head:
- do not null the lru cache when using memcached (accidentally
left in)
- remove debug fprintf's
- remove comment about virtual hosts
- restore a TODO
- abort when memcached is configure and we fail to connect
to the memcached interface
The pagespeed api for handling logs has changed, we need to change with it in
order to build against the latest pagespeed optimization libraries.
Separately, a new test was added to the generic system test that depends on the
property cache (insert_dns_prefetch). We've not ported the property cache yet,
so this test will fail, and I've added it to the list of failing tests.
Merge of Otto's pull request #105:
This wires up and executes cleanup code.
There is an issue when sending SIGTERM to a worker under high load, I will
create a separate issue for that. Normal shutdowns and reloads are working.
Fixes#84.
The issue with workers under high load is #109.
Example:
pagespeed FetchProxy 127.0.0.1:8081;
With a proxy set the fetcher will send all outside requests through the proxy.
Like ModPagespeedFetchProxy, this is intended to be used for load tests.
For now, this must be set in the 'http' block.
Fixes#98, and is needed for #41.
ServerContext::GetQueryOptions modifies the url passed to it, removing any
ModPagespeedFoo=Bar query parameters. CreateNewProxyFetch needs that modified
url but we were giving it the unmodified one.
Fixes#83
We were sometimes failing to set last_buf when we should, but being protected
from the consequences by another bug that made us usually send additional extra
buffers with last_buf set.
See discussion in #78, pull request was #94.
Within the anonymous namespace in ngx_pagespeed.css we don't really need to be
using the long `ngx_http_pagespeed_` prefix. Switching to just `ps_` should be
safe. For symbols that need to be visible outside this file, though, we need to
keep the long prefix.
Fixes#85.
Nginx allows configuration at three levels:
- main
- server
- location
Previously we did everything at the server level, which made for a few problems:
- we didn't support options in location blocks
- we created an NgxRewriteDriverFactory for every server block, which when
combined with the Serf fetcher meant we had separate fetch pools for every
server. If someone had nginx configured with a lot of server blocks, we
could attempt far too many simultaneous loopback fetches and DOS ourself.
Now we store things at several levels:
- main
- rewrite driver factory
- server
- most things
- location
- directory specific options
When returning NGX_ERROR in the header filter, apperently nginx already
finalizes the http request for us. This fixes#79
It also puts a check in place for a switch label that should be impossible to
reach.
(Merged from oschaaf-issue-79.)
Link against the debug versions of the mod_pagespeed libraries when nginx is
configured with --with-debug.
Requires that said libraries have been pre-built with BUILDTYPE=Debug.
If we get an invalid filename in a request for static pagespeed content, we
should return NGX_DECLINED from the handler so that nginx can 404 for us.
Fixes issue #67.
Requests to:
/ngx_pagespeed_static/...
can be handled synchronously by pagespeed. They're used for support files for
optimizations, like js_defer.js.
This also includes a couple refactors:
- I pulled most of NgxBaseFetch::CopyBufferToNginx() out into
ngx_http_pagespeed_string_piece_to_buffer_chain().
- ngx_http_pagespeed_create_request_context() now returns a
CreateRequestContext::Response which gives callers more detailed information
about the request.
- I also pulled ngx_http_pagespeed_set_cache_control() out of
ngx_http_pagespeed_header_filter().
Fixes issue #62.