/ Check-in [d8568aac]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Ensure that test tool "tserver" finalizes all statements before attempting to close a database handle.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | server-edition
Files: files | file ages | folders
SHA3-256: d8568aacf083b63cdcf68d744ddb07a7615d14f169be6c632813a266a1e8a1cf
User & Date: dan 2017-06-20 19:20:07
Context
2017-06-28
20:12
Fix bugs in test program tserver.c. Leaf check-in: 093b9108 user: dan tags: server-edition
2017-06-27
20:23
Support clients within a single process only. check-in: dfa9a4d5 user: dan tags: server-process-edition
2017-06-20
19:20
Ensure that test tool "tserver" finalizes all statements before attempting to close a database handle. check-in: d8568aac user: dan tags: server-edition
2017-06-07
15:55
Add too/tserver.c - the implementation of a simple multi-threaded server designed for interactive testing of concurrency between connections used by different threads of the same process. check-in: 05b4fc43 user: dan tags: server-edition
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to tool/tserver.c.

   264    264   }
   265    265   
   266    266   static void *handle_client(void *pArg){
   267    267     char zCmd[32*1024];             /* Read buffer */
   268    268     int nCmd = 0;                   /* Valid bytes in zCmd[] */
   269    269     int res;                        /* Result of read() call */
   270    270     int rc = SQLITE_OK;
          271  +  int j;
   271    272   
   272    273     ClientCtx ctx;
   273    274     memset(&ctx, 0, sizeof(ClientCtx));
   274    275   
   275    276     ctx.fd = (int)(intptr_t)pArg;
   276    277     ctx.nRepeat = 1;
   277    278     rc = sqlite3_open(zDatabaseName, &ctx.db);
................................................................................
   342    343           }
   343    344         }
   344    345       }while( rc==SQLITE_OK && nConsume>0 );
   345    346     }
   346    347   
   347    348     fprintf(stdout, "Client %d disconnects\n", ctx.fd);
   348    349     close(ctx.fd);
          350  +  for(j=0; j<ctx.nPrepare; j++){
          351  +    sqlite3_finalize(ctx.apPrepare[j]);
          352  +  }
          353  +  sqlite3_free(ctx.apPrepare);
   349    354     sqlite3_close(ctx.db);
   350    355     return 0;
   351    356   } 
   352    357   
   353    358   int main(int argc, char *argv[]) {
   354    359     sqlite3 *db;
   355    360     int sfd;