mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	puppet: Each worker should chdir after forking.
The top-level `chdir` setting only does the chdir once, at initial `uwsgi` startup time. Rolling restarts, however, however, require that `uwsgi` pick up the _new_ value of the `current` directory, and start new workers in that directory -- as currently implemented, rolling restarts cannot restart into newer versions of the code, only the same one in which they were started. Use [configurable hooks][1] to execute the `chdir` after every fork. This causes the following behaviour: ``` Thu May 12 18:56:55 2022 - chain reload starting... Thu May 12 18:56:55 2022 - chain next victim is worker 1 Gracefully killing worker 1 (pid: 1757689)... worker 1 killed successfully (pid: 1757689) Respawned uWSGI worker 1 (new pid: 1757969) Thu May 12 18:56:56 2022 - chain is still waiting for worker 1... running "chdir:/home/zulip/deployments/current" (post-fork)... Thu May 12 18:56:57 2022 - chain is still waiting for worker 1... Thu May 12 18:56:58 2022 - chain is still waiting for worker 1... Thu May 12 18:56:59 2022 - chain is still waiting for worker 1... WSGI app 0 (mountpoint='') ready in 3 seconds on interpreter 0x55dfca409170 pid: 1757969 (default app) Thu May 12 18:57:00 2022 - chain next victim is worker 2 [...] ``` ..and so forth down the line of processes. Each process is correctly started in the _current_ value of `current`, and thus picks up the correct code. [1]: https://uwsgi-docs.readthedocs.io/en/latest/Hooks.html
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							0bfe973b65
						
					
				
				
					commit
					20b7a2d450
				
			@@ -18,6 +18,7 @@ stats=/home/zulip/deployments/uwsgi-stats
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
<% if @uwsgi_rolling_restart != '' -%>
 | 
					<% if @uwsgi_rolling_restart != '' -%>
 | 
				
			||||||
master-fifo=/home/zulip/deployments/uwsgi-control
 | 
					master-fifo=/home/zulip/deployments/uwsgi-control
 | 
				
			||||||
 | 
					hook-post-fork=chdir:/home/zulip/deployments/current
 | 
				
			||||||
# lazy-apps are required for rolling restarts:
 | 
					# lazy-apps are required for rolling restarts:
 | 
				
			||||||
# https://uwsgi-docs.readthedocs.io/en/latest/articles/TheArtOfGracefulReloading.html#preforking-vs-lazy-apps-vs-lazy
 | 
					# https://uwsgi-docs.readthedocs.io/en/latest/articles/TheArtOfGracefulReloading.html#preforking-vs-lazy-apps-vs-lazy
 | 
				
			||||||
lazy-apps=true
 | 
					lazy-apps=true
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user