Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Improved SQL logging after SIGPIPE. Exponential backoff in the warnings issued when the backoffice process misses its deadline. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
f525b6d5e9dcb775a931aa2949684d9b |
User & Date: | drh 2018-07-19 16:27:51.346 |
Context
2018-07-19
| ||
17:22 | The email_auto_exec property is removed. The routine that sends alert emails is renamed to email_backoffice() and it is configured to always auto-run. ... (check-in: ada7ecde user: drh tags: trunk) | |
16:27 | Improved SQL logging after SIGPIPE. Exponential backoff in the warnings issued when the backoffice process misses its deadline. ... (check-in: f525b6d5 user: drh tags: trunk) | |
15:58 | At the end of CGI processing, close the output pipe before starting backoffice processing, in order to let higher levels know that the CGI is finished. ... (check-in: a32a92d2 user: drh tags: trunk) | |
Changes
Changes to src/backoffice.c.
︙ | ︙ | |||
182 183 184 185 186 187 188 189 190 191 192 193 194 195 | ** routine enters a loop to do background work periodically. */ void backoffice_run(void){ Lease x; sqlite3_uint64 tmNow; sqlite3_uint64 idSelf; int lastWarning = 0; if( g.db==0 ){ fossil_panic("database not open for backoffice processing"); } if( db_transaction_nesting_depth()!=0 ){ fossil_panic("transaction %s not closed prior to backoffice processing", db_transaction_start_point()); | > | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | ** routine enters a loop to do background work periodically. */ void backoffice_run(void){ Lease x; sqlite3_uint64 tmNow; sqlite3_uint64 idSelf; int lastWarning = 0; int warningDelay = 30; if( g.db==0 ){ fossil_panic("database not open for backoffice processing"); } if( db_transaction_nesting_depth()!=0 ){ fossil_panic("transaction %s not closed prior to backoffice processing", db_transaction_start_point()); |
︙ | ︙ | |||
228 229 230 231 232 233 234 | x.idNext = idSelf; x.tmNext = (tmNow>x.tmCurrent ? tmNow : x.tmCurrent) + BKOFCE_LEASE_TIME; backofficeWriteLease(&x); db_end_transaction(0); if( x.tmCurrent >= tmNow ){ sqlite3_sleep(1000*(x.tmCurrent - tmNow + 1)); }else{ | | > | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | x.idNext = idSelf; x.tmNext = (tmNow>x.tmCurrent ? tmNow : x.tmCurrent) + BKOFCE_LEASE_TIME; backofficeWriteLease(&x); db_end_transaction(0); if( x.tmCurrent >= tmNow ){ sqlite3_sleep(1000*(x.tmCurrent - tmNow + 1)); }else{ if( lastWarning+warningDelay < tmNow ){ fossil_warning( "backoffice process %lld still running after %d seconds", x.idCurrent, (int)(BKOFCE_LEASE_TIME + tmNow - x.tmCurrent)); lastWarning = tmNow; warningDelay *= 2; } sqlite3_sleep(1000); } } return; } |
︙ | ︙ |
Changes to src/db.c.
︙ | ︙ | |||
1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 | } g.repositoryOpen = 0; g.localOpen = 0; assert( g.dbConfig==0 ); assert( g.zConfigDbName==0 ); } /* ** Create a new empty repository database with the given name. ** ** Only the schema is initialized. The required VAR tables entries ** are not set by this routine and must be set separately in order ** to make the new file a valid database. | > > > > > > > > > > > > > > | 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 | } g.repositoryOpen = 0; g.localOpen = 0; assert( g.dbConfig==0 ); assert( g.zConfigDbName==0 ); } /* ** Close the database as quickly as possible without unnecessary processing. */ void db_panic_close(void){ if( g.db ){ int rc; sqlite3_wal_checkpoint(g.db, 0); rc = sqlite3_close(g.db); if( g.fSqlTrace ) fossil_trace("-- sqlite3_close(%d)\n", rc); } g.db = 0; g.repositoryOpen = 0; g.localOpen = 0; } /* ** Create a new empty repository database with the given name. ** ** Only the schema is initialized. The required VAR tables entries ** are not set by this routine and must be set separately in order ** to make the new file a valid database. |
︙ | ︙ |
Changes to src/main.c.
︙ | ︙ | |||
1446 1447 1448 1449 1450 1451 1452 | /* ** Called if a server gets a SIGPIPE. This often happens when a client ** webbrowser opens a connection but never sends the HTTP request */ void sigpipe_handler(int x){ #ifndef _WIN32 if( g.fAnyTrace ){ | | > | | 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 | /* ** Called if a server gets a SIGPIPE. This often happens when a client ** webbrowser opens a connection but never sends the HTTP request */ void sigpipe_handler(int x){ #ifndef _WIN32 if( g.fAnyTrace ){ fprintf(stderr,"/***** sigpipe received by subprocess %d ****\n", getpid()); } #endif db_panic_close(); exit(1); } /* ** Preconditions: ** ** * Environment variables are set up according to the CGI standard. ** |
︙ | ︙ |