Skip to content
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

合并agentzh更新 #2

Open
wants to merge 1,521 commits into
base: master
Choose a base branch
from
Open

合并agentzh更新 #2

wants to merge 1,521 commits into from

Conversation

lhmwzy
Copy link
Owner

@lhmwzy lhmwzy commented Apr 26, 2014

合并agentzh更新

@agentzh agentzh force-pushed the master branch 2 times, most recently from 701dd52 to cd01e7b Compare December 8, 2014 05:23
@agentzh agentzh force-pushed the master branch 4 times, most recently from e7ac10c to cfd4f90 Compare January 31, 2016 19:04
@agentzh agentzh force-pushed the master branch 2 times, most recently from c2d6c40 to 1967998 Compare May 8, 2016 20:16
@agentzh agentzh force-pushed the master branch 3 times, most recently from ab60f70 to 397f366 Compare October 31, 2016 23:56
zhongweiy and others added 12 commits March 4, 2024 22:48
    This memory corruption will cause nginx crash and can reproduce under
    "--with-no-pool-patch" build by running t/048-match-dfa.t TEST 9.

    test log:
    ok 1 - t/048-match-dfa.t TEST 9: multiple match calls with captures and DFA. - status code ok
    ok 2 - t/048-match-dfa.t TEST 9: multiple match calls with captures and DFA. - response_body - response is expected (repeated req 0, req 0)
    t/048-match-dfa.t TEST 9: multiple match calls with captures and DFA. - Can't connect to 127.0.0.1:1984: Connection refused
            Retry connecting after 0.675 sec
    t/048-match-dfa.t TEST 9: multiple match calls with captures and DFA. - Can't connect to 127.0.0.1:1984: Connection refused
            Retry connecting after 0.825 sec

    error.log
    [notice] 1683757#0: using the "epoll" event method
    [notice] 1683757#0: openresty/1.25.3.1 (no pool)
    [notice] 1683757#0: built by gcc 13.2.1 20231011 (Red Hat 13.2.1-4) (GCC)
    [notice] 1683757#0: OS: Linux 6.7.4-100.fc38.x86_64
    [notice] 1683757#0: getrlimit(RLIMIT_NOFILE): 1024:524288
    free(): invalid next size (fast)

Co-author-by: lijunlong<lijunlong@openresty.com>
This is a rewrite PR #1687  from vislee <louivislee@gmail.com>
Co-authored-by: lijunlong <lijunlong@openresty.com>
Co-authored-by: Bas van Kervel <basvankervel@velorum.io>
Co-authored-by: lijunlong <lijunlong@openresty.com>
… data integrity.

==338736== Invalid read of size 8
==338736==    at 0x209890: ngx_http_lua_socket_tcp_handler (ngx_http_lua_socket_tcp.c:3341)
==338736==    by 0x16CB21: ngx_epoll_process_events (ngx_epoll_module.c:1001)
==338736==    by 0x160213: ngx_process_events_and_timers (ngx_event.c:262)
==338736==    by 0x16B772: ngx_single_process_cycle (ngx_process_cycle.c:338)
==338736==    by 0x13E8B7: main (nginx.c:394)
==338736==  Address 0x68c8678 is 8 bytes inside a block of size 1,488 free'd
==338736==    at 0x48472AC: free (vg_replace_malloc.c:974)
==338736==    by 0x14035D: ngx_destroy_pool (ngx_palloc.c:76)
==338736==    by 0x18694E: ngx_http_free_request (ngx_http_request.c:3799)
==338736==    by 0x186AE0: ngx_http_close_request (ngx_http_request.c:3708)
==338736==    by 0x187A6A: ngx_http_finalize_connection (ngx_http_request.c:2812)
==338736==    by 0x1887C7: ngx_http_finalize_request (ngx_http_request.c:2685)
==338736==    by 0x1883CC: ngx_http_finalize_request (ngx_http_request.c:2571)
==338736==    by 0x2010B2: ngx_http_lua_finalize_request (ngx_http_lua_util.c:3706)
==338736==    by 0x20B6A1: ngx_http_lua_socket_tcp_resume_helper (ngx_http_lua_socket_tcp.c:6132)
==338736==    by 0x20BA75: ngx_http_lua_socket_tcp_read_resume (ngx_http_lua_socket_tcp.c:6030)
==338736==    by 0x20356B: ngx_http_lua_content_wev_handler (ngx_http_lua_contentby.c:152)
==338736==    by 0x20CA9F: ngx_http_lua_socket_handle_read_success (ngx_http_lua_socket_tcp.c:3602)
==338736==    by 0x20CA9F: ngx_http_lua_socket_tcp_read (ngx_http_lua_socket_tcp.c:2607)
==338736==    by 0x20D289: ngx_http_lua_socket_read_handler (ngx_http_lua_socket_tcp.c:3405)
==338736==    by 0x20991D: ngx_http_lua_socket_tcp_handler (ngx_http_lua_socket_tcp.c:3356)
==338736==    by 0x16C970: ngx_epoll_process_events (ngx_epoll_module.c:968)
==338736==    by 0x160213: ngx_process_events_and_timers (ngx_event.c:262)
==338736==    by 0x16B772: ngx_single_process_cycle (ngx_process_cycle.c:338)
==338736==    by 0x13E8B7: main (nginx.c:394)
==338736==  Block was alloc'd at
==338736==    at 0x484482F: malloc (vg_replace_malloc.c:431)
==338736==    by 0x165448: ngx_alloc (ngx_alloc.c:22)
==338736==    by 0x1401B2: ngx_malloc (ngx_palloc.c:137)
==338736==    by 0x1403EC: ngx_palloc (ngx_palloc.c:120)
==338736==    by 0x140503: ngx_pcalloc (ngx_palloc.c:215)
==338736==    by 0x185BC9: ngx_http_alloc_request (ngx_http_request.c:580)
==338736==    by 0x186356: ngx_http_create_request (ngx_http_request.c:536)
==338736==    by 0x189F2A: ngx_http_wait_request_handler (ngx_http_request.c:518)
==338736==    by 0x16C970: ngx_epoll_process_events (ngx_epoll_module.c:968)
==338736==    by 0x160213: ngx_process_events_and_timers (ngx_event.c:262)
==338736==    by 0x16B772: ngx_single_process_cycle (ngx_process_cycle.c:338)
==338736==    by 0x13E8B7: main (nginx.c:394)
==338736==
monkeyDluffy6017 and others added 17 commits April 11, 2024 20:54
Without the initialization, the feature test ends with:

error: 'set' may be used uninitialized [-Werror=maybe-uninitialized]
Co-authored-by: Thibault Charbonnier <thibaultcha@me.com>
lua-nginx-module/src/ngx_http_lua_balancer.c: In function ‘ngx_http_lua_balancer_get_peer’:
lua-nginx-module/src/ngx_http_lua_balancer.c:389:41: error: variable ‘u’ set but not used [-Werror=unused-but-set-variable]
  389 |     ngx_http_upstream_t                *u;
      |
In the balancer phase, when obtaining a connection from the upstream
connection pool, the `cached` attribute of the peer connection is set
to 1(`pc->cached = 1;`), indicating that the connection is obtained
from the cache.

If an error occurs during the use of this connection, such as
"upstream prematurely closed connection" the system will increase the
`tries` attribute of the peer connection by executing
`u->peer.tries++`.

This PR restores tries by callbacks to the balancer when
`u->peer.tries++` is unexpectedly set.

Signed-off-by: tzssangglass <tzssangglass@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet