)]}'
{
  "commit": "09304da5b9f7a094520f8ab2860043eb167ad848",
  "tree": "37a28e84878ed9b1d01a5d81e7d1ec6aeb07e7e5",
  "parents": [
    "97438e423f66260151dd1ecfcda4c312a841f0fb"
  ],
  "author": {
    "name": "Maxim Dounin",
    "email": "mdounin@mdounin.ru",
    "time": "Fri Jan 20 21:14:19 2017 +0300"
  },
  "committer": {
    "name": "Maxim Dounin",
    "email": "mdounin@mdounin.ru",
    "time": "Fri Jan 20 21:14:19 2017 +0300"
  },
  "message": "Upstream: fixed cache corruption and socket leaks with aio_write.\n\nThe ngx_event_pipe() function wasn\u0027t called on write events with\nwev-\u003edelayed set.  As a result, threaded writing results weren\u0027t\nproperly collected in ngx_event_pipe_write_to_downstream() when a\nwrite event was triggered for a completed write.\n\nFurther, this wasn\u0027t detected, as p-\u003eaio was reset by a thread completion\nhandler, and results were later collected in ngx_event_pipe_read_upstream()\ninstead of scheduling a new write of additional data.  If this happened\non the last reading from an upstream, last part of the response was never\nwritten to the cache file.\n\nSimilar problems might also happen in case of timeouts when writing to\nclient, as this also results in ngx_event_pipe() not being called on write\nevents.  In this scenario socket leaks were observed.\n\nFix is to check if p-\u003ewriting is set in ngx_event_pipe_read_upstream(), and\ntherefore collect results of previous write operations in case of read events\nas well, similar to how we do so in ngx_event_pipe_write_downstream().\nThis is enough to fix the wev-\u003edelayed case.  Additionally, we now call\nngx_event_pipe() from ngx_http_upstream_process_request() if there are\nuncollected write operations (p-\u003ewriting and !p-\u003eaio).  This also fixes\nthe wev-\u003etimedout case.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "be1b475bbf486813064081717daf45b82b3e482e",
      "old_mode": 33188,
      "old_path": "src/event/ngx_event_pipe.c",
      "new_id": "f54e070059404f449f7953b9b03c61b3d9c42c00",
      "new_mode": 33188,
      "new_path": "src/event/ngx_event_pipe.c"
    },
    {
      "type": "modify",
      "old_id": "1386bdb9552f728c6e6e588ddda2e3f31657258e",
      "old_mode": 33188,
      "old_path": "src/http/ngx_http_upstream.c",
      "new_id": "168f6b48f8c26b70f08cd10dca7ab46ce2860663",
      "new_mode": 33188,
      "new_path": "src/http/ngx_http_upstream.c"
    }
  ]
}
