Fossil SCM

Change the backoffice-nodelay setting back to default off. Work around a bug in althttpd by making sure CGI runs with no file descriptors open other than 0, 1, and 2.

drh 2018-08-01 06:43 failed-fix
Commit 1073593e901e179137d9c332ac577dbff9fd1fdfc2f6912d03bd3b7189c2fca8
--- src/backoffice.c
+++ src/backoffice.c
@@ -262,11 +262,11 @@
262262
getpid());
263263
}
264264
backoffice_work();
265265
break;
266266
}
267
- if( backofficeNoDelay || db_get_boolean("backoffice-nodelay",1) ){
267
+ if( backofficeNoDelay || db_get_boolean("backoffice-nodelay",0) ){
268268
/* If the no-delay flag is set, exit immediately rather than queuing
269269
** up. Assume that some future request will come along and handle any
270270
** necessary backoffice work. */
271271
db_end_transaction(0);
272272
break;
273273
--- src/backoffice.c
+++ src/backoffice.c
@@ -262,11 +262,11 @@
262 getpid());
263 }
264 backoffice_work();
265 break;
266 }
267 if( backofficeNoDelay || db_get_boolean("backoffice-nodelay",1) ){
268 /* If the no-delay flag is set, exit immediately rather than queuing
269 ** up. Assume that some future request will come along and handle any
270 ** necessary backoffice work. */
271 db_end_transaction(0);
272 break;
273
--- src/backoffice.c
+++ src/backoffice.c
@@ -262,11 +262,11 @@
262 getpid());
263 }
264 backoffice_work();
265 break;
266 }
267 if( backofficeNoDelay || db_get_boolean("backoffice-nodelay",0) ){
268 /* If the no-delay flag is set, exit immediately rather than queuing
269 ** up. Assume that some future request will come along and handle any
270 ** necessary backoffice work. */
271 db_end_transaction(0);
272 break;
273
+1 -5
--- src/cgi.c
+++ src/cgi.c
@@ -1929,16 +1929,12 @@
19291929
fd = dup(connection);
19301930
if( fd!=0 ) nErr++;
19311931
close(1);
19321932
fd = dup(connection);
19331933
if( fd!=1 ) nErr++;
1934
- if( 0 && !g.fAnyTrace ){
1935
- close(2);
1936
- fd = dup(connection);
1937
- if( fd!=2 ) nErr++;
1938
- }
19391934
close(connection);
1935
+ for(fd=3; close(fd)==0; fd++){}
19401936
g.nPendingRequest = nchildren+1;
19411937
g.nRequest = nRequest+1;
19421938
return nErr;
19431939
}
19441940
}
19451941
--- src/cgi.c
+++ src/cgi.c
@@ -1929,16 +1929,12 @@
1929 fd = dup(connection);
1930 if( fd!=0 ) nErr++;
1931 close(1);
1932 fd = dup(connection);
1933 if( fd!=1 ) nErr++;
1934 if( 0 && !g.fAnyTrace ){
1935 close(2);
1936 fd = dup(connection);
1937 if( fd!=2 ) nErr++;
1938 }
1939 close(connection);
 
1940 g.nPendingRequest = nchildren+1;
1941 g.nRequest = nRequest+1;
1942 return nErr;
1943 }
1944 }
1945
--- src/cgi.c
+++ src/cgi.c
@@ -1929,16 +1929,12 @@
1929 fd = dup(connection);
1930 if( fd!=0 ) nErr++;
1931 close(1);
1932 fd = dup(connection);
1933 if( fd!=1 ) nErr++;
 
 
 
 
 
1934 close(connection);
1935 for(fd=3; close(fd)==0; fd++){}
1936 g.nPendingRequest = nchildren+1;
1937 g.nRequest = nRequest+1;
1938 return nErr;
1939 }
1940 }
1941
+1 -1
--- src/db.c
+++ src/db.c
@@ -3027,11 +3027,11 @@
30273027
** If autosync is enabled setting this to a value greater
30283028
** than zero will cause autosync to try no more than this
30293029
** number of attempts if there is a sync failure.
30303030
*/
30313031
/*
3032
-** SETTING: backoffice-nodelay boolean default=on
3032
+** SETTING: backoffice-nodelay boolean default=off
30333033
** If backoffice-nodelay is true, then the backoffice processing
30343034
** will never invoke sleep(). If it has nothing useful to do,
30353035
** it simply exits.
30363036
*/
30373037
/*
30383038
--- src/db.c
+++ src/db.c
@@ -3027,11 +3027,11 @@
3027 ** If autosync is enabled setting this to a value greater
3028 ** than zero will cause autosync to try no more than this
3029 ** number of attempts if there is a sync failure.
3030 */
3031 /*
3032 ** SETTING: backoffice-nodelay boolean default=on
3033 ** If backoffice-nodelay is true, then the backoffice processing
3034 ** will never invoke sleep(). If it has nothing useful to do,
3035 ** it simply exits.
3036 */
3037 /*
3038
--- src/db.c
+++ src/db.c
@@ -3027,11 +3027,11 @@
3027 ** If autosync is enabled setting this to a value greater
3028 ** than zero will cause autosync to try no more than this
3029 ** number of attempts if there is a sync failure.
3030 */
3031 /*
3032 ** SETTING: backoffice-nodelay boolean default=off
3033 ** If backoffice-nodelay is true, then the backoffice processing
3034 ** will never invoke sleep(). If it has nothing useful to do,
3035 ** it simply exits.
3036 */
3037 /*
3038
+5
--- src/main.c
+++ src/main.c
@@ -2019,10 +2019,15 @@
20192019
}
20202020
g.httpOut = stdout;
20212021
g.httpIn = stdin;
20222022
fossil_binary_mode(g.httpOut);
20232023
fossil_binary_mode(g.httpIn);
2024
+#if !defined(_WIN32)
2025
+ /* Work around a bug in older versions of althttpd by making sure no
2026
+ ** file descriptors other than 0, 1, and 2 are open. */
2027
+ { int i; for(i=3; close(i)==0; i++){} }
2028
+#endif
20242029
g.cgiOutput = 1;
20252030
blob_read_from_file(&config, zFile, ExtFILE);
20262031
while( blob_line(&config, &line) ){
20272032
if( !blob_token(&line, &key) ) continue;
20282033
if( blob_buffer(&key)[0]=='#' ) continue;
20292034
--- src/main.c
+++ src/main.c
@@ -2019,10 +2019,15 @@
2019 }
2020 g.httpOut = stdout;
2021 g.httpIn = stdin;
2022 fossil_binary_mode(g.httpOut);
2023 fossil_binary_mode(g.httpIn);
 
 
 
 
 
2024 g.cgiOutput = 1;
2025 blob_read_from_file(&config, zFile, ExtFILE);
2026 while( blob_line(&config, &line) ){
2027 if( !blob_token(&line, &key) ) continue;
2028 if( blob_buffer(&key)[0]=='#' ) continue;
2029
--- src/main.c
+++ src/main.c
@@ -2019,10 +2019,15 @@
2019 }
2020 g.httpOut = stdout;
2021 g.httpIn = stdin;
2022 fossil_binary_mode(g.httpOut);
2023 fossil_binary_mode(g.httpIn);
2024 #if !defined(_WIN32)
2025 /* Work around a bug in older versions of althttpd by making sure no
2026 ** file descriptors other than 0, 1, and 2 are open. */
2027 { int i; for(i=3; close(i)==0; i++){} }
2028 #endif
2029 g.cgiOutput = 1;
2030 blob_read_from_file(&config, zFile, ExtFILE);
2031 while( blob_line(&config, &line) ){
2032 if( !blob_token(&line, &key) ) continue;
2033 if( blob_buffer(&key)[0]=='#' ) continue;
2034

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button