Commit 421ed88
committed
bugfix: ngx.req.start_time() corrupted nginx's cached time on freenginx.
ngx_stream_lua_ffi_req_start_time() (the freenginx branch) called
ngx_timeofday() and then mutated *tp directly. ngx_timeofday() returns
a pointer to ngx_cached_time, the global time cache shared by the
entire worker, so the subtraction of (ngx_current_msec -
r->session->start_time) silently rewound the clock for every
subsequent ngx_timeofday() reader within the same event-loop tick
(log timestamps, timer deadlines, etc.).
Copy the cached time into a local ngx_time_t and do the arithmetic
there.
Mirrors the fix in lua-nginx-module.1 parent 4fb91d9 commit 421ed88
1 file changed
Lines changed: 14 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
| 42 | + | |
41 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
42 | 47 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
48 | 56 | | |
49 | 57 | | |
50 | | - | |
| 58 | + | |
51 | 59 | | |
52 | 60 | | |
53 | 61 | | |
| |||
0 commit comments