Fossil

Check-in [1073593e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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. (Edit:) These changes proved insufficient to clear the problem.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | failed-fix
Files: files | file ages | folders
SHA3-256: 1073593e901e179137d9c332ac577dbff9fd1fdfc2f6912d03bd3b7189c2fca8
User & Date: drh 2018-08-01 06:43:41
Original Comment: 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.
Context
2018-08-01
06:49
Extra efforts to close higher-numbered file descriptors prior to starting CGI. check-in: d6053249 user: drh tags: failed-fix
06:43
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. (Edit:) These changes proved insufficient to clear the problem. check-in: 1073593e user: drh tags: failed-fix
2018-07-31
23:38
Make backoffice-nodelay consistently default on. check-in: 71260ba2 user: drh tags: forum-v2
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/backoffice.c.

   260    260         if( g.fAnyTrace ){
   261    261           fprintf(stderr, "/***** Begin Backoffice Processing %d *****/\n",
   262    262                           getpid());
   263    263         }
   264    264         backoffice_work();
   265    265         break;
   266    266       }
   267         -    if( backofficeNoDelay || db_get_boolean("backoffice-nodelay",1) ){
          267  +    if( backofficeNoDelay || db_get_boolean("backoffice-nodelay",0) ){
   268    268         /* If the no-delay flag is set, exit immediately rather than queuing
   269    269         ** up.  Assume that some future request will come along and handle any
   270    270         ** necessary backoffice work. */
   271    271         db_end_transaction(0);
   272    272         break;
   273    273       }
   274    274       /* This process needs to queue up and wait for the current lease

Changes to src/cgi.c.

  1927   1927             int nErr = 0, fd;
  1928   1928             close(0);
  1929   1929             fd = dup(connection);
  1930   1930             if( fd!=0 ) nErr++;
  1931   1931             close(1);
  1932   1932             fd = dup(connection);
  1933   1933             if( fd!=1 ) nErr++;
  1934         -          if( 0 && !g.fAnyTrace ){
  1935         -            close(2);
  1936         -            fd = dup(connection);
  1937         -            if( fd!=2 ) nErr++;
  1938         -          }
  1939   1934             close(connection);
         1935  +          for(fd=3; close(fd)==0; fd++){}
  1940   1936             g.nPendingRequest = nchildren+1;
  1941   1937             g.nRequest = nRequest+1;
  1942   1938             return nErr;
  1943   1939           }
  1944   1940         }
  1945   1941       }
  1946   1942       /* Bury dead children */

Changes to src/db.c.

  3025   3025   /*
  3026   3026   ** SETTING: autosync-tries  width=16 default=1
  3027   3027   ** If autosync is enabled setting this to a value greater
  3028   3028   ** than zero will cause autosync to try no more than this
  3029   3029   ** number of attempts if there is a sync failure.
  3030   3030   */
  3031   3031   /*
  3032         -** SETTING: backoffice-nodelay boolean default=on
         3032  +** SETTING: backoffice-nodelay boolean default=off
  3033   3033   ** If backoffice-nodelay is true, then the backoffice processing
  3034   3034   ** will never invoke sleep().  If it has nothing useful to do,
  3035   3035   ** it simply exits.
  3036   3036   */
  3037   3037   /*
  3038   3038   ** SETTING: binary-glob     width=40 versionable block-text
  3039   3039   ** The VALUE of this setting is a comma or newline-separated list of

Changes to src/main.c.

  2017   2017     }else{
  2018   2018       zFile = g.argv[1];
  2019   2019     }
  2020   2020     g.httpOut = stdout;
  2021   2021     g.httpIn = stdin;
  2022   2022     fossil_binary_mode(g.httpOut);
  2023   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
  2024   2029     g.cgiOutput = 1;
  2025   2030     blob_read_from_file(&config, zFile, ExtFILE);
  2026   2031     while( blob_line(&config, &line) ){
  2027   2032       if( !blob_token(&line, &key) ) continue;
  2028   2033       if( blob_buffer(&key)[0]=='#' ) continue;
  2029   2034       if( blob_eq(&key, "repository:") && blob_tail(&line, &value) ){
  2030   2035         /* repository: FILENAME